From 0fab3e837b45021fdcc02a71873c3c245ce96080 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Fri, 27 Nov 2020 15:13:40 -0600 Subject: [PATCH] bootmisc: allow sysvinit compatibility during shutdown Use "halt -w" to write the halt record if it exists. Otherwise use openrc-shutdown. This fixes #336. --- init.d/bootmisc.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in index bf79f03d..43da1869 100644 --- a/init.d/bootmisc.in +++ b/init.d/bootmisc.in @@ -241,7 +241,13 @@ stop() { # Write a halt record if we're shutting down 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 yesno $RC_REBOOT && printf "" >/reboot fi