shithub: riscv

Download patch

ref: 25ad7eef2cbe2b3431111f241d85658f57034df6
parent: 79293e820d4bf25efd685fb43be78d52b7a093b1
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Sep 7 15:49:38 EDT 2022

fshalt: optionally use /dev/pmctl to shut down the machine

--- a/rc/bin/fshalt
+++ b/rc/bin/fshalt
@@ -80,6 +80,9 @@
 		echo rebooting...
 		echo reboot $bootf >'#c/reboot'
 	}
+	if not if (test -e /dev/pmctl) {
+		echo power off >>/dev/pmctl
+	}
 	if (~ $scram yes){
 		scram
 		echo 'It''s now safe to turn off your computer'
--- a/sys/man/8/fshalt
+++ b/sys/man/8/fshalt
@@ -29,9 +29,10 @@
 will then reboot the machine,
 optionally starting
 .IR kernelpath .
-Else it will invoke
-.I scram
-to shut down the machine.
+Else it will try to shut down the machine through
+.I /dev/pmctl
+(if available) or invoke
+.IR scram .
 The halting and rebooting is done by copying all necessary
 commands into a
 .IR ramfs (4)