summaryrefslogblamecommitdiff
path: root/system/openrc/openrc.post-install
blob: 1057eed416a30193206a9f2a3d29506b9d9a0ece (plain) (tree)



































                                                                        
#!/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
		hwclock|modules|sysctl|hostname|keymaps|syslog|bootmisc)
			rc_update $svc boot;;
		*)	rc_update $svc default;;
	esac

	rm $i
done