2009-05-04 21:16:41 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Registers or unregisters OpenRC services into the specified
|
|
|
|
# runlevel.
|
|
|
|
#
|
|
|
|
# Arguments: $1 = action [run/targets]
|
|
|
|
# $2 = target [post-install/pre-remove]
|
|
|
|
# $3 = pkgname
|
|
|
|
#
|
|
|
|
case "$1" in
|
|
|
|
targets)
|
|
|
|
echo "post-install pre-remove"
|
|
|
|
;;
|
|
|
|
run)
|
|
|
|
[ ! -x sbin/rc-update ] && exit 0
|
|
|
|
[ ! -x sbin/rc-service ] && exit 0
|
|
|
|
[ -z "$openrc_services" ] && exit 1
|
|
|
|
|
|
|
|
if [ "$2" = "pre-remove" ]; then
|
|
|
|
text="Unr"
|
|
|
|
rcupdate_args="del"
|
|
|
|
elif [ "$2" = "post-install" ]; then
|
|
|
|
text="R"
|
|
|
|
rcupdate_args="add"
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-05-04 22:47:58 +00:00
|
|
|
[ ! -f etc/fstab ] && touch etc/fstab
|
|
|
|
|
2009-05-04 21:16:41 +00:00
|
|
|
set -- ${openrc_services}
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
if sbin/rc-service -e ${1}; then
|
|
|
|
echo "${text}egistering ${1} OpenRC service..."
|
|
|
|
sbin/rc-update ${rcupdate_args} ${1} ${2}
|
|
|
|
[ $? -ne 0 ] && exit $?
|
|
|
|
sbin/rc-update -u
|
|
|
|
fi
|
|
|
|
shift; shift;
|
|
|
|
done
|
|
|
|
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|