OSDN Git Service

switch-initutils: include the code in the frontend service file, document what it...
authormobinmob <mobinmob@disroot.org>
Wed, 25 Nov 2020 19:27:58 +0000 (21:27 +0200)
committermobinmob <mobinmob@disroot.org>
Wed, 25 Nov 2020 19:27:58 +0000 (21:27 +0200)
usr/share/66/service/switch-initutils

index dc6b974..a13566f 100644 (file)
@@ -1,3 +1,12 @@
+# This oneshot service checks for /usr/bin/{reboot,poweroff,halt,shutdown}
+# and if they are part of runit-void it renames them and copies the 66 
+# utilities in their place. It must be enabled, especially if one
+# changes between the two init systems. There is a similar script in
+# runit core-services -part of the boot-66serv package- that does the
+# opposite and runs by default with runit. 
+# The service makes sure that the user has the proper utilities for the 
+# init system they are currently running. 
+
 [main]
 @type = oneshot
 @version = @VERSION@
@@ -7,4 +16,13 @@
 [start]
 @build = custom
 @shebang = "/bin/sh -c"
-@execute = ( source /etc/runit/core-services/99-switch-initutils.sh )
+@execute = ( 
+if grep -q "init=/usr/bin/66" /proc/cmdline; then
+       for i in reboot poweroff halt shutdown; do
+               if ! test -e /usr/bin/${i}.runit; then
+                       mv /usr/bin/${i} /usr/bin/${i}.runit
+                       cp /etc/66/${i} /usr/bin/${i}
+               fi
+       done
+fi
+)