git: 9front

Download patch

ref: 6b7b78117d356d029db776c9830fecefa6531e70
parent: 052f33c570471b5533f6784ee60e2f46c4c50594
author: aiju <aiju@phicode.de>
date: Thu Jul 21 06:45:41 EDT 2011

fshalt: really scram the local machine

--- a/rc/bin/fshalt
+++ b/rc/bin/fshalt
@@ -3,6 +3,7 @@
 #	and optionally reboot
 rfork e
 reboot=no
+scram=no
 switch ($#*) {
 case 0
 case 1
@@ -14,6 +15,8 @@
 
 path=(/bin)
 builtin cd /
+bind -c '#s' /srv
+bind '#p' /proc
 
 unmount /mnt/consoles >[2]/dev/null
 kill consolefs | rc			# don't compete with /mnt/consoles
@@ -33,8 +36,11 @@
 	sleep 2
 }
 
-# for scram
+# for scram, don't scram other systems
 bind -b '#P' /dev
+if (test -e '#P'/apm)
+	if (! ~ $reboot yes)
+		scram=yes
 
 # halting (binaries we run can't be on the fs we're halting)
 ramfs
@@ -79,7 +85,8 @@
 		echo rebooting...
 		echo reboot >'#c/reboot'
 	}
-	if not scram
+	if (~ $scram yes)
+		scram
 }
 
 x
--