aboutsummaryrefslogtreecommitdiffstats
path: root/main/smokeping/APKBUILD
blob: 05d90819d7106b3923dbfc87c2dc65e564162a30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Contributor: Jeff Bilyk <jbilyk@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=smokeping
pkgver=2.6.10
pkgrel=2
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 '/^<script/{s:cropper/:/cropper/:}' \
		-i "$pkgdir"/etc/smokeping/basepage.html \
		|| return 1

	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="139f0c456088c3527a55d51898885fe4  smokeping-2.6.10.tar.gz
cabaa0ab3bde87b4e5a6aaa38ea38a37  smokeping.initd
5b0bac1be9c63c1f36ff7c2979af4317  musl-lc_numeric-utf8.patch"
sha256sums="0121672951f47bd45575898c3e4d767e22cc692dd272d723b422515fd3cc641c  smokeping-2.6.10.tar.gz
bae4acc9bae890df5e6a547a346f7589c645deaab00c6c6892728a0c96ba35fb  smokeping.initd
5cb6dd9ce63446b5cfc3f1bba9e39fb91a6d18c512e5a7e153bb6007660466dd  musl-lc_numeric-utf8.patch"
sha512sums="e91ac80ceafccb945ec48cc80020b8cbf2afe29b5f422dc5aaf7c52387eafc498180c293cf82dccc4fdec88ec56f80fb1bd08ebcb2ae9aea563475a069b91f13  smokeping-2.6.10.tar.gz
d532fd8c0abc6b3d619f7e5b32d5101fbc29293b58abc5a048671a3cb18f051e8e8890c9f87ae37d4442d2d8ed0bed248a7d97f9b408cab246b1206a86320f4d  smokeping.initd
e6bc389d8edbc000f5ad65848308197b3eb1ddb24bfa9df9c05fa027103952484383b7e021bea86795dceccdcf3f3d51a24c22cae3a68dc5afa30a72b2dbf803  musl-lc_numeric-utf8.patch"