aboutsummaryrefslogtreecommitdiffstats
path: root/main/net-snmp/APKBUILD
blob: 24f9989c79f596abb565c41447f382fa86335538 (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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=net-snmp
pkgver=5.7.2.1
pkgrel=4
pkgdesc="Simple Network Management Protocol"
url="http://www.net-snmp.org/"
arch="all"
license="GPL"
depends=
depends_dev="openssl-dev"
# we need perl-net-snmp in make depends for bootstrapping issues
# net-snmp-gui subpackage has perl-net-snmp as depends
makedepends="file perl-dev openssl-dev perl-net-snmp linux-headers"
subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-agent-libs:alibs
	$pkgname-perl:pl $pkgname-gui $pkgname-tools"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
	netsnmp-swinst-crash.patch
	fix-includes.patch
	net-snmp-CVE-2014-3565.patch
	snmpd.initd
	snmpd.confd
	snmptrapd.initd
	snmptrapd.confd
	"

_builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	local i
	cd "$_builddir"
	update_config_sub || return 1
	for i in $source; do
		case $i in
		*.patch|*.diff)
			msg "Applying $i..."
			patch -p1 -i "$srcdir"/$i || return 1
			;;
		esac
	done

	# Allow tmpfs volume size monitoring
	# Ref #932
	sed -e 's#"tmpfs",#/*  "tmpfs",  */#g' -i agent/mibgroup/host/hr_filesys.c
}

build() {
	cd "$_builddir"

	export lt_cv_sys_max_cmd_len=8192

	#build fails on: libnetsnmpmibs.so: undefined reference to `pthread_create'
	LDFLAGS="$LDFLAGS -lpthread"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-default-snmp-version="3" \
		--with-sys-contact="root@unknown" \
		--with-sys-location="unknown" \
		--with-logfile="/var/log/net-snmpd.log" \
		--enable-ucd-snmp-compatibility \
		--with-persistent-directory="/var/lib/net-snmp" \
		--with-openssl \
		--enable-pic \
		--enable-ipv6 \
		--enable-shared \
		--enable-as-needed \
		--with-perl-modules="INSTALLDIRS=vendor" \
		--disable-embedded-perl \
		|| return 1
	# embedded-perl seems to create TEXTREL's

	make -j1 || return 1
}

package() {
	cd "$_builddir"
	make -j1 DESTDIR="$pkgdir" install || return 1
	# remove things we dont want distribute
	rm "$pkgdir"/usr/lib/*.la || return 1
	rm "$pkgdir"/usr/lib/libsnmp* \
		"$pkgdir"/usr/bin/snmpcheck \
		"$pkgdir"/usr/bin/fixproc \
		"$pkgdir"/usr/share/man/man1/fixproc* \
		"$pkgdir"/usr/bin/ipf-mod.pl \
		"$pkgdir"/usr/bin/snmpinform \
		|| return 1
	ln -s snmptrap "$pkgdir"/usr/bin/snmpinform || return 1

	install -m755 -D "$srcdir"/snmpd.initd "$pkgdir"/etc/init.d/snmpd
	install -m644 -D "$srcdir"/snmpd.confd "$pkgdir"/etc/conf.d/snmpd
	install -m755 -D "$srcdir"/snmptrapd.initd "$pkgdir"/etc/init.d/snmptrapd
	install -m644 -D "$srcdir"/snmptrapd.confd "$pkgdir"/etc/conf.d/snmptrapd
	install -m644 -D EXAMPLE.conf "$pkgdir"/etc/snmp/snmpd.conf.example
	mkdir -p "$pkgdir"/var/lib/net-snmp
	find "$pkgdir" -name perllocal.pod -delete
}

libs() {
	pkgdesc="The NET-SNMP runtime client libraries"
	replaces="net-snmp"
	mkdir -p "$subpkgdir"/usr/lib "$subpkgdir"/usr/share/snmp || return 1
	mv "$pkgdir"/usr/lib/libnetsnmp.so.* "$subpkgdir"/usr/lib/ || return 1
	mv "$pkgdir"/usr/share/snmp/mibs "$subpkgdir"/usr/share/snmp/ \
		|| return 1
}

alibs() {
	pkgdesc="The NET-SNMP runtime agent libraries"
	replaces="net-snmp"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libnetsnmpagent*.so.* \
		"$pkgdir"/usr/lib/libnetsnmphelpers*.so.* \
		"$pkgdir"/usr/lib/libnetsnmpmibs*.so.* \
		"$pkgdir"/usr/lib/libnetsnmptrapd*.so.* \
		"$subpkgdir"/usr/lib/
}

pl() {
	pkgdesc="The perl NET-SNMP module and the mib2c tool"
	replaces="net-snmp"
	mkdir -p "$subpkgdir"/usr/lib \
		"$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/share/snmp

	mv "$pkgdir"/usr/bin/mib2c-update \
		"$pkgdir"/usr/bin/mib2c \
		"$pkgdir"/usr/bin/snmp-bridge-mib \
		"$pkgdir"/usr/bin/net-snmp-cert \
		"$pkgdir"/usr/bin/traptoemail \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/lib/perl* "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/share/snmp/mib2c* \
		"$pkgdir"/usr/share/snmp/*.pl \
		"$subpkgdir"/usr/share/snmp/
}

gui() {
	pkgdesc="An interactive graphical MIB browser for SNMP"
	depends="perl-net-snmp" # needs perl-tk too...
	replaces="net-snmp-tools"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/tkmib "$subpkgdir"/usr/bin/
}

tools() {
	pkgdesc="Network management utilities using SNMP"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}


md5sums="7db683faba037249837b226f64d566d4  net-snmp-5.7.2.1.tar.gz
bd7dc10ffb5839e35ec37effcc53c2ad  netsnmp-swinst-crash.patch
0fe11859a55f8e2489d5de629971a242  fix-includes.patch
f43a7fef62333882a977acb9e211047c  net-snmp-CVE-2014-3565.patch
3676e4d2e456e88da0dee8d7204749ba  snmpd.initd
ea1296c366d6a7b0dab8a5b46e02d139  snmpd.confd
7ce3e9e880fc6313ae87eb000bae4bda  snmptrapd.initd
363f7728a76bdfc46e29b7e1f5cf4950  snmptrapd.confd"
sha256sums="35dd20a2b17849f6d5a0a6109b4f52c1a777a3e1a00c79c4a175c520d23f3497  net-snmp-5.7.2.1.tar.gz
377e54bc2b66590c1c5174bf2e2c820adcbecd703d67c68be13c325d04d7d0c4  netsnmp-swinst-crash.patch
7528f7d368a0a4536915805c065f8496c37cb99dbc74d508bed89831cd5af37e  fix-includes.patch
a7fd0c8db7428e15c8ffbbb105d651fbcc81ef69b2f587ceb8a10f6d00afc6da  net-snmp-CVE-2014-3565.patch
0f36683e3ab9855ab16c6a9e7f5934145b7f65a02c3dd46dc9627b721296119a  snmpd.initd
e1434b38611a436278b1f0974a55ea3374863a975405b5dc2da836e9acb082ff  snmpd.confd
4baf3ee9950ded78078d93c32833ff657d7e85580d64778cdc9a963cf24bc7ab  snmptrapd.initd
095647b0e5be51e2bdd398267d7450da678b7d23cae6273f9b9461a26f89d69f  snmptrapd.confd"
sha512sums="6c4dadd145cab9572e2559ad99d6794469685086771c6d757d3667da1a061ab86746d53c28d48381c59a90d92b1812b813f3176cff156c41929177fb585299d0  net-snmp-5.7.2.1.tar.gz
78c036f1e6b4e3592cb2a6ff9b22671c930e337e9644298a9f78b6f13af1d9241d9c15dcc996b441b51cb2d551bf2dfe5caf602ff1e17baf7b6532f3dc6ba5bd  netsnmp-swinst-crash.patch
87a552bd2e41684bba6e87fbcf6454a85ee912d7a339411fda24cebddf7661f0856729e076a917920a542cf84b687ffd90a091daa15f2c48f0ff64f3a53c0ddb  fix-includes.patch
8c831ea115413aa1170532865c72cbc9e6e3344b5739b1028095128d870689bcd1222a2fea6005760b80881212b0b92eba565e22fb03b037e1cb04d61378e2cc  net-snmp-CVE-2014-3565.patch
887e84b775cd87a3631deac44aa35645c2df9b13b9346b2b23a80e513e82425304a79a8bf5234937f01638969788602539846e7fb8f9b5a9273c938a6233a175  snmpd.initd
ad30bb027dbd18272a4ddb34009bdaa19df030f23956c5fa592e47cf76ad87175ae6b97659b8bbd866d79674bbc7b8b3a8a400746139c18de0eb86902706b65f  snmpd.confd
e9b29b89d27e88420932ea6ca077a6c807ae5555436cad4d840ec732b5851a498661d0d174f22d308f403904b623d7eadf9d201a539529ff57ced18bc8c58b6f  snmptrapd.initd
9cafeece565ca09c2cc85fa9c805d9932a745aca45b999e7511ccd0ffe0a95eddc1441ed231acf52a811db124bc2f797612ebb182b0a8a959ad24506e790a0b1  snmptrapd.confd"