From 8b045bed291c7a5edb324e727fc8ad0c78bbb5d7 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 4 May 2009 21:59:21 +0200 Subject: [PATCH] metalog: switch to OpenRC; bump revision. --HG-- extra : convert_revision : ba3f40d2cebc31821587c1e018529437706e2d17 --- templates/metalog/INSTALL | 20 ++++++++++++++++++++ templates/metalog/REMOVE | 20 ++++++++++++++++++++ templates/metalog/files/metalog | 17 ----------------- templates/metalog/files/metalog.rc | 28 ++++++++++++++++++++++++++++ templates/metalog/template | 5 +++-- 5 files changed, 71 insertions(+), 19 deletions(-) create mode 100644 templates/metalog/INSTALL create mode 100644 templates/metalog/REMOVE delete mode 100644 templates/metalog/files/metalog create mode 100644 templates/metalog/files/metalog.rc diff --git a/templates/metalog/INSTALL b/templates/metalog/INSTALL new file mode 100644 index 00000000000..fda9469b7c0 --- /dev/null +++ b/templates/metalog/INSTALL @@ -0,0 +1,20 @@ +# +# This script registers the metalog service into the +# 'default' runlevel, as required by OpenRC. +# + +case "${ACTION}" in +pre) + ;; +post) + [ ! -x sbin/rc-update ] && exit 0 + [ ! -x sbin/rc-service ] && exit 0 + + if sbin/rc-service -e udev; then + echo "Registering ${PKGNAME} OpenRC service..." + sbin/rc-update add ${PKGNAME} default + [ $? -ne 0 ] && exit $? + sbin/rc-update -u + fi + ;; +esac diff --git a/templates/metalog/REMOVE b/templates/metalog/REMOVE new file mode 100644 index 00000000000..a487ab0e995 --- /dev/null +++ b/templates/metalog/REMOVE @@ -0,0 +1,20 @@ +# +# This script unregisters the metalog service from the +# 'default' runlevel, as required by OpenRC. +# + +case "${ACTION}" in +pre) + [ ! -x sbin/rc-update ] && exit 0 + [ ! -x sbin/rc-service ] && exit 0 + + if sbin/rc-service -e udev; then + echo "Unregistering ${PKGNAME} OpenRC service..." + sbin/rc-update del ${PKGNAME} default + [ $? -ne 0 ] && exit $? + sbin/rc-update -u + fi + ;; +post) + ;; +esac diff --git a/templates/metalog/files/metalog b/templates/metalog/files/metalog deleted file mode 100644 index 31ead9cf095..00000000000 --- a/templates/metalog/files/metalog +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# -# PROVIDE: metalog -# REQUIRE: SERVERS -# BEFORE: locale - -$_rc_subr_loaded . /etc/rc.subr - -name="metalog" -rcvar=$name -command="/usr/sbin/$name" -command_args="--daemonize" -required_files="/etc/metalog.conf" -pidfile="/var/run/$name.pid" - -load_rc_config $name -run_rc_command "$1" diff --git a/templates/metalog/files/metalog.rc b/templates/metalog/files/metalog.rc new file mode 100644 index 00000000000..7025e46d84d --- /dev/null +++ b/templates/metalog/files/metalog.rc @@ -0,0 +1,28 @@ +#!/sbin/runscript + +extra_commands="buffer unbuffer" +command=/usr/sbin/metalog +pidfile=${metalog_pid:-/var/run/metalog.pid} +command_args="$metalog_flags --daemonize --pidfile $pidfile" + +depend() +{ + provide logger + need localmount + use clock hostname + after bootmisc +} + +buffer() +{ + ebegin "Enabling log buffering" + start-stop-daemon --signal USR2 --pidfile $pidfile + eend $? +} + +unbuffer() +{ + ebegin "Disabling log buffering" + start-stop-daemon --signal USR1 --pidfile $pidfile + eend $? +} diff --git a/templates/metalog/template b/templates/metalog/template index 25b5f7bc29e..92f01f4fbd6 100644 --- a/templates/metalog/template +++ b/templates/metalog/template @@ -1,6 +1,7 @@ # Template file for 'metalog' pkgname=metalog version=1 +revision=1 distfiles="${SOURCEFORGE_SITE}/$pkgname/$pkgname-$version.tar.lzma" build_style=gnu_configure configure_args="--with-unicode" @@ -21,7 +22,7 @@ Add_dependency build lzma-utils post_install() { - install -d ${DESTDIR}/etc/rc.d - install -m755 ${FILESDIR}/metalog ${DESTDIR}/etc/rc.d + install -d ${DESTDIR}/etc/init.d + install -m755 ${FILESDIR}/metalog.rc ${DESTDIR}/etc/init.d/metalog install -m644 ${FILESDIR}/metalog.conf ${DESTDIR}/etc }