ref: 842d5863aa080ea9c00b23707a60033ed1b0c3ce
parent: 32e1ef6f78e4033234946fe985dead5d9672a6ab
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)
--
⑨