diff options
Diffstat (limited to 'main/smokeping')
-rw-r--r-- | main/smokeping/APKBUILD | 111 | ||||
-rw-r--r-- | main/smokeping/smokeping.initd | 77 | ||||
-rw-r--r-- | main/smokeping/smokeping.pre-install | 5 |
3 files changed, 193 insertions, 0 deletions
diff --git a/main/smokeping/APKBUILD b/main/smokeping/APKBUILD new file mode 100644 index 0000000000..1838ff598f --- /dev/null +++ b/main/smokeping/APKBUILD @@ -0,0 +1,111 @@ +# Contributor: Jeff Bilyk <jbilyk at gmail> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=smokeping +pkgver=2.4.2 +pkgrel=1 +pkgdesc="Smokeping network latency monitoring" +pkgusers="smokeping" +pkggroups="smokeping" +install="$pkgname.pre-install" +url="http://oss.oetiker.ch/smokeping/" +source="http://oss.oetiker.ch/smokeping/pub/smokeping-$pkgver.tar.gz + smokeping.initd" +depends="perl fping rrdtool perl-rrd + perl-uri-escape + perl-digest-hmac + perl-cgi-session + perl-libwww + perl-snmp-session + perl-net-dns + " +license="GPL" + +_builddir="$srcdir"/$pkgname-$pkgver +_vendorlib=/usr/share/perl5/vendor_perl + +prepare() { + cd "$_builddir" + # provided by perl-digest-hmac + rm -rf lib/Digest + # provided by perl-cgi-session + rm -rf lib/CGI + # provided by perl-snmp-session + rm -r lib/BER.pm lib/SNMP_Session.pm lib/SNMP_util.pm + rm -r qooxdoo/qooxdoolink +} + +build() { + return 0 +} + +package() { + cd "$_builddir" + + # create dirs + mkdir -p "$pkgdir"/etc/smokeping \ + "$pkgdir"/usr/bin \ + "$pkgdir"/usr/share/webapps/smokeping \ + "$pkgdir"/$_vendorlib + + # install libs + cp -ra "$_builddir"/lib/* "$pkgdir"/$_vendorlib + + # install cgi scripts + for i in smokeping.cgi tr.cgi; do + sed -i -e 's:^use lib:#use lib:' \ + -e 's:/home/oetiker.*/config.dist:/etc/smokeping/config:' \ + -e '1s:.*:#!/usr/bin/perl:' \ + htdocs/$i.dist || return 1 + mv htdocs/$i.dist \ + "$pkgdir"/usr/share/webapps/smokeping/$i \ + || return 1 + done + + # install ajax scripts + mv "$_builddir/htdocs"/* "$pkgdir"/usr/share/webapps/smokeping + + # install smokeping executables + for i in smokeping tSmoke; do + sed -e 's:^use lib:#use lib:g' \ + -e 's:etc/config.dist:/etc/smokeping/config:' \ + -i bin/$i.dist + install -m755 bin/$i.dist "$pkgdir"/usr/bin/$i + done + + # config + sed -e '/^imgcache/{s:\(^imgcache[ \t]*=\).*:\1 /var/lib/smokeping/.simg:}' \ + -e '/^imgurl/{s:\(^imgurl[ \t]*=\).*:\1 ../.simg:}' \ + -e '/^datadir/{s:\(^datadir[ \t]*=\).*:\1 /var/lib/smokeping:}' \ + -e '/^piddir/{s:\(^piddir[ \t]*=\).*:\1 /var/run/smokeping:}' \ + -e '/^cgiurl/{s#\(^cgiurl[ \t]*=\).*#\1 http://some.place.xyz/perl/smokeping.pl#}' \ + -e '/^smokemail/{s:\(^smokemail[ \t]*=\).*:\1 /etc/smokeping/smokemail:}' \ + -e '/^tmail/{s:\(^tmail[ \t]*=\).*:\1 /etc/smokeping/tmail:}' \ + -e '/^secrets/{s:\(^secrets[ \t]*=\).*:\1 /etc/smokeping/smokeping_secrets:}' \ + -e '/^template/{s:\(^template[ \t]*=\).*:\1 /etc/smokeping/basepage.html:}' \ + -e '/^sendmail/{s:usr/lib:usr/sbin:}' \ + -i etc/config.dist || return 1 + + sed -e '/^<script/{s:cropper/:/cropper/:}' \ + -i etc/basepage.html.dist \ + || return 1 + + for i in etc/*; do + local f=${i##*/} + install -m644 "$i" "$pkgdir"/etc/smokeping/${f%.dist} + done + + chmod 700 "$pkgdir"/etc/smokeping/smokeping_secrets + + # initscript + install -Dm755 "$srcdir"/smokeping.initd "$pkgdir"/etc/init.d/smokeping\ + || return 1 + + install -d -o smokeping -g smokeping -m755 \ + "$pkgdir"/var/lib/smokeping \ + "$pkgdir"/var/lib/smokeping/.simg \ + "$pkgdir"/var/run/smokeping + +} + +md5sums="eb8e7679fcad35e59d7c51f2328250a2 smokeping-2.4.2.tar.gz +550979e008f49299bf404aceeb81fe61 smokeping.initd" diff --git a/main/smokeping/smokeping.initd b/main/smokeping/smokeping.initd new file mode 100644 index 0000000000..068f33ff25 --- /dev/null +++ b/main/smokeping/smokeping.initd @@ -0,0 +1,77 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +opts="${opts} dump reload restore" + +depend() { + need net + use dns +} + +checkconfig() { + if [ ! -f "/etc/smokeping/config" ] ; then + eerror "You need /etc/smokeping/config to run smokeping!" + return 1 + fi +} + +start() { + checkconfig || return 1 + + if [ ! -d /var/run/smokeping/ ]; then + mkdir /var/run/smokeping/ + fi + chown smokeping:smokeping /var/run/smokeping/ + + ebegin "Starting smokeping" + LC_ALL=C \ + start-stop-daemon --start --name smokeping \ + --pidfile /var/run/smokeping/smokeping.pid \ + --exec /usr/bin/smokeping \ + --chuid smokeping:smokeping + eend $? +} + +stop() { + ebegin "Stopping smokeping" + start-stop-daemon --stop \ + --pidfile /var/run/smokeping/smokeping.pid + eend $? +} + +reload() { + ebegin "Reloading smokeping" + /usr/bin/smokeping --reload 1>/dev/null 2>&1 + eend $? +} + +dump() { + ebegin "Dumping smokeping rrd files to XML for backup or upgrade use" + if service_started "${myservice}" ; then + eerror "You need to stop smokeping before dumping files!" + return 1 + fi + for f in `find /var/lib/smokeping -name '*.rrd' -print` ; do + f_xml=`dirname $f`/`basename $f .rrd`.xml + rrdtool dump "$f" > "${f_xml}" + chown root:0 "${f_xml}" + done + eend $? +} + +restore() { + ebegin "Restoring smokeping rrd files from XML dump files" + if service_started "${myservice}" ; then + eerror "You need to stop smokeping before restoring files!" + return 1 + fi + for f in `find /var/lib/smokeping -name '*.xml' -print` ; do + f_rrd=`dirname $f`/`basename $f .xml`.rrd + mv -f "${f_rrd}" "${f_rrd}.bak" + chown root:0 "${f_rrd}.bak" + rrdtool restore "$f" "${f_rrd}" + chown smokeping:smokeping "${f_rrd}" + done + eend $? +} diff --git a/main/smokeping/smokeping.pre-install b/main/smokeping/smokeping.pre-install new file mode 100644 index 0000000000..236550f7c1 --- /dev/null +++ b/main/smokeping/smokeping.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +addgroup smokeping 2>/dev/null +adduser -h /var/lib/smokeping -S -D -G smokeping smokeping 2>/dev/null +exit 0 |