APKBUILD 6.23 KB
Newer Older
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
1 2 3
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=net-snmp
4
pkgver=5.7.3
5
pkgrel=4
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
6 7
pkgdesc="Simple Network Management Protocol"
url="http://www.net-snmp.org/"
8
arch="all"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
9
license="GPL"
Natanael Copa's avatar
Natanael Copa committed
10
depends=
11
depends_dev="openssl-dev"
12 13
# we need perl-net-snmp in make depends for bootstrapping issues
# net-snmp-gui subpackage has perl-net-snmp as depends
14
makedepends="file perl-dev openssl-dev perl-net-snmp linux-headers"
15 16
subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-agent-libs:alibs
	$pkgname-perl:pl $pkgname-gui $pkgname-tools"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
17
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
18
	netsnmp-swinst-crash.patch
Timo Teräs's avatar
Timo Teräs committed
19
	fix-includes.patch
20 21
	CVE-2015-5621.patch

22
	initd
23 24 25
	snmpd.confd
	snmptrapd.confd
	"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
26

27
_builddir="$srcdir/$pkgname-$pkgver"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
28

29 30 31
prepare() {
	local i
	cd "$_builddir"
Timo Teräs's avatar
Timo Teräs committed
32
	update_config_sub || return 1
33 34 35 36 37 38 39 40
	for i in $source; do
		case $i in
		*.patch|*.diff)
			msg "Applying $i..."
			patch -p1 -i "$srcdir"/$i || return 1
			;;
		esac
	done
41 42 43

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

47 48
build() {
	cd "$_builddir"
49

Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
50
	export lt_cv_sys_max_cmd_len=8192
51

52 53
	#build fails on: libnetsnmpmibs.so: undefined reference to `pthread_create'
	LDFLAGS="$LDFLAGS -lpthread"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
54

55 56 57 58
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
59
		--sysconfdir=/etc \
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
60 61 62 63 64 65 66 67
		--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" \
68
		--with-openssl \
69
		--enable-pic \
70
		--enable-ipv6 \
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
71
		--enable-shared \
72
		--enable-as-needed \
73
		--with-perl-modules="INSTALLDIRS=vendor" \
74 75
		--disable-embedded-perl \
		|| return 1
76 77
	# embedded-perl seems to create TEXTREL's

78
	make -j1 || return 1
79 80 81
}

package() {
82
	cd "$_builddir"
Natanael Copa's avatar
Natanael Copa committed
83
	make -j1 DESTDIR="$pkgdir" install || return 1
84 85 86 87 88 89 90 91 92
	# remove things we dont want distribute
	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
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
93

94 95
	install -m755 -D "$srcdir"/initd "$pkgdir"/etc/init.d/snmpd
	install -m755 -D "$srcdir"/initd "$pkgdir"/etc/init.d/snmptrapd
96 97
	install -m644 -D "$srcdir"/snmpd.confd "$pkgdir"/etc/conf.d/snmpd
	install -m644 -D "$srcdir"/snmptrapd.confd "$pkgdir"/etc/conf.d/snmptrapd
98 99
	install -m644 -D EXAMPLE.conf "$pkgdir"/etc/snmp/snmpd.conf
	echo "authCommunity log,execute,net public" > "$pkgdir"/etc/snmp/snmptrapd.conf
100 101
	mkdir -p "$pkgdir"/var/lib/net-snmp
	find "$pkgdir" -name perllocal.pod -delete
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
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
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/
}

Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
151
tools() {
152
	pkgdesc="Network management utilities using SNMP"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
153 154 155 156 157
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}


158 159
md5sums="d4a3459e1577d0efa8d96ca70a885e53  net-snmp-5.7.3.tar.gz
4fd189ec7154114c9bd19f2b0058ae9c  netsnmp-swinst-crash.patch
Timo Teräs's avatar
Timo Teräs committed
160
0fe11859a55f8e2489d5de629971a242  fix-includes.patch
161
2267947dd243b4fa85a3cf0c23dbaa76  CVE-2015-5621.patch
162 163 164
5d02ca50ba04fd9421cd059700dfabf5  initd
c7658acd05090f52c6a9e4b195d65b01  snmpd.confd
8095341bc4bb23bfc3be1d7e2d51bb4f  snmptrapd.confd"
165 166
sha256sums="12ef89613c7707dc96d13335f153c1921efc9d61d3708ef09f3fc4a7014fb4f0  net-snmp-5.7.3.tar.gz
2de23959acf74d8f893129819149d016cc22f2d60e15f875e4d17de33931013e  netsnmp-swinst-crash.patch
Timo Teräs's avatar
Timo Teräs committed
167
7528f7d368a0a4536915805c065f8496c37cb99dbc74d508bed89831cd5af37e  fix-includes.patch
168
4cfe532b39877d90836d04079ab7bff14727719e8ca719ead9d615b21cade255  CVE-2015-5621.patch
169 170 171
30258e0e6e6699fbb655be378b5096b2bfefd77fad2a7aff98b32cf3e0ccb282  initd
21ced816652de3dbae04970db8e465ffb119a2a0c1bddf9f12867d1c81eb0aac  snmpd.confd
2ff4dc5a94a3b78aeb88c85dc94e55bf01ef342cf02d536b5c71bb6654a9c025  snmptrapd.confd"
172 173
sha512sums="0758bba5844cfd6c80959ac16b83906a2f830ba49fd0ab1bf9e191dc6a79d312a2e4760bd53b3e1a1c82759481f0064d088d5a3cf475d84b25679a6bd0f049bb  net-snmp-5.7.3.tar.gz
4ad92f50b14d5e27ba86256cc532a2dd055502f4d5fbb1700434f9f01f881fd09bb1eadb94e727554e1470f036707558314c64a66d0376b54e71ab31d5e4baa3  netsnmp-swinst-crash.patch
Timo Teräs's avatar
Timo Teräs committed
174
87a552bd2e41684bba6e87fbcf6454a85ee912d7a339411fda24cebddf7661f0856729e076a917920a542cf84b687ffd90a091daa15f2c48f0ff64f3a53c0ddb  fix-includes.patch
175
2b2a7be54a570e3c1bb701f8ccfb98ea8e50a19fda021f43a521d4e968ded1bc5e794fc4348dff7fcdf57da34ff6b555398851bbccfcf92bb75ad6f365a80dba  CVE-2015-5621.patch
176 177 178
32b93dd00d1fbf84edebb177b52caa26ac577e33f14f2c0af5dc04fcefd924adf28bd506cb377711eef5e543476f822f1aac0607f24a668e9d0df6268a06685e  initd
fb101aa758d741ed3ea88b11f1cd49cfd04bd03ce62435f3acb17724748131c57f00b71fd45cb7e7871d65a1aab576652cd6e158b6406aa6d0998582b8235ef5  snmpd.confd
073fd2b83eedd6eda1f7345350268ce7946ef6d67a8f26f7c232e46feb75babf68272ae12071a2f9ea76ede71393b3ae4672d3cd47cfd14ab77e3a6482f2e124  snmptrapd.confd"