From 5f1271c76181cd921879a16bc162c2733871f569 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 4 May 2009 23:16:41 +0200 Subject: [PATCH] xbps-base-files: add a trigger to (un)register OpenRC services. Bump to 0.14. --HG-- extra : convert_revision : c80bf0cb66bc468fbe3922a983cddf36e240111e --- templates/xbps-base-files/template | 2 +- triggers/openrc-service | 48 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100755 triggers/openrc-service diff --git a/templates/xbps-base-files/template b/templates/xbps-base-files/template index d3f00fbec35..b0b657dd7e4 100644 --- a/templates/xbps-base-files/template +++ b/templates/xbps-base-files/template @@ -1,6 +1,6 @@ # Template file for 'xbps-base-files' pkgname=xbps-base-files -version=0.13 +version=0.14 build_style=custom-install short_desc="xbps base system files" maintainer="Juan RP " diff --git a/triggers/openrc-service b/triggers/openrc-service new file mode 100755 index 00000000000..bdb92ec18df --- /dev/null +++ b/triggers/openrc-service @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Registers or unregisters OpenRC services into the specified +# runlevel. +# +# Arguments: $1 = action [run/targets] +# $2 = target [post-install/pre-remove] +# $3 = pkgname +# +trigger="openrc-service" + +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 + + 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