Browse code

net-snmp: make conf files available in /etc/snmp

The configuration files of the package are located in non-standard
/usr/etc/snmp directory. With this change, the configuration files
will be available in /etc/snmp path for both, fresh install and
upgrade. In case of upgrade, a symbolic link /etc/snmp is created
which will be pointing to /usr/etc/snmp.

Change-Id: I6c369e5deaa30037b9839110c1ff8179bee6a44f
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6767
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

dweepadvani authored on 2019/02/21 03:08:41
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 Summary:        Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6.
3 3
 Name:           net-snmp
4 4
 Version:        5.7.3
5
-Release:        10%{?dist}
5
+Release:        11%{?dist}
6 6
 License:        BSD (like)
7 7
 URL:            http://net-snmp.sourceforge.net/
8 8
 Group:          Productivity/Networking/Other
... ...
@@ -44,6 +44,7 @@ The net-snmp-devel package contains headers and libraries for building SNMP appl
44 44
                 --build=i686 \
45 45
                 --target=ia64-linux \
46 46
                 --sbindir=/sbin \
47
+                --sysconfdir=%{_sysconfdir} \
47 48
                 --with-sys-location="unknown" \
48 49
                 --with-logfile=/var/log/net-snmpd.log \
49 50
                 --with-persistent-directory=/var/lib/net-snmp \
... ...
@@ -65,6 +66,12 @@ install -m 0644 %{SOURCE2} %{buildroot}/lib/systemd/system/snmptrapd.service
65 65
 make %{?_smp_mflags} test
66 66
 
67 67
 %post
68
+if [ $1 == 2 ]; then
69
+  # Upgrading net-snmp, preserve the existing config in /usr/etc/snmp
70
+  if [ -d /usr/etc/snmp -a ! -e %{_sysconfdir}/snmp ]; then
71
+    ln -sf /usr/etc/snmp %{_sysconfdir}/snmp
72
+  fi
73
+fi
68 74
 /sbin/ldconfig
69 75
 %systemd_post snmpd.service
70 76
 %systemd_post snmptrapd.service
... ...
@@ -89,6 +96,7 @@ rm -rf %{buildroot}/*
89 89
 %{_bindir}
90 90
 %{_libdir}/*.so.*
91 91
 /sbin/*  
92
+%ghost %config(noreplace) %{_sysconfdir}/snmp/*
92 93
 
93 94
 %files devel
94 95
 %defattr(-,root,root)
... ...
@@ -101,6 +109,8 @@ rm -rf %{buildroot}/*
101 101
 %exclude /usr/lib/perl5/5.24.1/*/perllocal.pod
102 102
 
103 103
 %changelog
104
+*   Wed Feb 20 2019 Dweep Advani <dadvani@vmware.com> 5.7.3-11
105
+-   Fixed snmpd.conf path
104 106
 *   Mon Dec 31 2018 Ankit Jain <ankitja@vmware.com> 5.7.3-10
105 107
 -   Fix for CVE-2018-18065
106 108
 *   Tue Jul 31 2018 Ajay Kaher <akaher@vmware.com> 5.7.3-9