# Contributor: Jeff Bilyk # Maintainer: Natanael Copa pkgname=smokeping pkgver=2.6.10 pkgrel=0 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 musl-lc_numeric-utf8.patch " depends="perl fping rrdtool perl-rrd perl-uri perl-digest-hmac perl-cgi-session perl-libwww perl-snmp-session perl-net-dns perl-fcgi perl-config-grammar " arch="noarch" license="GPL" subpackages="$pkgname-doc" _builddir="$srcdir"/$pkgname-$pkgver _vendorlib=/usr/share/perl5/vendor_perl prepare() { cd "$_builddir" for i in $source; do case $i in *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; esac done # provided by perl-snmp-session rm -r lib/BER.pm lib/SNMP_Session.pm lib/SNMP_util.pm } build() { cd "$_builddir" ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --bindir=/usr/bin \ --libdir=/usr/lib \ --sysconfdir=/etc/smokeping \ --libexecdir=/usr/libexec \ --datarootdir=/usr/share \ --mandir=/usr/share/man \ --with-htdocs-dir=/usr/share/webapps/smokeping \ || return 1 } package() { cd "$_builddir" make DESTDIR="$pkgdir" install || return 1 for i in basepage.html config smokemail smokeping_secrets tmail; do mv "$pkgdir"/etc/smokeping/${i}.dist "$pkgdir"/etc/smokeping/${i} done # Next part here cleans up the mess that the Makefile leaves behind... mkdir -p "$pkgdir"/$_vendorlib mv "$pkgdir"/usr/lib/Smokeping.pm "$pkgdir"/$_vendorlib/ mv "$pkgdir"/usr/lib/Smokeping "$pkgdir"/$_vendorlib/ # Fix path to config file sed -i -e 's#/usr/etc/config#/etc/smokeping/config#' "$pkgdir"/usr/share/webapps/smokeping/smokeping.fcgi.dist # Install cgi in the right spot and fix permissions mv "$pkgdir"/usr/share/webapps/smokeping/smokeping.fcgi.dist "$pkgdir"/usr/share/webapps/smokeping/smokeping.cgi chmod 755 "$pkgdir"/usr/share/webapps/smokeping/smokeping.cgi # Fix up some paths within smokeping.cgi sed -i -e 's:^use lib:#use lib:' \ -e 's:/etc/config:/etc/smokeping/config:' \ -e '1s:.*:#!/usr/bin/perl:' \ "$pkgdir"/usr/bin/smokeping_cgi || return 1 for i in smokeping smokeinfo; do sed -e 's:^use lib:#use lib:g' \ -e 's:etc/config:etc/smokeping/config:' \ -i "$pkgdir"/usr/bin/$i done sed -e 's#Smokeping::main("$FindBin::Bin/../etc/config")#Smokeping::main("/etc/smokeping/config")#' \ -i "$pkgdir"/usr/bin/smokeping sed -e 's:etc/config.dist:etc/smokeping/config:' \ -i "$pkgdir"/usr/bin/tSmoke # config sed -e '/^imgcache/{s:\(^imgcache[ \t]*=\).*:\1 /var/lib/smokeping/.simg:}' \ -e '/^imgurl/{s:\(^imgurl[ \t]*=\).*:\1 img:}' \ -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 "$pkgdir"/etc/smokeping/config || return 1 # Create softlink for image directory ln -s /var/lib/smokeping/.simg/ "$pkgdir"/usr/share/webapps/smokeping/img sed -e '/^