bootmisc: allow sysvinit compatibility during shutdown

Use "halt -w" to write the halt record if it exists.
Otherwise use openrc-shutdown.

This fixes #336.
This commit is contained in:
William Hubbs 2020-11-27 15:13:40 -06:00
parent 38aaba28ee
commit 0fab3e837b

View File

@ -241,7 +241,13 @@ stop()
{ {
# Write a halt record if we're shutting down # Write a halt record if we're shutting down
if [ "$RC_RUNLEVEL" = shutdown ]; then if [ "$RC_RUNLEVEL" = shutdown ]; then
[ "$RC_UNAME" = Linux ] && openrc-shutdown -w if [ "$RC_UNAME" = Linux ]; then
if [ -x /sbin/halt ]; then
halt -w
else
openrc-shutdown -w
fi
fi
if [ "$RC_SYS" = OPENVZ ]; then if [ "$RC_SYS" = OPENVZ ]; then
yesno $RC_REBOOT && printf "" >/reboot yesno $RC_REBOOT && printf "" >/reboot
fi fi