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}/
40 PARALLELISMFLAGS = # No parallel build
46 MIBS = host agentx smux \
47 ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail \
48 ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
49 ip-mib/ipAddressPrefixTable/ipAddressPrefixTable \
50 ip-mib/ipDefaultRouterTable/ipDefaultRouterTable \
51 ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \
52 sctp-mib rmon-mib etherlike-mib ucd-snmp/lmsensorsMib
54 configure_options += \
55 --with-cflags="%{CFLAGS} -Wformat" \
56 --with-ldflags="%{LDFLAGS}" \
57 --with-sys-contact="root@localhost" \
58 --with-sys-location="Unknown" \
59 --with-logfile=/var/log/snmpd.log \
60 --with-persistent-directory=/var/lib/net-snmp \
61 --with-mib-modules="%{MIBS}" \
62 --sysconfdir=%{sysconfdir} \
64 --enable-ucd-snmp-compatibility \
67 --enable-embedded-perl \
69 --with-perl-modules="INSTALLDIRS=vendor" \
70 --enable-mfd-rewrites \
72 --with-temp-file-pattern=/var/run/net-snmp/snmp-tmp-XXXXXX \
73 --with-transports="DTLSUDP TLSTCP" \
74 --with-security-modules=tsm \
78 # Remove rpath from compiled perl libs
79 find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
81 # Compile python module
83 %{python} setup.py --basedir=".." build
88 # Remove stuff we don't want to distribute.
89 rm -vf %{BUILDROOT}%{bindir}/snmpinform
90 ln -svf snmptrap %{BUILDROOT}%{bindir}/snmpinform
91 rm -vf %{BUILDROOT}%{bindir}/snmpcheck
92 rm -vf %{BUILDROOT}{%{bindir}/fixproc,%{mandir}/man1/fixproc*}
93 rm -vf %{BUILDROOT}%{bindir}/ipf-mod.pl
95 # Copy missing mib2c.conf files.
96 install -v -m 644 local/mib2c.*.conf %{BUILDROOT}%{datadir}/snmp
98 # Install python module.
100 %{python} setup.py --basedir=".." install -O1 --skip-build --root %{BUILDROOT}
103 # Make libs executable.
104 find %{BUILDROOT} -name "*.so" | xargs chmod -v 755
106 # Install configuration files.
107 mkdir -pv %{BUILDROOT}%{sysconfdir}/snmp
108 install -v -m644 %{DIR_SOURCE}/snmpd.conf \
109 %{BUILDROOT}%{sysconfdir}/snmp/snmpd.conf
110 install -v -m644 %{DIR_SOURCE}/snmptrapd.conf \
111 %{BUILDROOT}%{sysconfdir}/snmp/snmptrapd.conf
113 # Prepare runtime directories.
114 mkdir -pv %{BUILDROOT}%{localstatedir}/{lib,run}/net-snmp
116 # Remove more RPATHs.
117 find %{BUILDROOT}%{bindir} -type f -print \
118 -exec chrpath --delete {} \;
129 %{localstatedir}/lib/net-snmp
133 systemctl daemon-reload >/dev/null 2>&1 || :
137 systemctl --no-reload disable snmpd.service > /dev/null 2>&1 || :
138 systemctl stop snmpd.service > /dev/null 2>&1 || :
140 systemctl --no-reload disable snmptrapd.service > /dev/null 2>&1 || :
141 systemctl stop snmptrapd.service > /dev/null 2>&1 || :
145 systemctl daemon-reload >/dev/null 2>&1 || :
149 systemctl daemon-reload 2>&1 || :
150 systemctl reload-or-try-restart snmpd.service >/dev/null 2>&1 || :
151 systemctl reload-or-try-restart snmptrapd.service >/dev/null 2>&1 || :
159 package %{name}-python
163 package %{name}-devel
171 package %{name}-debuginfo