diff options
| author | cinap_lenrek <cinap_lenrek@localhost> | 2011-04-12 15:53:55 +0000 |
|---|---|---|
| committer | cinap_lenrek <cinap_lenrek@localhost> | 2011-04-12 15:53:55 +0000 |
| commit | 67e93d6a0a4f15192638e131413b9d64c4269c76 (patch) | |
| tree | 88fd1d17c4be283683a96ced44159e3ce6b6f2f7 /rc/bin/inst/main | |
| parent | 7208d528bd42f981f2535403f72e4c0d7d8df643 (diff) | |
| download | plan9front-67e93d6a0a4f15192638e131413b9d64c4269c76.tar.xz | |
updating cwfs and moving installer in /rc/bin
Diffstat (limited to 'rc/bin/inst/main')
| -rwxr-xr-x | rc/bin/inst/main | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/rc/bin/inst/main b/rc/bin/inst/main new file mode 100755 index 000000000..25ac0d168 --- /dev/null +++ b/rc/bin/inst/main @@ -0,0 +1,115 @@ +#!/bin/rc + +. defs + +while() +{ +div=-------------------------------------- +echo +echo $div +echo +echo -n 'Preparing menu...' + +# must be topologically sorted (by prereq) +tasks=(\ + configfs\ + partdisk prepdisk\ + fmtfossil\ + mountfs\ + configdist\ + confignet\ + mountdist\ + fmtventi\ + download\ + copydist\ + bootsetup finish stop\ + stopether stopppp\ +) +# startether startppp stopether stopppp download\ + +# these don't show up in the menu but still matter +pseudotasks=(configip havefiles etherup etherdown pppup pppdown) + +for(i in $tasks $pseudotasks) + $i=notdone + +coherence + +for(i in $tasks $pseudotasks) + if(~ $#$i 0) + $i=notdone + +# +# we believe the environment about what is done +# only if we've confirmed it. since the tasks list is sorted so that +# prereqs of xxx come before xxx, it's okay to assume xxx +# is done until proven otherwise -- either a prereq or checkdone +# will say so. +# + +done=() +ready=() +rm /env/done +rm /env/ready +for(i in $tasks) { + $i=done + for(j in `{prereq $i}) + if(! ~ $$j done) + $i=notdone + if(~ $$i done) { + export $i + $i checkdone + $i=`{grep '^'$i^'=' /tmp/vars | sed -n '$p' | sed 's/.*=//'} + } + + if(~ $$i notdone ready) { + okay=yes + for(j in `{prereq $i}) + if(! ~ $$j done) + okay=no + switch($okay){ + case yes + $i=ready + export $i + $i checkready + $i=`{grep '^'$i^'=' /tmp/vars | sed -n '$p' | sed 's/.*=//'} + case no + $i=notdone + } + } + + if(~ $$i done ready) + $$i=($$$i $i) # rc can be just as complicated as perl! +} + +export $tasks $pseudotasks done ready +coherence +echo + +if(! ~ $#done 0) { + echo 'The following tasks are done: ' + for(i in $done) + desc $i + echo +} + +echo 'The following unfinished tasks are ready to be done:' +for(i in $ready) + desc $i +echo + +if(~ $#ready 0) { + echo hey you finished everything! not supposed to happen. + sleep 100 + exit +} + +prompt -d $ready(1) -w '' 'Task to do' $done $ready + +echo +echo $div + +$rd go +$rd=done # if it's not, the check will figure that out +export $rd +} |
