--- /n/sources/plan9/sys/lib/dist/pc/inst/configfs Fri May 20 13:16:35 2005 +++ /sys/lib/dist/pc/inst/configfs Mon Mar 28 00:00:00 2011 @@ -4,7 +4,7 @@ switch($1){ case checkdone - if(! ~ $fstype fossil fossil+venti){ + if(! ~ $fstype kfs fossil fossil+venti){ configfs=ready export configfs } @@ -14,8 +14,9 @@ echo echo ' fossil the new Plan9 fileserver' echo ' fossil+venti fossil + a archival dump server' + echo ' kfs the old Plan 9 on-disk file server' echo - prompt -d fossil 'File system' fossil fossil+venti + prompt -d fossil 'File system' fossil fossil+venti kfs fstype=$rd export fstype } --- /n/sources/plan9/sys/lib/dist/pc/inst/defs Fri Apr 1 13:10:37 2005 +++ /sys/lib/dist/pc/inst/defs Mon Mar 28 00:00:00 2011 @@ -159,4 +159,19 @@ grep -s $1 /net/ipifc/*/status >[2]/dev/null } +fn kfsname { + echo $1 | sed 's;/;_;g' +} +# make sure the kfs server for /dev/$1/fs is running. +# we use /srv/kfs.$1 +# + +fn runkfs { + if(! test -f /srv/kfs.$1 || ! mount /srv/kfs.$1 /n/kremvax) { + rm -f /srv/kfs.$1 /srv/kfs.$1.cmd + disk/kfs -n$1 -f /dev/$1/fs + } + disk/kfscmd -n$1 allow +} + --- /n/sources/plan9/sys/lib/dist/pc/inst/halt Wed May 18 13:55:49 2005 +++ /sys/lib/dist/pc/inst/halt Mon Mar 28 00:00:00 2011 @@ -1,7 +1,15 @@ #!/bin/rc echo -n 'Halting file systems...' - +for (i in /srv/kfs*) { + if(! ~ $i /srv/kfs*cmd) { + n=`{echo $i | sed 's!/srv/kfs\.(.*)!\1!'} + if(~ $n /srv/kfs) + disk/kfscmd halt + if not + disk/kfscmd -n$n halt + } +} if(ps | grep -s ' venti$') venti/sync -h tcp!127.0.0.1!17034 if(ps | grep -s ' fossil$'){ --- /n/sources/plan9/sys/lib/dist/pc/inst/iskfs Thu Jan 01 00:00:00 1970 +++ /sys/lib/dist/pc/inst/iskfs Mon Mar 28 00:00:00 2011 +0200 @@ -0,0 +1,9 @@ +#!/bin/rc + +if(! ~ $#* 1) { + echo 'usage: iskfs /dev/sdC0/part' >[1=2] + exit usage +} + +cmp -s <{dd -if $1 -bs 16 -count 1 -skip 16 >[2]/dev/null} <{echo 'kfs wren device'} +exit $status --- /n/sources/plan9/sys/lib/dist/pc/inst/mountdist Sun Apr 3 13:33:14 2005 +++ /sys/lib/dist/pc/inst/mountdist Mon Mar 28 00:00:00 2011 @@ -67,6 +67,7 @@ } case go + kfs=() fat=() ext2=() x9660=() @@ -80,6 +81,8 @@ n=`{echo $i | sed 's;/;_;g'} if(! test -f /tmp/localpart.$n) dd -if $i -bs 2048 -count 32 -of /tmp/localpart.$n >[2]/dev/null + if(iskfs /tmp/localpart.$n) + kfs=($kfs $i) if(isfat /tmp/localpart.$n) fat=($fat $i) if(isext2 /tmp/localpart.$n) @@ -96,6 +99,8 @@ echo for(i in $parts){ switch($i){ + case $kfs + echo ' '^$i^' (plan9 kfs)' case $fat echo ' '^$i^' (microsoft fat)' case $ext2 @@ -110,7 +115,7 @@ mountstatus=x while(! ~ $mountstatus ''){ - prompt -w '' 'Distribution disk' $fat $x9660 $fossil + prompt -w '' 'Distribution disk' $kfs $fat $x9660 $ext2 $fossil disk=$rd srvmedia=() @@ -118,6 +123,10 @@ switch($disk){ case $fs mountmedia=(bind /n/newfs /n/distmedia) + case $kfs + kname=`{kfsname $disk} + srvmedia=(disk/kfs -f $disk -n $kname) + mountmedia=(mount /srv/kfs.$kname /n/distmedia) case $fat srvmedia=(dossrv) mountmedia=(mount /srv/dos /n/distmedia $disk) --- /n/sources/plan9/sys/lib/dist/pc/inst/mountfs Fri Apr 1 13:10:39 2005 +++ /sys/lib/dist/pc/inst/mountfs Mon Mar 28 00:00:00 2011 @@ -4,6 +4,8 @@ # prereq: configfs switch($fstype){ +case kfs + exec mountkfs $* case fossil fossil+venti exec mountfossil $* case * --- /n/sources/plan9/sys/lib/dist/pc/inst/mountkfs Thu Jan 01 00:00:00 1970 +++ /sys/lib/dist/pc/inst/mountkfs Mon Mar 28 00:00:00 2011 @@ -0,0 +1,96 @@ +#!/bin/rc + +# desc: choose and mount file system partition + +switch($1){ +case go + echo 'The following partitions named fs* were found.' + echo + echo 'Please choose one to use as the installation file system' + echo 'for your Plan 9 installation.' + echo + files=(`{ls /dev/sd*/fs* /dev/fs/fs* >[2]/dev/null}) + ls -l $files + echo + if(~ $#files 1) + default=(-d $files) + if not + default=() + prompt $default 'Kfs partition to use for Plan 9 installation' $files + fs=$rd + export fs + + kname=`{kfsname $fs} + doinit=(-rb8192) + if(iskfs $fs){ + echo 'A Plan 9 kfs file system already exists on '^$fs^'.' + echo 'Do you want to wipe it clean?' + echo + prompt -d keep 'Wipe the Plan 9 file system clean' keep wipe + switch($rd){ + case keep + doinit=() + } + } + + log Starting kfs file server for $fs + unmount /n/newfs >[2]/dev/null + disk/kfscmd -n $kname halt >[2]/dev/null + rm -f /srv/kfs.$kname /srv/kfs.$kname.cmd + logprog disk/kfs -n $kname $doinit -f $fs + disk/kfscmd -n $kname allow >>[2]/srv/log + + log Mounting kfs file server for $fs + if(! logprog mount -c /srv/kfs.$kname /n/newfs){ + echo 'mounting kfs: '^$status + exit oops + } + + if(test -d /n/newfs/wrap){ + moveoldfs go + if(test -d /n/newfs/wrap) + exit cannotsmashold + } + if(! test -f /n/newfs/dist/replica/client/plan9.log){ + disk/kfscmd -n $kname 'create /dist sys sys 775 d' + disk/kfscmd -n $kname 'create /dist/replica sys sys 775 d' + disk/kfscmd -n $kname 'create /dist/replica/ndist sys sys 775' + disk/kfscmd -n $kname 'create /dist/replica/client sys sys 775 d' + disk/kfscmd -n $kname 'create /dist/replica/client/plan9.db sys sys 664' + disk/kfscmd -n $kname 'create /dist/replica/client/plan9.log sys sys 664 a' + } + +case checkready checkdone + if(! test -f /dev/sd*/fs*){ + mountfs=notdone + export mountfs + exit + } + if(! ~ $#fs 1 || ! test -f $fs){ + mountfs=ready + export mountfs + exit + } + kname=`{kfsname $fs} + if(! test -f /srv/kfs.$kname){ + disk/kfscmd -n $kname halt >[2]/dev/null + rm -f /srv/kfs.$kname /srv/kfs.$kname.cmd + logprog disk/kfs -n $kname -f $fs + disk/kfscmd -n $kname allow >>[2]/srv/log + } + if(test -f /srv/kfs.$kname && ! test -f /n/newfs/dist/replica/client/plan9.log){ + log Mounting kfs file server for $fs + if(! logprog mount -c /srv/kfs.$kname /n/newfs) + echo 'mounting kfs: '^$status + disk/kfscmd -n $kname allow >>[2]/srv/log + } + if(test -f /srv/kfs.$kname && test -f /n/newfs/dist/replica/client/plan9.log){ + mountfs=done + export mountfs + exit + } + mountfs=ready + export mountfs + exit +} + --- /n/sources/sys/lib/dist/pc/inst/moveoldfs Thu Jan 01 00:00:00 1970 +++ /sys/lib/dist/pc/inst/moveoldfs Mon Mar 28 00:00:00 2011 @@ -33,13 +33,13 @@ switch($1){ case checkready - if(! test -d /n/kfs/wrap){ + if(! test -d /n/newfs/wrap){ moveoldfs=done export moveoldfs } case go - if(test -d /n/kfs/wrap){ + if(test -d /n/newfs/wrap){ echo 'You have a Third Edition Plan 9 installation on '^$fs^'.' echo 'We need to move the old file system out of the way (into /3e)' echo 'in order to continue.' @@ -52,11 +52,11 @@ logprog disk/kfscmd -n$kname 'create /3e sys sys 555 d' >>[2]/srv/log logprog disk/kfscmd -n$kname 'create /3e/usr sys sys 555 d' >>[2]/srv/log for(i in $rootfiles) - if(test -e /n/kfs/$i) + if(test -e /n/newfs/$i) logprog disk/kfscmd -n$kname 'rename /'^$i^' /3e/'^$i # copy extant /adm/users in case there have been modifications logprog disk/kfscmd -n$kname 'create /adm adm adm 555 d' >>[2]/srv/log - logprog cp /n/kfs/3e/adm/users /n/kfs/adm/users >>[2]/srv/log + logprog cp /n/newfs/3e/adm/users /n/newfs/adm/users >>[2]/srv/log case n echo 'Okay, but we can''t continue.' @@ -65,7 +65,7 @@ } case checkdone - if(test -d /n/kfs/wrap){ + if(test -d /n/newfs/wrap){ moveoldfs=notdone export moveoldfs } --- a/sys/lib/dist/pc/inst/prepdisk Mon Mar 28 22:58:05 2011 +0200 +++ b/sys/lib/dist/pc/inst/prepdisk Mon Mar 28 22:59:18 2011 +0200 @@ -4,6 +4,8 @@ # prereq: partdisk fn autotype { + if(~ $fstype kfs) + echo -a 9fat -a nvram -a fs -a swap if(~ $fstype fossil) echo -a 9fat -a nvram -a fossil -a swap if(~ $fstype fossil+venti) @@ -47,6 +49,9 @@ if(! ~ $prepdisk ready){ prepdisk=done switch($fstype){ + case kfs + if(! test -f /dev/sd*/fs* && ! test -f /dev/fs/fs*) + prepdisk=ready case fossil if(! test -f /dev/sd*/fossil* && ! test -f /dev/fs/fossil*) prepdisk=ready --- /n/sources/plan9/sys/lib/dist/pc/proto Mon Jan 22 16:43:20 2007 +++ /sys/lib/dist/pc/proto Mon Mar 28 00:00:00 2011 @@ -23,8 +23,8 @@ disk d555 sys sys fdisk 555 sys sys /sys/lib/dist/pc/multi/fdisk format 555 sys sys /sys/lib/dist/pc/multi/format -# kfs 555 sys sys -# kfscmd 555 sys sys + kfs 555 sys sys + kfscmd 555 sys sys mbr 555 sys sys /sys/lib/dist/pc/multi/mbr prep 555 sys sys /sys/lib/dist/pc/multi/prep fossil d555 sys sys