diff --git a/rc/bin/inst/bootsetup b/rc/bin/inst/bootsetup index 71175960d..798b08bfa 100755 --- a/rc/bin/inst/bootsetup +++ b/rc/bin/inst/bootsetup @@ -29,7 +29,7 @@ case go } need9fatformat=no - if(! isfat $fat) + if(! ~ `{fstype $fat} dos) need9fatformat=yes if(! test -f /srv/dos) dossrv @@ -70,7 +70,8 @@ case go case checkdone xxxfat=(/dev/sd*/9fat) - if(! isfat $xxxfat(1) || ! ~ $didbootsetup 1){ + xxxfat=$xxxfat(1) + if(! ~ `{fstype $xxxfat} dos || ! ~ $didbootsetup 1){ bootsetup=ready export bootsetup } diff --git a/rc/bin/inst/download b/rc/bin/inst/download index 2af4fe9d0..6a070e8ef 100755 --- a/rc/bin/inst/download +++ b/rc/bin/inst/download @@ -33,22 +33,20 @@ case go baropt='-w 145,129,445,168' if(~ $textinst 1) baropt=-t - if(! hget -vo /n/newfs/dist/_plan9.iso.bz2 $installurl/plan9.iso.bz2 |[2] aux/statusbar $baropt 'downloading '^plan9.iso.bz2) + mkdir -p /n/newfs/dist + if(! hget -vo /n/newfs/dist/_9front.iso.bz2 $installurl/9front.iso.bz2 |[2] aux/statusbar $baropt 'downloading '^9front.iso.bz2) exit - mv /n/newfs/dist/_plan9.iso.bz2 /n/newfs/dist/plan9.iso.bz2 - if(~ $fstype fossil){ - echo fsys main sync >>/srv/fscons - } + mv /n/newfs/dist/_9front.iso.bz2 /n/newfs/dist/9front.iso.bz2 echo 'The distribution is downloaded.' srvmedia=() - mountmedia=(mount /srv/fossil /n/distmedia) + mountmedia=(mount /srv/cwfs /n/distmedia) distmediadir=/dist export distmediadir mountmedia distmedia case checkdone - if(! test -f /n/newfs/dist/plan9.iso.bz2) { + if(! test -f /n/newfs/dist/9front.iso.bz2) { download=notdone export download } diff --git a/rc/bin/inst/fmtfossil b/rc/bin/inst/fmtfossil deleted file mode 100755 index 98bf33fc1..000000000 --- a/rc/bin/inst/fmtfossil +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/rc - -# desc: initialize disks for a fossil server -# prereq: configfs - -switch($1){ -case checkready checkdone - if(! ~ $fstype fossil+venti fossil){ - fmtfossil=notdone - export fmtfossil - exit - } - ff=`{ls /dev/sd*/fossil* /dev/fs/fossil* >[2]/dev/null} - if(~ $#ff 0){ - fmtfossil=notdone - export fmtfossil - exit - } - gg=() - for(f in $ff) - if(isfossil $f) - gg=($gg $f) - if(~ $#gg 0){ - fmtfossil=ready - export fmtfossil - exit - } - fmtfossil=done - export fmtfossil - exit - -case go - ff=`{ls /dev/sd*/fossil* /dev/fs/fossil* >[2]/dev/null} - if(~ $#ff 0){ - echo 'You need to create a partition or partitions to hold the Fossil write cache.' - echo 'The partition name must begin with "fossil".' - echo - fmtfossil=notdone - export fmtfossil - exit - } - default=() - if(~ $#ff 1){ - default=(-d $ff) - } - echo You have the following fossil partitions. - echo - prompt $default 'Fossil partition to format' $ff - f=$rd - - do=yes - if(isfossil $f){ - echo $f appears to already be formatted as Fossil file system. - echo Do you really want to reformat it? - echo - prompt -d no 'Reformat '$f yes no - do=$rd - } - if(~ $do yes){ - fossil/flfmt -y $f - n=`{cat /dev/swap | grep ' user' | sed 's/^[0-9]+\/([0-9]+) .*/\1/'} - if(test $n -gt 32768) - m=3000 # if have at least 128 user MB, use 24MB for fossil - if not if(test $n -gt 16384) - m=1500 # 64 user MB => 12MB for fossil - if not if(test $n -gt 8192) - m=750 # 32 user MB => 6MB for fossil - if not - m=256 # 2MB for fossil (this will be slow) - - # if we're using a venti in the back, take hourly snapshots - # that retire after three days, in addition to the daily dumps at 5am - if(~ $fstype fossil+venti){ - v='' - snap='fsys main snaptime -s 60 -a 0500 -t 2880' - } - # otherwise, take the daily dumps but nothing else -- - # we can't retire snapshots unless dumps are being archived - if not{ - v='-V' - snap='' - } - echo \ -'fsys main config '^$f^' -fsys main open '^$v^' -c '^$m^' -'^$snap^' -' | fossil/conf -w $f - } - - echo Done. -} diff --git a/rc/bin/inst/fmtventi b/rc/bin/inst/fmtventi deleted file mode 100755 index db79440ac..000000000 --- a/rc/bin/inst/fmtventi +++ /dev/null @@ -1,190 +0,0 @@ -#!/bin/rc - -# desc: initialize disks for a venti server -# prereq: mountdist - -switch($1){ -case checkready checkdone - if(! ~ $fstype fossil+venti){ - fmtventi=notdone - export fmtventi - exit - } - if(! test -e /bin/venti/fmtarenas || ! test -e /bin/venti/fmtisect || ! test -e /bin/venti/fmtindex){ - bind -a /n/dist/386/bin/venti /bin/venti - if(! test -e /bin/venti/fmtarenas || ! test -e /bin/venti/fmtisect || ! test -e /bin/venti/fmtindex){ - fmtventi=notdone - export fmtventi - exit - } - } - ff=`{ls /dev/sd*/arenas* /dev/fs/arenas* >[2]/dev/null} - if(~ $#ff 0){ - fmtventi=notdone - export fmtventi - exit - } - gg=() - for(f in $ff) - if(isventi $f) - gg=($gg $f) - if(~ $#gg 0){ - fmtventi=ready - export fmtventi - exit - } - - ventiarena=$gg(1) - export ventiarena - - fmtventi=done - export fmtventi - exit - -case go - ff=`{ls /dev/sd*/arenas* /dev/fs/arenas* >[2]/dev/null} - if(~ $#ff 0){ - echo 'You need to create a partition or partitions to hold the Venti arenas.' - echo 'The arena partition names must begin with "arenas".' - echo - fmtventi=notdone - export fmtventi - exit - } - default=(-d $"ff) - if(! ~ $#ventiarena 0){ - default=(-d $"ventiarena) - } - echo You have the following Venti arena partitions. - ls -l $ff - echo - - prompt $default 'Venti arena partitions to use' - aa=`{echo $rd} - bad=no - for(a in $aa){ - if(! ~ $a $ff){ - echo 'Bad venti arena partition' $a - fmtventi=notdone - export fmtventi - exit - } - } - ventiarena=$aa - export ventiarena - - gg=`{ls /dev/sd*/isect* /dev/fs/isect* >[2]/dev/null} - if(~ $#gg 0){ - echo 'You need to create a partition or partitions to hold the Venti indices.' - echo 'The index partition names must begin with "isect".' - echo - fmtventi=notdone - export fmtventi - exit - } - default=(-d $"gg) - if(! ~ $#ventiindex 0){ - default=(-d $"ventiindex) - } - - echo You have the following Venti index partitions. - ls -l $gg - echo - - prompt $default 'Venti index partitions to use' - aa=`{echo $rd} - bad=no - for(a in $aa){ - if(! ~ $a $gg){ - echo 'Bad venti index partition' $a - fmtventi=notdone - export fmtventi - exit - } - } - ventiindex=$aa - export ventiindex - - n=-1 - fmta=() - for(a in $ventiarena){ - do=yes - n=`{hoc -e 1+$n} - if(isventiarenas $a){ - echo File $a is already formatted as a Venti arenas partition. - prompt -d no 'Reformat '$a yes no - do=$rd - } - if(~ $do yes) - fmta=($fmta arenas$n:$a) - } - - n=-1 - fmti=() - for(a in $ventiindex){ - do=yes - n=`{hoc -e 1+$n} - if(isventiisect $a){ - echo File $a is already formatted as a Venti index section. - prompt -d no 'Reformat '$a yes no - do=$rd - } - if(~ $do yes) - fmti=($fmti isect$n:$a) - } - - echo Formatting Venti arenas and indices (this takes a while). - # do each disk in parallel - echo good >/tmp/fmt - dd=() - for(a in $fmta $fmti){ - d=`{echo $a | sed 's!.*:(/.*/).*!\1!'} - if(! ~ $d $dd) - dd=($dd $d) - } - for(d in $dd){ - { - for(a in $fmta){ - i=`{echo $a | sed 's!(.*):(/.*/)(.*)!\1 \2 \2\3!'} - if(~ $i(2) $d){ - echo $i(3) ... - venti/fmtarenas $i(1) $i(3) || echo bad >/tmp/fmt - echo done with $i(3) - } - } - for(a in $fmti){ - i=`{echo $a | sed 's!(.*):(/.*/)(.*)!\1 \2 \2\3!'} - if(~ $i(2) $d){ - echo $i(3) ... - venti/fmtisect $i(1) $i(3) || echo bad >/tmp/fmt - echo done with $i(3) - } - } - } & - } - wait - if(~ bad `{cat /tmp/fmt}){ - echo There were errors formatting the indices and arenas. - fmtventi=ready - export fmtventi - exit errors - } - - echo Done formatting Venti arenas and indices. - - v=$ventiarena(1) - echo Storing Venti config on $v... - { - echo index main - for(i in $ventiindex) - echo isect $i - for(a in $ventiarena) - echo arenas $a - } | venti/conf -w $v - - echo Initializing index... - venti/fmtindex $v - - echo Done with Venti! -} - diff --git a/rc/bin/inst/is9660 b/rc/bin/inst/is9660 deleted file mode 100755 index 1d138e55e..000000000 --- a/rc/bin/inst/is9660 +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/rc - -# 0000000 01 C D 0 0 1 01 00 P L A N 9 - -if(! ~ $#* 1) { - echo 'usage: is9660 /dev/sdC0/part' >[1=2] - exit usage -} - -ifs=$nl {id=`{dd -if $1 -bs 2048 -skip 16>[2]/dev/null | xd -c | sed 1q | sed 's/.........(....................).*/\1/'}} -~ $id '01 C D 0 0 1 01' -exit $status diff --git a/rc/bin/inst/isext2 b/rc/bin/inst/isext2 deleted file mode 100755 index b79265f6a..000000000 --- a/rc/bin/inst/isext2 +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/rc - -if(! ~ $#* 1) { - echo 'usage: isext2 /dev/sdC0/part' >[1=2] - exit usage -} - -cmp -s <{dd -if $1 -bs 1 -count 2 -skip 1080 >[2]/dev/null | xd -b |sed 1q} \ - <{echo '0000000 53 ef'} - -exit $status diff --git a/rc/bin/inst/isfat b/rc/bin/inst/isfat deleted file mode 100755 index 860278571..000000000 --- a/rc/bin/inst/isfat +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/rc - -rfork e - -# 0000000 eb 3c 90 P l a n 9 . 0 0 00 02 04 02 00 -# 0000010 02 00 02 02 P f8 14 00 ? 00 ff 00 ~ 04 } 00 -# 0000020 02 P 00 00 80 00 ) a8 04 } 00 C Y L I N -# 0000030 D R I C A L F A T 1 6 fa 8c - -if(! ~ $#* 1) { - echo 'usage: isfat /dev/sdC0/part' >[1=2] - exit usage -} - -arg=$1 -fn fat { - cmp -s <{dd -if $arg -bs 1 -count 3 -skip $1 >[2]/dev/null} <{echo -n FAT} -} - -fat 54 || fat 82 -exit $status - diff --git a/rc/bin/inst/isfossil b/rc/bin/inst/isfossil deleted file mode 100755 index 21c7d3e29..000000000 --- a/rc/bin/inst/isfossil +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/rc - -if(! ~ $#* 1){ - echo 'usage: isfossil /dev/sdC0/part' >[1=2] - exit usage -} - -arg=$1 -if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 127 | - dd -quiet 1 -bs 14 -count 1} <{echo 'fossil config'}) - exit noconfig -if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 128 | - dd -quiet 1 -bs 4 -count 1 | xd -b | sed 1q} <{echo '0000000 37 76 ae 89'}) - exit notwritebuffer -exit 0 - diff --git a/rc/bin/inst/isventi b/rc/bin/inst/isventi deleted file mode 100755 index 555c27a7f..000000000 --- a/rc/bin/inst/isventi +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/rc - -if(! ~ $#* 1){ - echo 'usage: isventi /dev/sdC0/part' >[1=2] - exit usage -} - -arg=$1 -if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 248 | - dd -quiet 1 -bs 13 -count 1} <{echo 'venti config'}) - exit noconfig -exit 0 - diff --git a/rc/bin/inst/isventiarenas b/rc/bin/inst/isventiarenas deleted file mode 100755 index dfce274de..000000000 --- a/rc/bin/inst/isventiarenas +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/rc - -if(! ~ $#* 1){ - echo 'usage: isventiarenas /dev/sdC0/part' >[1=2] - exit usage -} - -arg=$1 -if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 256 | - dd -quiet 1 -bs 4 -count 1 | xd -b | sed 1q} <{echo '0000000 a9 e4 a5 e7'}) - exit notarenas -exit 0 - diff --git a/rc/bin/inst/isventiisect b/rc/bin/inst/isventiisect deleted file mode 100755 index 0b11c9c4e..000000000 --- a/rc/bin/inst/isventiisect +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/rc - -if(! ~ $#* 1){ - echo 'usage: isventiisect /dev/sdC0/part' >[1=2] - exit usage -} - -arg=$1 -if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 256 | - dd -quiet 1 -bs 4 -count 1 | xd -b | sed 1q} <{echo '0000000 d1 5c 5e c7'}) - exit notisect -exit 0 - diff --git a/rc/bin/inst/main b/rc/bin/inst/main index 25ac0d168..ce09cc2d7 100755 --- a/rc/bin/inst/main +++ b/rc/bin/inst/main @@ -14,12 +14,10 @@ echo -n 'Preparing menu...' tasks=(\ configfs\ partdisk prepdisk\ - fmtfossil\ mountfs\ configdist\ confignet\ mountdist\ - fmtventi\ download\ copydist\ bootsetup finish stop\ diff --git a/rc/bin/inst/mountdist b/rc/bin/inst/mountdist index 4c3fb1d3f..11a07f979 100755 --- a/rc/bin/inst/mountdist +++ b/rc/bin/inst/mountdist @@ -16,9 +16,36 @@ fn exitifdone{ } fn havedist { - test -f $1/LICENSE + test -f $1/LICENSE || test -f $1/9front.iso || test -f $1/9front.iso.bz2 } +fn trycdimage{ + if(test -f $1){ + rm -f /srv/9660.dist + unmount /n/dist + 9660srv 9660.dist >[2]/dev/null + logprog mount /srv/9660.dist /n/dist $1 + exitifdone + mountdist=notdone + export mountdist + exit notdone + } +} + +fn trycdimagebz2 { + if(test -f $1){ + echo -n 'bunzip2 < '^$1^' >/n/newfs/dist/9front.iso' + bunzip2 < $1 >/n/newfs/dist/_9front.iso && + mv /n/newfs/dist/_9front.iso /n/newfs/dist/9front.iso + echo + trycdimage /n/newfs/dist/9front.iso + mountdist=notdone + export mountdist + exit notdone + } +} + + switch($1){ case checkready if(! ~ $distisfrom local && ! ~ $download done){ @@ -40,23 +67,20 @@ case checkready case go fat=() - ext2=() x9660=() echo Please wait... Scanning storage devices... - parts=`{ls /dev/sd[A-Z][0-9]*/* >[2]/dev/null | grep -v '/(plan9.*|ctl|log|raw)$'} + parts=`{ls /dev/sd*/* >[2]/dev/null | grep -v '/(plan9.*|nvram|ctl|log|raw)$'} for (i in $parts) { echo -n ' '^$i - 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(isfat /tmp/localpart.$n) + t=`{fstype $i} + switch($t){ + case dos fat=($fat $i) - if(isext2 /tmp/localpart.$n) - ext2=($ext2 $i) - if(is9660 /tmp/localpart.$n) + case 9660 x9660=($x9660 $i) + } echo } echo @@ -67,8 +91,6 @@ case go switch($i){ case $fat echo ' '^$i^' (microsoft fat)' - case $ext2 - echo ' '^$i^' (linux ext2)' case $x9660 echo ' '^$i^' (iso9660 cdrom)' } @@ -80,7 +102,7 @@ case go default=() if(! ~ $#cdboot 0 && ! ~ $#x9660 0) default=(-d $x9660(1)) - prompt $default 'Distribution disk' $fat $x9660 + prompt $default 'Distribution disk' $fat $x9660 $fs disk=$rd srvmedia=() @@ -91,9 +113,6 @@ case go case $fat srvmedia=(dossrv) mountmedia=(mount /srv/dos /n/distmedia $disk) - case $ext2 - srvmedia=(ext2srv -r) - mountmedia=(mount /srv/ext2 /n/distmedia $disk) case $x9660 srvmedia=(9660srv) mountmedia=(mount /srv/9660 /n/distmedia $disk) @@ -114,6 +133,8 @@ case go echo Which directory contains the distribution? echo 'Any of the following will suffice (in order of preference):' echo ' - the root directory of the cd image' + echo ' - the directory containing 9front.iso' + echo ' - the directory containing 9front.iso.bz2' echo first=no } @@ -145,7 +166,7 @@ case checkdone exitifdone - if(havedist /n/distmedia/$distmediadir){ + if(test -f /n/distmedia/$distmediadir/LICENSE){ bind /n/distmedia/$distmediadir /n/dist exitifdone mountdist=notdone @@ -153,6 +174,12 @@ case checkdone exit notdone } + trycdimage /n/distmedia/$distmediadir/9front.iso + trycdimage /n/newfs/dist/9front.iso + + trycdimagebz2 /n/distmedia/$distmediadir/9front.iso.bz2 + trycdimagebz2 /n/newfs/dist/9front.iso.bz2 + mountdist=notdone export mountdist exit notdone diff --git a/rc/bin/inst/mountfossil b/rc/bin/inst/mountfossil deleted file mode 100755 index e98a3f48c..000000000 --- a/rc/bin/inst/mountfossil +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/rc - -switch($1){ -case checkready checkdone - if(! ~ $fmtfossil done){ - mountfs=notdone - export mountfs - exit - } - if(! test -f /dev/sd*/fossil* && ! test -f /dev/fs/fossil*){ - mountfs=notdone - export mountfs - exit - } - if(! ~ $#fossil 1 || ! test -f $fossil){ - mountfs=ready - export mountfs - exit - } - if(! ps | grep -s ' fossil$'){ - echo 'srv -p fscons' > /env/fossilconf - echo 'srv -AP fossil' >> /env/fossilconf - fossil/conf $fossil | sed 's/^fsys main open .*/& -AWVP/' | - sed 's/^fsys main snaptime .*//' >> /env/fossilconf - if(! logprog fossil/fossil -c .' /env/fossilconf'>>[2]/srv/log){ - echo 'fossil: '^$status - mountfs=ready - export mountfs - exit oops - } - if(! test -f /srv/fossil){ - echo 'fossil did not create /srv/fossil' - mountfs=ready - exit oops - } - cat /srv/fscons >>/srv/log & - if(! logprog mount -c /srv/fossil /n/newfs){ - echo 'mount: '^$status - mountfs=ready - export mountfs - exit oops - } - fs=$fossil - export fs - } - if(! test -s /n/newfs/adm/users){ - echo fsys main create /active/adm adm sys d775 >>/srv/fscons - echo fsys main create /active/adm/users adm sys 664 >>/srv/fscons - echo uname upas :upas >>/srv/fscons - echo users -w >>/srv/fscons - sleep 2 - } - if(! test -s /n/newfs/adm/users){ - echo 'could not create /adm/users' - mountfs=ready - export mountfs - exit oops - } - for(i in dist dist/replica dist/replica/client){ - if(! test -d /n/newfs/$i) - echo fsys main create /active/$i sys sys d775 >>/srv/fscons - sleep 2 - } - if(! test -d /n/newfs/dist/replica/client){ - echo 'could not create /dist/replica/client' - mountfs=ready - export mountfs - exit oops - } - if(! test -e /n/newfs/dist/replica/client/plan9.db){ - echo fsys main create /active/dist/replica/client/plan9.db sys sys 664 >>/srv/fscons - echo fsys main create /active/dist/replica/client/plan9.log sys sys a664 >>/srv/fscons - } - if(test -d /n/newfs/dist/replica/client && test -f /n/newfs/adm/users){ - mountfs=done - export mountfs - exit - } - mountfs=ready - export mountfs - exit - -case go - echo 'The following partitions named fossil* 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*/fossil* /dev/fs/fossil* >[2]/dev/null}) - ls -l $files - echo - if(~ $#fossil 1 && ~ $fossil $files) - default=(-d $fossil) - if not if(~ $#files 1) - default=(-d $files) - if not - default=() - prompt $default 'Fossil partition' $files - slay fossil|rc - fossil=$rd - export fossil -} - - diff --git a/rc/bin/inst/replcfg b/rc/bin/inst/replcfg deleted file mode 100755 index 30aed8607..000000000 --- a/rc/bin/inst/replcfg +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/rc - -s=/n/dist/dist/replica -serverroot=/n/dist -serverlog=$s/plan9.log -serverproto=$s/plan9.proto -fn servermount { status='' } -fn serverupdate { status='' } - -fn clientmount { status='' } -c=/n/newfs/dist/replica -clientroot=/n/newfs -clientproto=$c/plan9.proto -clientdb=$c/client/plan9.db -clientexclude=(dist/replica/client) -clientlog=$c/client/plan9.log - -applyopt=(-t -u -T$c/client/plan9.time) diff --git a/sys/src/9/boot/local.rc b/sys/src/9/boot/local.rc index aeff20f97..2808a9c0b 100644 --- a/sys/src/9/boot/local.rc +++ b/sys/src/9/boot/local.rc @@ -10,7 +10,7 @@ fn showlocaldevs{ for(i in `{ls -p $d}){ p=$d/$i switch($i){ - case ctl raw + case ctl raw log ; case 9fat plan9 nvram echo $p