]> git.lizzy.rs Git - plan9front.git/blobdiff - rc/bin/inst/bootsetup
fix mistake
[plan9front.git] / rc / bin / inst / bootsetup
index e33313f3a18bb7458e2a899cf89cd396645c3a68..6044fa04dd8d0d5e63fbacc90a73c97459ba862a 100755 (executable)
@@ -3,19 +3,32 @@
 # desc: create a boot floppy or configure hard disk to boot plan 9
 # prereq: systype copydist
 
+fats=()
+for(i in /dev/sd*/9fat){
+       if(test -f $i)
+               fats=($fats $i)
+}
+
 switch($1) {
+case checkdone checkready
+       if(~ $#fats 0 || ~ $#9fat 1 && ~ `{fstype $9fat} dos && ~ $didbootsetup 1)
+               bootsetup=done
+       if not
+               bootsetup=ready
+       export bootsetup
+
 case go
        echo
-       echo 'Initializing Plan 9 FAT configuration partition (9fat)'
+       echo 'Setup Plan 9 FAT boot partition (9fat)'
        echo
-       
-       fat=(/dev/sd*/9fat)
-       fat=$fat(1)
-       disk=`{echo $fat | sed 's:/dev/::;s:/9fat::'}
-       if(! test -f $fat) {
-               echo 'You have no 9fat partition.  Can''t setup booting.'
-               exit
-       }
+
+       if(~ $#fats 1)
+               default=(-d $fats)
+       if not
+               default=()
+       prompt $default 'Plan 9 FAT partition' $fats
+       9fat=$rd
+       export 9fat
 
        if(! test -f /tmp/plan9.ini) {
                if(~ $syst cpu)
@@ -25,7 +38,8 @@ case go
                {
                        echo 'bootfile='^$bootfile
                        echo 'bootargs=local!'^$fs
-                       echo 'sysname=cirno'
+                       if(~ $#nvram 1)
+                               echo 'nvram='^$nvram
                        echo 'mouseport='^$mouseport
                        echo 'monitor='^$monitor
                        echo 'vgasize='^$vgasize
@@ -35,22 +49,25 @@ case go
        }
 
        need9fatformat=no
-       if(! ~ `{fstype $fat} dos)
+       if(! ~ `{fstype $9fat} dos)
                need9fatformat=yes
        if(! test -f /srv/dos)
                dossrv
-       if(! mount -c /srv/dos /n/9fat $fat >[2]/dev/null)
+       if(! mount -c /srv/dos /n/9fat $9fat >[2]/dev/null)
                need9fatformat=yes
        if not if(! test -f /n/9fat/plan9.ini)
                need9fatformat=yes
 
        if(~ $need9fatformat yes){
                log Initializing Plan 9 FAT partition.
-               disk/format -r 2 -d -b /386/pbs $fat /n/newfs/386/9bootfat
-               mount -c /srv/dos /n/9fat $fat
+               disk/format -r 2 -d -b /386/pbs $9fat
+               mount -c /srv/dos /n/9fat $9fat
        }
-       logprog cp /tmp/plan9.ini /n/9fat/plan9.ini
+       logprog rm -f /n/9fat/^(9bootfat plan9.ini 9pcf 9pccpuf)
        logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat
+       # make file continous on disk
+       logprog chmod +al /n/9fat/9bootfat
+       logprog cp /tmp/plan9.ini /n/9fat/plan9.ini
        logprog cp /n/newfs/386/9pcf /n/9fat/9pcf
        logprog cp /n/newfs/386/9pccpuf /n/9fat/9pccpuf
 
@@ -68,18 +85,13 @@ case go
        oldbootsetup=$didbootsetup
        didbootsetup=1
        export didbootsetup
+
        prompt 'Enable boot method' plan9 winnt
-       
+
+       disk=`{basename `{basename -d $9fat}}
+
        if(! boot$rd){
                didbootsetup=$oldbootsetup
                export didbootsetup
        }
-
-case checkdone
-       xxxfat=(/dev/sd*/9fat)
-       xxxfat=$xxxfat(1)
-       if(! ~ `{fstype $xxxfat} dos || ! ~ $didbootsetup 1){
-               bootsetup=ready
-               export bootsetup
-       }
 }