diff options
author | davidovski <david@davidovski.xyz> | 2022-03-29 23:37:34 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-03-29 23:37:34 +0100 |
commit | d28d2287b138ede0591d9facd5dbe7ca4f329f83 (patch) | |
tree | cea79933059dd721d6a9578f6214ac6fe9057d56 /extra/openrc/openrc.post-install | |
parent | 14a1fee0a54d94f0f57f50d2532849f3c2383a15 (diff) |
added sysvinit and openrc
Diffstat (limited to 'extra/openrc/openrc.post-install')
-rw-r--r-- | extra/openrc/openrc.post-install | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/extra/openrc/openrc.post-install b/extra/openrc/openrc.post-install new file mode 100644 index 0000000..1c27350 --- /dev/null +++ b/extra/openrc/openrc.post-install @@ -0,0 +1,38 @@ +#!/bin/sh + +rc_update() { + local svc="$1" + local level="$2" + mkdir -p /etc/runlevels/$level + ln -sf /etc/init.d/$svc /etc/runlevels/$level +} + +if [ ! -d etc/rcS.d ] && [ ! -d etc/rcL.d ]; then + exit 0 +fi + +for i in etc/rc[SL].d/*; do + [ -L "$i" ] || continue + oldsvc=${i##*/S[0-9][0-9]} + # some services are renamed + case "$oldsvc" in + modutils) svc=modules;; + procps) svc=sysctl;; + bootmisc.sh) svc=bootmisc;; + keymap) svc=keymaps;; + rc.local) svc=local;; + *) svc=$oldsvc;; + esac + + # add the service to correct "runlevel" + case "$svc" in + syslog|klogd) + rc_update $svc sysinit;; + hwclock|modules|sysctl|hostname|keymaps|bootmisc) + rc_update $svc boot;; + *) rc_update $svc default;; + esac + + rm $i +done + |