#!/bin/rc # sysupgrade - upgrade the whole system # usage: sysupgrade curdir=`{pwd} # fetch available updates echo '∷ Updating system sources…' && sysupdate if(! test -d /lib/firmware/.git){ echo '∷ Cloning wireless firmware repository…' cd /lib/firmware && git/clone gits://git.9front.org/plan9front/firmware . } if not{ echo '∷ Checking for new wireless firmware…' cd /lib/firmware && git/pull } echo Sources updated. # check with user echo -n 'Would you like to continue and recompile? [y/N] ' switch(`{read}){ case [yY]* echo '∷ Beginning system upgrade…' case * echo 'Exiting without recompiling…' && exit } # create any missing directories echo '∷ Creating missing directories…' && cd / && . /sys/lib/rootstub # build some components first echo '∷ Building assembler(s) and linker(s)…' for(i in (8a 8l 7a 7l 6a 6l 5a 5l 2a 2l 1a 1l ka kl qa ql va vl)){ cd /sys/src/cmd/^$i && mk install } # nuke and rebuild cd /sys/src echo '∷ Building libraries…' && mk nuke echo '∷ Building system…' && mk install && mk clean # build manuals and docs echo '∷ Building manpage indices…' && cd /sys/man && mk echo '∷ Building documentation…' && cd /sys/doc && mk && mk html # build and install new kernel echo '∷ Building new kernel…' && cd /sys/src/9/pc64 && mk install echo '∷ Installing bootloader and kernel…' 9fs 9fat for(i in /n/9^('' fat)){ rm $i/9bootfat cp /386/9bootfat $i/ chmod +al $i/9bootfat cp $i/9pc64 $i/9pc64.bak cp /amd64/9pc64 $i/ unmount $i } # sync and return if(test -f /srv/cwfs.cmd) echo sync >>/srv/cwfs.cmd if not echo sync >>/srv/hjfs.cmd cd $curdir # fin. echo 'System upgrade complete.'