]> git.lizzy.rs Git - plan9front.git/commitdiff
ask for nvram and 9fat partitions
authorcinap_lenrek <cinap_lenrek@centraldogma>
Thu, 9 Jun 2011 20:31:04 +0000 (20:31 +0000)
committercinap_lenrek <cinap_lenrek@centraldogma>
Thu, 9 Jun 2011 20:31:04 +0000 (20:31 +0000)
rc/bin/inst/authsetup [deleted file]
rc/bin/inst/bootsetup
rc/bin/inst/main
rc/bin/inst/nvramsetup [new file with mode: 0755]
rc/bin/inst/systype

diff --git a/rc/bin/inst/authsetup b/rc/bin/inst/authsetup
deleted file mode 100755 (executable)
index ccddc00..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/rc
-
-# desc: invalidate nvram
-# prereq: systype copydist
-
-nvram=(/dev/sd*/nvram)
-nvram=$nvram(1)
-
-switch($1){
-case go
-       echo 'trust, but verify' >$nvram
-
-       echo
-       echo 'You will be asked to enter an authid, authdom, secstore key,'
-       echo 'and password upon next boot. The authid is the hostowner.'
-       echo 'The authdom is the domain from your network configuration.'
-       echo 'The secstore key and password should be a secret password'
-       echo 'of eight characters or greater in length. On an auth server,'
-       echo 'the password will be used to encrypt the user database'
-       echo '/adm/keys'
-       echo
-
-       authsetup=done
-       export authsetup
-case checkdone
-       if(~ $syst cpu && test -w $nvram && ! grep -s trust $nvram){
-               authsetup=ready
-               export authsetup
-       }
-}
index 08448f516765acf38edcb9ea521cb208d51bf0c0..0e1a034befabb340df2db5459def22ad5ce72efb 100755 (executable)
@@ -3,20 +3,29 @@
 # desc: create a boot floppy or configure hard disk to boot plan 9
 # prereq: systype copydist
 
+fats=(/dev/sd*/9fat)
+
 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)
                        bootfile=9pccpuf
@@ -25,6 +34,8 @@ case go
                {
                        echo 'bootfile='^$bootfile
                        echo 'bootargs=local!'^$fs
+                       if(~ $#nvram 1)
+                               echo 'nvram='^$nvram
                        echo 'mouseport='^$mouseport
                        echo 'monitor='^$monitor
                        echo 'vgasize='^$vgasize
@@ -34,19 +45,19 @@ 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
-               mount -c /srv/dos /n/9fat $fat
+               disk/format -r 2 -d -b /386/pbs $9fat
+               mount -c /srv/dos /n/9fat $9fat
        }
        logprog rm -f /n/9fat/^(9bootfat plan9.ini 9pcf 9pccpuf)
        logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat
@@ -76,12 +87,4 @@ case go
                didbootsetup=$oldbootsetup
                export didbootsetup
        }
-
-case checkdone
-       xxxfat=(/dev/sd*/9fat)
-       xxxfat=$xxxfat(1)
-       if(! ~ `{fstype $xxxfat} dos || ! ~ $didbootsetup 1){
-               bootsetup=ready
-               export bootsetup
-       }
 }
index bd974658bcaa8c6659241398f7ca8888c5758b52..db7412dce0bddee59a1182efe47519ee7fbe0249 100755 (executable)
@@ -21,7 +21,7 @@ tasks=(\
        mountdist\
        download\
        copydist\
-       authsetup\
+       nvramsetup\
        bootsetup finish stop\
        stopether stopppp\
 )
diff --git a/rc/bin/inst/nvramsetup b/rc/bin/inst/nvramsetup
new file mode 100755 (executable)
index 0000000..26b433d
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/rc
+
+# desc: invalidate nvram
+# prereq: systype copydist
+
+files=(/dev/sd*/nvram)
+
+switch($1){
+case checkdone checkready
+       if(~ $#files 0 && ! ~ $syst cpu)
+               nvramsetup=done
+       if not {
+               if(~ $#nvram 1 && grep -s trust $nvram)
+                       nvramsetup=done
+               if not
+                       nvramsetup=ready
+       }
+       export nvramsetup
+
+case go
+       echo
+       echo 'Setup Plan 9 NVRAM configuration partition (nvram)'
+       echo
+
+       if(~ $#files 1)
+               default=(-d $files)
+       if not
+               default=()
+       prompt $default 'Nvram partition' $files
+       nvram=$rd
+       export nvram
+
+       echo 'trust, but verify' >$nvram
+
+       if(! ~ $syst cpu)
+               exit
+
+       echo
+       echo 'You will be asked to enter an authid, authdom, secstore key,'
+       echo 'and password upon next boot. The authid is the hostowner.'
+       echo 'The authdom is the domain from your network configuration.'
+       echo 'The secstore key and password should be a secret password'
+       echo 'of eight characters or greater in length. On an auth server,'
+       echo 'the password will be used to encrypt the user database'
+       echo '/adm/keys'
+       echo
+}
index ab4e53a258acdee1a225f12f702ba873b498df03..42a9a01b16a8bf4f4f10837c6cb01717893f28c8 100755 (executable)
@@ -9,9 +9,6 @@ case checkdone
        if not
                systype=ready
        export systype
-       if(~ $syst terminal)
-               tasks=`{echo $tasks | sed 's/authsetup//g'}
-       export tasks
 case go
        echo