openrc.post-install 657 Bytes
Newer Older
1 2
#!/bin/sh

3 4 5 6 7 8 9
rc_update() {
	local svc="$1"
	local level="$2"
	mkdir -p /etc/runlevels/$level
	ln -sf /etc/init.d/$svc /etc/runlevels/$level
}

10 11 12 13 14 15
if [ ! -d etc/rcS.d ] && [ ! -d etc/rcL.d ]; then
	exit 0
fi

for i in etc/rc[SL].d/*; do
	[ -L "$i" ] || continue
16
	oldsvc=${i##*/S[0-9][0-9]}
17
	# some services are renamed
18
	case "$oldsvc" in
19 20 21 22
		modutils)	svc=modules;;
		procps)		svc=sysctl;;
		bootmisc.sh) 	svc=bootmisc;;
		keymap)		svc=keymaps;;
23
		*)		svc=$oldsvc;;
24 25 26 27 28
	esac
	
	# add the service to correct "runlevel"
	case "$svc" in
		hwclock|modules|sysctl|hostname|keymaps|syslog|bootmisc)
29 30
			rc_update $svc boot;;
		*)	rc_update $svc default;;
31 32 33 34
	esac

	rm $i
done
35