summaryrefslogtreecommitdiff
path: root/extra/openrc/openrc.post-upgrade
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-03-29 23:37:34 +0100
committerdavidovski <david@davidovski.xyz>2022-03-29 23:37:34 +0100
commitd28d2287b138ede0591d9facd5dbe7ca4f329f83 (patch)
treecea79933059dd721d6a9578f6214ac6fe9057d56 /extra/openrc/openrc.post-upgrade
parent14a1fee0a54d94f0f57f50d2532849f3c2383a15 (diff)
added sysvinit and openrc
Diffstat (limited to 'extra/openrc/openrc.post-upgrade')
-rw-r--r--extra/openrc/openrc.post-upgrade35
1 files changed, 35 insertions, 0 deletions
diff --git a/extra/openrc/openrc.post-upgrade b/extra/openrc/openrc.post-upgrade
new file mode 100644
index 0000000..8884202
--- /dev/null
+++ b/extra/openrc/openrc.post-upgrade
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# in 0.8.0-r1 the state dir moved from /libexec/rc/init.d to /lib/rc/init.d
+# and with 0.10 it moved to /run/openrc
+
+mkdir -p /run/openrc
+for dir in /libexec /lib; do
+ [ -d $dir/rc/init.d ] || continue
+
+ for i in $dir/rc/init.d/* ; do
+ [ -e "$i" ] || continue
+ if [ -e /run/openrc/${i##*/} ]; then
+ rm -r $i
+ else
+ mv $i /run/openrc/
+ fi
+ done
+
+ rmdir $dir/rc/init.d $dir/rc /libexec 2>/dev/null
+done
+
+# create rc.local compat
+if [ -f /etc/rc.local ]; then
+ cat >/etc/local.d/rc.local-compat.start<<__EOF__
+#!/bin/sh
+
+# this is only here for compatibility reasons
+if [ -f /etc/rc.local ]; then
+ . /etc/rc.local
+fi
+__EOF__
+ chmod +x /etc/local.d/rc.local-compat.start
+fi
+
+exit 0