Hi,

I realized that my initial patch is incorrect although
it worked. By default the halt service is not added
to runlevel «off» but that original patch requires user
to add service "halt" to runlevel "off" ... my bad.

I re-patched sysvinit package, I think this patch
is way much better. And since it detects the existence
of /sbin/openrc, it should not break the original
sysv-rc functionality.

tested on freebsd-amd64.

From 5aecdb9bbfc986b7406e624730fe5406b8d44efc Mon Sep 17 00:00:00 2001
From: Zhou Mo <cdlumin...@gmail.com>
Date: Mon, 5 Dec 2016 03:09:11 +0000
Subject: [PATCH] fix openrc reboot/halt behavior

---
 debian/changelog                         | 8 ++++++++
 debian/src/initscripts/etc/init.d/reboot | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 1b4d1b9..d786039 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+sysvinit (2.88dsf-59.9) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add OpenRC support to /etc/init.d/reboot, fixing OpenRC reboot behavior
+    since openrc version 0.21-4 . (Closes: #844685)
+
+ -- Zhou Mo <cdlumin...@gmail.com>  Sun, 04 Dec 2016 09:18:29 +0000
+
 sysvinit (2.88dsf-59.8) unstable; urgency=medium
 
   * Non-maintainer upload.
diff --git a/debian/src/initscripts/etc/init.d/reboot b/debian/src/initscripts/etc/init.d/reboot
index e1dcb1c..fcf4b65 100755
--- a/debian/src/initscripts/etc/init.d/reboot
+++ b/debian/src/initscripts/etc/init.d/reboot
@@ -29,6 +29,9 @@ case "$1" in
 	exit 3
 	;;
   stop)
+	if [ -x /sbin/openrc ] && [ "$RC_REBOOT" != "YES" ]; then
+		exec /etc/init.d/halt stop
+	fi
 	do_stop
 	;;
   status)
-- 
2.10.2

Reply via email to