From 0d378e905e4df6266d9fc9243e7ed735e12d839b Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 26 Oct 2013 20:17:56 +0200 Subject: [PATCH] inst: cleanup installer making it not rely on path containing . always explicitely execute installer modules with ./name instead of relying that the path contians the dot. --- rc/bin/inst/bootsetup | 2 +- rc/bin/inst/configether | 2 +- rc/bin/inst/confignet | 4 +-- rc/bin/inst/configppp | 2 +- rc/bin/inst/finish | 2 +- rc/bin/inst/hdrs | 7 ----- rc/bin/inst/main | 8 +++--- rc/bin/inst/mainloop | 4 +-- rc/bin/inst/mkini.awk | 59 ----------------------------------------- rc/bin/inst/mountdist | 2 +- rc/bin/inst/mountfs | 4 +-- rc/bin/inst/partdisk | 4 +-- rc/bin/inst/start | 5 ++-- rc/bin/inst/watchfd | 17 ------------ 14 files changed, 19 insertions(+), 103 deletions(-) delete mode 100755 rc/bin/inst/hdrs delete mode 100755 rc/bin/inst/mkini.awk delete mode 100755 rc/bin/inst/watchfd diff --git a/rc/bin/inst/bootsetup b/rc/bin/inst/bootsetup index d68989adb..72f5417b2 100755 --- a/rc/bin/inst/bootsetup +++ b/rc/bin/inst/bootsetup @@ -101,7 +101,7 @@ case go logprog unmount /n/9fat disk=`{basename `{basename -d $9fat}} - if(bootplan9){ + if(./bootplan9){ didbootsetup=1 export didbootsetup } diff --git a/rc/bin/inst/configether b/rc/bin/inst/configether index 3487a8b80..a12d0823f 100755 --- a/rc/bin/inst/configether +++ b/rc/bin/inst/configether @@ -23,7 +23,7 @@ case go export ipaddr ipmask gwaddr } export ethermethod gwaddr ipaddr ipmask dhcphost - exec startether go + exec ./startether go case checkdone if(! ~ $ethermethod manual dhcp) { diff --git a/rc/bin/inst/confignet b/rc/bin/inst/confignet index 816bc7dd8..f516de7b0 100755 --- a/rc/bin/inst/confignet +++ b/rc/bin/inst/confignet @@ -12,7 +12,7 @@ case checkready checkdone if(~ $netisfrom ppp ether){ x=config$netisfrom $x=done - config$netisfrom checkdone + ./config$netisfrom checkdone confignet=$$x export confignet exit @@ -60,7 +60,7 @@ case go export netisfrom if(~ $netisfrom ether ppp) - exec config$netisfrom go + exec ./config$netisfrom go if(! test -f /srv/cs && ! test -f /net/cs) ndb/cs diff --git a/rc/bin/inst/configppp b/rc/bin/inst/configppp index 65e97a78b..da6c100fd 100755 --- a/rc/bin/inst/configppp +++ b/rc/bin/inst/configppp @@ -53,7 +53,7 @@ case go } export pppdev pppmethod pppphone ppppasswd pppuser pppbaud - exec startppp go + exec ./startppp go case checkdone if(! ~ $#pppmethod 1 || ! test -f /dev/$pppdev){ diff --git a/rc/bin/inst/finish b/rc/bin/inst/finish index 7a0abfe1a..7592f3a5e 100755 --- a/rc/bin/inst/finish +++ b/rc/bin/inst/finish @@ -12,5 +12,5 @@ case checkdone case go echo 'Congratulations; you''ve completed the install.' echo - halt + exec ./halt } diff --git a/rc/bin/inst/hdrs b/rc/bin/inst/hdrs deleted file mode 100755 index 0b934999f..000000000 --- a/rc/bin/inst/hdrs +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/rc - -if(! ~ $#* 1) { - echo 'usage: hdrs file.9gz' >[1=2] - exit usage -} -gunzip < $1 | disk/mkext -h diff --git a/rc/bin/inst/main b/rc/bin/inst/main index bee680ebf..4a3eb8bf8 100755 --- a/rc/bin/inst/main +++ b/rc/bin/inst/main @@ -1,6 +1,6 @@ #!/bin/rc -. defs +. ./defs while() { @@ -57,7 +57,7 @@ for(i in $tasks) { $i=notdone if(~ $$i done) { export $i - $i checkdone + ./$i checkdone $i=`{grep '^'$i^'=' /tmp/vars | sed -n '$p' | sed 's/.*=//'} } @@ -70,7 +70,7 @@ for(i in $tasks) { case yes $i=ready export $i - $i checkready + ./$i checkready $i=`{grep '^'$i^'=' /tmp/vars | sed -n '$p' | sed 's/.*=//'} case no $i=notdone @@ -108,7 +108,7 @@ prompt -d $ready(1) -w '' 'Task to do' $done $ready echo echo $div -$rd go +./$rd go $rd=done # if it's not, the check will figure that out export $rd } diff --git a/rc/bin/inst/mainloop b/rc/bin/inst/mainloop index f57c37098..7c0851a51 100755 --- a/rc/bin/inst/mainloop +++ b/rc/bin/inst/mainloop @@ -1,7 +1,7 @@ #!/bin/rc cd /bin/inst -. defs +. ./defs fn sigint { } coherence @@ -11,4 +11,4 @@ coherence # continually reexecing from here. while() - main + ./main diff --git a/rc/bin/inst/mkini.awk b/rc/bin/inst/mkini.awk deleted file mode 100755 index 7ddf6a80f..000000000 --- a/rc/bin/inst/mkini.awk +++ /dev/null @@ -1,59 +0,0 @@ -BEGIN{ - m = "common" - haveold = 0; - while(getline <"/n/9fat/plan9-3e.ini" > 0){ - haveold = 1 - if($0 ~ /\[.*\]/){ - m = substr($0, 2, length($0)-2) - continue - } - if(m=="menu" && $0 ~ /^menuitem=4e,/) - continue - a[m] = a[m] $0 "\n" - } - - a["4e"] = "" - while(getline <"/tmp/plan9.ini" > 0) - a["4e"] = a["4e"] $0 "\n" - - if(a["menu"] == "" && haveold){ - a["menu"] = "menuitem=3e, Plan 9 Third Edition\n" - a["3e"] = "" - } - - if(a["common"] != ""){ - for(i in a) - if(i != "4e" && i != "common" && i != "menu") - a[i] = a["common"] a[i] - delete a["common"] - } - - bootdisk4e=ENVIRON["fs"] - gsub("/dev/", "boot(args|disk|file)=local!#S/", bootdisk4e) - - if(!haveold) - print a["4e"] - else{ - print "[menu]" - print "menuitem=4e, Plan 9 Fourth Edition" - print a["menu"] - print "" - delete a["menu"] - - print "[4e]" - print a["4e"] - print "" - delete a["4e"] - - for(i in a){ - # BUG: if rootdir is already there we should rewrite it - # sometimes into /3e/whatwasthere - if(a[i] ~ bootdisk4e && !(a[i] ~ /rootdir=/)) - a[i] = "rootdir=/root/3e\n" a[i] - print "[" i "]" - gsub(/9fat!9pcdisk/, "9fat!9pc3e", a[i]) - print a[i] - print "" - } - } -} diff --git a/rc/bin/inst/mountdist b/rc/bin/inst/mountdist index ede75286f..b9e60a37e 100755 --- a/rc/bin/inst/mountdist +++ b/rc/bin/inst/mountdist @@ -56,7 +56,7 @@ case checkready if(domount){ mountdist=done export mountdist - if(mountdist checkdone) + if(./mountdist checkdone) exit } srvmedia=() diff --git a/rc/bin/inst/mountfs b/rc/bin/inst/mountfs index 10d41bde7..9bfea7fef 100755 --- a/rc/bin/inst/mountfs +++ b/rc/bin/inst/mountfs @@ -5,9 +5,9 @@ switch($fstype){ case cwfs cwfs64 cwfs64x - exec mountcwfs $* + exec ./mountcwfs $* case hjfs - exec mounthjfs $* + exec ./mounthjfs $* case * mountfs=notdone export mountfs diff --git a/rc/bin/inst/partdisk b/rc/bin/inst/partdisk index 35678a3c4..2604965c1 100755 --- a/rc/bin/inst/partdisk +++ b/rc/bin/inst/partdisk @@ -31,7 +31,7 @@ case go prompt $default 'Disk to partition' $disks disk=$rd - if(! hasmbr /dev/$disk/data) { + if(! ./hasmbr /dev/$disk/data) { echo 'The disk you selected HAS NO master boot record on its first sector.' echo '(Perhaps it is a completely blank disk.)' echo 'You need a master boot record to use the disk.' @@ -63,7 +63,7 @@ case checkdone mbrandplan9=0 disks=`{ls /dev/sd*/plan9 >[2]/dev/null | sed 's!/dev/(sd.*)/plan9!\1!'} for(disk in $disks) { - if(hasmbr /dev/$disk/data) + if(./hasmbr /dev/$disk/data) mbrandplan9=1 } if(~ $mbrandplan9 0){ diff --git a/rc/bin/inst/start b/rc/bin/inst/start index af05ce920..1323c766f 100755 --- a/rc/bin/inst/start +++ b/rc/bin/inst/start @@ -4,7 +4,7 @@ if(test -w /dev/wctl) echo scroll > /dev/wctl cd /bin/inst -. defs +. ./defs textinst=1 export textinst @@ -13,5 +13,4 @@ export textinst rm -f /srv/log echo 2 >/srv/log log `{date} Installation process started -inst/mainloop - +exec ./mainloop diff --git a/rc/bin/inst/watchfd b/rc/bin/inst/watchfd deleted file mode 100755 index d836abd8d..000000000 --- a/rc/bin/inst/watchfd +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/rc - -p=`{ps | grep $1 | sed 's/[^ ]* +([^ ]+) .*/\1/' } -while(! ~ $#p 1) { - sleep 1 - p=`{ps | grep $1 | sed 's/[^ ]* +([^ ]+) .*/\1/'} -} -p=$p(1) - -baropt='-w 145,129,445,168' -if(~ $textinst 1) - baropt=-t - -{ - while(test -f /proc/$p/fd) - grep '^ *'^$2^' ' /proc/$p/fd >[2]/dev/null -} | awk '{print $9 " '^$3^'"; fflush("/dev/stdout")}' | aux/statusbar $baropt $4