git: 9front

Download patch

ref: e2aecccbdc2e0ef40ead47f05b7a05f2fd51a40c
parent: 6db30edbdac5f0563be9bdde45aba77c820fc809
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Thu Dec 20 06:17:10 EST 2012

inst: fix pbs update for bootsetup, remove stopether and stopppp tasks

the pbs update might fail if we dont unmount the 9fat.

--- a/rc/bin/inst/bootsetup
+++ b/rc/bin/inst/bootsetup
@@ -52,34 +52,56 @@
 		} >/tmp/plan9.ini
 	}
 
-	need9fatformat=no
-	if(! ~ `{fstype $9fat} dos)
-		need9fatformat=yes
+	# clean state
+	rm -f /tmp/oldplan9.ini /tmp/pbs.bak
+	unmount /n/9fat >[2]/dev/null
+
 	if(! test -f /srv/dos)
 		dossrv
-	if(! mount -c /srv/dos /n/9fat $9fat >[2]/dev/null)
-		need9fatformat=yes
-	if not if(! test -f /n/9fat/plan9.ini)
-		need9fatformat=yes
 
+	need9fatformat=yes
+	if(~ `{fstype $9fat} dos){
+		if(mount /srv/dos /n/9fat $9fat >[2]/dev/null){
+			if(cp /n/9fat/plan9.ini /tmp/oldplan9.ini >[2]/dev/null)
+				need9fatformat=no
+			unmount /n/9fat >[2]/dev/null
+
+			# make sure dossrv is gone
+			sleep 1
+		}
+	}
+
+	# always make backup of old bootsector
+	logprog dd -bs 512 -count 1 -if $9fat -of /tmp/pbs.bak
+
 	if(~ $need9fatformat yes){
 		log Initializing Plan 9 FAT partition.
-		logprog disk/format -r 2 -d -b /386/pbs $9fat
-		logprog mount -c /srv/dos /n/9fat $9fat
+		logprog disk/format -r 2 -d -b /n/newfs/386/pbs $9fat
 	}
 	if not {
 		log Updating bootsector.
-		logprog dd -if $9fat -of /n/9fat/pbs.bak -bs 512 -count 1
-		logprog disk/format -b /386/pbs $9fat
+		logprog disk/format -b /n/newfs/386/pbs $9fat
 	}
 
+	logprog 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
 	# 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
+
+	# copy in backups
+	if(test -f /tmp/oldplan9.ini)
+		logprog cp /tmp/oldplan9.ini /n/9fat
+	if(test -f /tmp/pbs.bak)
+		logprog cp /tmp/pbs.bak /n/9fat
+
+	logprog unmount /n/9fat
 
 	disk=`{basename `{basename -d $9fat}}
 	if(bootplan9){
--- a/rc/bin/inst/main
+++ b/rc/bin/inst/main
@@ -23,8 +23,8 @@
 	copydist\
 	ndbsetup nvramsetup\
 	tzsetup\
-	bootsetup finish stop\
-	stopether stopppp\
+	bootsetup\
+	finish\
 )
 
 # these don't show up in the menu but still matter
--- a/rc/bin/inst/stop
+++ /dev/null
@@ -1,17 +1,0 @@
-#!/bin/rc
-
-# desc: save the current installation state, to be resumed later
-# prereq: 
-# mustdo: 
-
-switch($1) {
-case checkdone
-	stop=notdone
-	export stop
-
-case checkready
-	if(~ $cdboot yes){
-		stop=notdone
-		export stop
-	}
-}
--- a/rc/bin/inst/stopether
+++ /dev/null
@@ -1,20 +1,0 @@
-#!/bin/rc
-
-# desc: shut down the ethernet connection
-# prereq:
-
-
-switch($1) {
-case checkready
-	if(! isipdevup /net/ether0) {
-		stopether=notdone
-		export stopether
-	}
-
-case go
-	ip/ipconfig ether /net/ether0 unbind
-
-case checkdone
-	stopether=notdone
-	export stopether
-}
--- a/rc/bin/inst/stopppp
+++ /dev/null
@@ -1,19 +1,0 @@
-#!/bin/rc
-
-# desc: shut down the ppp connection
-# prereq:
-
-switch($1) {
-case checkready
-	if(! ~ $#pppdev 1 || ! isipdevup '^pkt[0-9]') {
-		stopppp=notdone
-		export stopppp
-	}
-
-case go
-	kill ppp | rc
-
-case checkdone
-	stopppp=notdone
-	export stopppp
-}
--