code: plan9front

Download patch

ref: a078bdb66a95b9d604cfc0ba4122feec2e040c68
parent: 95206ac7e54cbc7a0c913c0ab73b509896ff27a5
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Aug 20 12:38:45 EDT 2022

fshalt: support relative paths to the new kernel

--- a/rc/bin/fshalt
+++ b/rc/bin/fshalt
@@ -14,6 +14,12 @@
 	exit usage
 }
 
+if(~ $reboot yes && ~ $#* 1){
+	bootf=$1
+	if(! ~ $bootf /*)
+		bootf=`{builtin pwd}^/$bootf
+}
+
 path=(/bin)
 builtin cd /
 bind -c '#s' /srv
@@ -47,8 +53,8 @@
 cp /bin/sleep /tmp
 cp /bin/scram /tmp
 cp /bin/test /tmp
-if(~ $reboot yes && ~ $#* 1){
-	if(! cp $1 /tmp/bootf)
+if(~ $#bootf 1){
+	if(! cp $bootf /tmp/bootf)
 		exit 'failed to copy kernel'
 	bootf=/bin/bootf
 }