Files
ports/core/runit/halt
2023-05-03 16:38:34 +02:00

23 lines
307 B
Bash
Executable File

#!/bin/sh
if [ $(id -u) != 0 ]; then
echo $(basename $0): must be superuser.
exit 1
fi
prg=$(basename $0)
runit=/sbin/runit-init
case $prg in
poweroff|halt) action=0 ;;
reboot) action=6 ;;
*) exit 1 ;;
esac
if [ $action = 6 ]; then
touch /run/runit.reboot
fi
$runit $action