1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
10 groups = Networking/Daemons
11 url = http://net-snmp.sourceforge.net
13 summary = Simple Network Management Protocol Daemon.
16 Simple Network Management Protocol (SNMP) is a widely used protocol
17 for monitoring the health and welfare of network equipment (eg. routers),
18 computer equipment and even devices like UPSs.
21 source_dl = https://sourceforge.net/projects/net-snmp/files/net-snmp/%{version}/
41 PARALLELISMFLAGS = # No parallel build
47 MIBS = host agentx smux \
48 ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail \
49 ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
50 ip-mib/ipAddressPrefixTable/ipAddressPrefixTable \
51 ip-mib/ipDefaultRouterTable/ipDefaultRouterTable \
52 ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \
53 sctp-mib rmon-mib etherlike-mib ucd-snmp/lmsensorsMib
55 configure_options += \
56 --with-cflags="%{CFLAGS}" \
57 --with-ldflags="%{LDFLAGS}" \
58 --with-sys-contact="root@localhost" \
59 --with-sys-location="Unknown" \
60 --with-logfile=/var/log/snmpd.log \
61 --with-persistent-directory=/var/lib/net-snmp \
62 --with-mib-modules="%{MIBS}" \
63 --sysconfdir=%{sysconfdir} \
65 --enable-ucd-snmp-compatibility \
68 --enable-embedded-perl \
70 --with-perl-modules="INSTALLDIRS=vendor" \
71 --enable-mfd-rewrites \
73 --with-temp-file-pattern=/var/run/net-snmp/snmp-tmp-XXXXXX \
74 --with-transports="DTLSUDP TLSTCP" \
75 --with-security-modules=tsm \
79 # Remove rpath from compiled perl libs
80 find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
82 # Compile python module
84 %{python} setup.py --basedir=".." build
89 # Remove stuff we don't want to distribute.
90 rm -vf %{BUILDROOT}%{bindir}/snmpinform
91 ln -svf snmptrap %{BUILDROOT}%{bindir}/snmpinform
92 rm -vf %{BUILDROOT}%{bindir}/snmpcheck
93 rm -vf %{BUILDROOT}{%{bindir}/fixproc,%{mandir}/man1/fixproc*}
94 rm -vf %{BUILDROOT}%{bindir}/ipf-mod.pl
96 # Copy missing mib2c.conf files.
97 install -v -m 644 local/mib2c.*.conf %{BUILDROOT}%{datadir}/snmp
99 # Install python module.
101 %{python} setup.py --basedir=".." install -O1 --skip-build --root %{BUILDROOT}
104 # Make libs executable.
105 find %{BUILDROOT} -name "*.so" | xargs chmod -v 755
107 # Install configuration files.
108 mkdir -pv %{BUILDROOT}%{sysconfdir}/snmp
109 install -v -m644 %{DIR_SOURCE}/snmpd.conf \
110 %{BUILDROOT}%{sysconfdir}/snmp/snmpd.conf
111 install -v -m644 %{DIR_SOURCE}/snmptrapd.conf \
112 %{BUILDROOT}%{sysconfdir}/snmp/snmptrapd.conf
114 # Prepare runtime directories.
115 mkdir -pv %{BUILDROOT}%{localstatedir}/{lib,run}/net-snmp
117 # Remove more RPATHs.
118 find %{BUILDROOT}%{bindir} -type f -print \
119 -exec chrpath --delete {} \;
130 %{localstatedir}/lib/net-snmp
134 systemctl daemon-reload >/dev/null 2>&1 || :
138 systemctl --no-reload disable snmpd.service > /dev/null 2>&1 || :
139 systemctl stop snmpd.service > /dev/null 2>&1 || :
141 systemctl --no-reload disable snmptrapd.service > /dev/null 2>&1 || :
142 systemctl stop snmptrapd.service > /dev/null 2>&1 || :
146 systemctl daemon-reload >/dev/null 2>&1 || :
150 systemctl daemon-reload 2>&1 || :
151 systemctl reload-or-try-restart snmpd.service >/dev/null 2>&1 || :
152 systemctl reload-or-try-restart snmptrapd.service >/dev/null 2>&1 || :
160 package %{name}-python
164 package %{name}-devel
172 package %{name}-debuginfo