2024-01-13 01:14:19 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2024-10-06 00:46:22 -04:00
|
|
|
river=$(pgrep -x river)
|
2024-01-13 01:14:19 -05:00
|
|
|
|
|
|
|
if [ -z "$river" ]; then
|
2024-10-06 00:46:22 -04:00
|
|
|
echo "error: $0: River is not running"
|
|
|
|
exit 1
|
2024-01-13 01:14:19 -05:00
|
|
|
fi
|
|
|
|
|
2024-10-06 00:46:22 -04:00
|
|
|
if [ $# -ne 1 ]; then
|
|
|
|
echo "Usage: river-exit [command]"
|
|
|
|
echo "Commands: logout, poweroff, or reboot"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "logout" ] || [ "$1" = "poweroff" ] || [ "$1" = "reboot" ];then
|
|
|
|
riverctl spawn 'reset'
|
|
|
|
|
|
|
|
if [ "$1" = logout ];then
|
|
|
|
riverctl exit
|
|
|
|
elif [ "$1" = poweroff ] || [ "$1" = reboot ];then
|
|
|
|
loginctl "$1"
|
|
|
|
fi
|
2024-01-13 01:14:19 -05:00
|
|
|
else
|
2024-10-06 00:46:22 -04:00
|
|
|
echo "error: $0: unexpected argument"
|
|
|
|
exit 1
|
2024-01-13 01:14:19 -05:00
|
|
|
fi
|
2024-10-06 00:46:22 -04:00
|
|
|
|
|
|
|
# if [ "$1" = "logout" ]; then
|
|
|
|
# riverctl spawn 'reset'
|
|
|
|
# riverctl exit
|
|
|
|
# elif [ "$1" = "poweroff" ]; then
|
|
|
|
# riverctl spawn 'reset'
|
|
|
|
# loginctl poweroff
|
|
|
|
# elif [ "$1" = "reboot" ]; then
|
|
|
|
# riverctl spawn 'reset'
|
|
|
|
# loginctl reboot
|
|
|
|
# else
|
|
|
|
# echo "error: $0: unexpected argument"
|
|
|
|
# exit 1
|
|
|
|
# fi
|