From 6be82ec40a642fc049398d571ce8394ca88d43ab Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 11 Jun 2010 13:06:41 +0000 Subject: testing/mrtg: fix libdir. add init.d script --- testing/mrtg/APKBUILD | 11 ++++++---- testing/mrtg/mrtg.confd | 17 ++++++++++++++++ testing/mrtg/mrtg.initd | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 testing/mrtg/mrtg.confd create mode 100644 testing/mrtg/mrtg.initd (limited to 'testing') diff --git a/testing/mrtg/APKBUILD b/testing/mrtg/APKBUILD index 4066c168ac..9334db7a47 100644 --- a/testing/mrtg/APKBUILD +++ b/testing/mrtg/APKBUILD @@ -2,10 +2,11 @@ # Maintainer: Natanael Copa pkgname=mrtg pkgver=2.16.4 -pkgrel=0 +pkgrel=1 pkgdesc="MRTG Network Latency Monitoring" url="http://oss.oetiker.ch/mrtg/" -source="http://oss.oetiker.ch/mrtg/pub/$pkgname-$pkgver.tar.gz" +source="http://oss.oetiker.ch/mrtg/pub/$pkgname-$pkgver.tar.gz + mrtg.initd mrtg.confd" subpackages="$pkgname-doc" depends="perl" makedepends="gd-dev libpng-dev zlib-dev" @@ -16,7 +17,7 @@ _builddir="$srcdir"/$pkgname-$pkgver build() { cd "$_builddir" ./configure --bindir=/usr/bin \ - --libdir=/usr/lib/mrtg2 \ + --libdir=/usr/lib \ --datadir=/usr/share/doc \ --mandir=/usr/share/doc/man \ || return 1 @@ -28,4 +29,6 @@ package() { make install DESTDIR="$pkgdir" } -md5sums="ec298200d239832ff1648fba488e1a9e mrtg-2.16.4.tar.gz" +md5sums="ec298200d239832ff1648fba488e1a9e mrtg-2.16.4.tar.gz +47053d5e51ac8eefe3807d5168219f78 mrtg.initd +a8d246d324b90fd1e37cc912d4651372 mrtg.confd" diff --git a/testing/mrtg/mrtg.confd b/testing/mrtg/mrtg.confd new file mode 100644 index 0000000000..f3be157baf --- /dev/null +++ b/testing/mrtg/mrtg.confd @@ -0,0 +1,17 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/mrtg/files/mrtg.confd,v 1.1 2005/01/26 10:35:05 ka0ttic Exp $ + +MRTG_CONF="/etc/mrtg.conf" +MRTG_PID="/var/run/mrtg.pid" + +# uncomment and set the following, if you'd like to run mrtg as a +# different user/group +#MRTG_USER="" +#MRTG_GROUP="" + +# uncomment if you'd like to enable logging +#MRTG_LOG="/var/log/mrtg.log" + +# set any extra options here +MRTG_OPTS="" diff --git a/testing/mrtg/mrtg.initd b/testing/mrtg/mrtg.initd new file mode 100644 index 0000000000..31adb2cf0a --- /dev/null +++ b/testing/mrtg/mrtg.initd @@ -0,0 +1,53 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/mrtg/files/mrtg.rc,v 1.7 2007/04/19 19:08:08 cedk Exp $ + +depend() { + need net + + # if monitoring snmp variables on this machine: + # use net-snmpd +} + +checkconfig() { + if ! [ -f "${MRTG_CONF} ]; then + eerror "Please create ${MRTG_CONF} (try man cfgmaker)" + return 1 + fi + + mrtg --check ${MRTG_CONF} + return $? +} + +start() { + # mrtg will not run if LANG=*utf8 + # use grep instead of bash regexp for bug #159786 + echo $LANG | grep -q -E '((^[A-Za-z0-9\_\@\-]+\.)|(^))([uU][tT][fF]-?8)$' && LANG='C' + + checkconfig || return $? + + # enable logging? + [ -n "${MRTG_LOG}" ] && \ + MRTG_OPTS="${MRTG_OPTS} --logging ${MRTG_LOG}" + + # run as a different user? + [ -n "${MRTG_USER}" ] && \ + MRTG_OPTS="${MRTG_OPTS} --user ${MRTG_USER}" + + # run as a different group? + [ -n "${MRTG_GROUP}" ] && \ + MRTG_OPTS="${MRTG_OPTS} --group ${MRTG_GROUP}" + + ebegin "Starting mrtg" + start-stop-daemon --start --quiet --pidfile ${MRTG_PID} --name mrtg\ + --exec /usr/bin/mrtg -- --daemon --pid-file=${MRTG_PID} \ + ${MRTG_OPTS} ${MRTG_CONF} >/dev/null + eend $? "Failed to start mrtg" +} + +stop() { + ebegin "Stopping mrtg" + start-stop-daemon --stop --quiet --pidfile ${MRTG_PID} + eend $? "Failed to stop mrtg" +} -- cgit v1.2.3