1 diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst.h net-snmp-5.9/agent/mibgroup/host/data_access/swinst.h
2 --- net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst.h 2020-08-14 23:41:47.000000000 +0200
3 +++ net-snmp-5.9/agent/mibgroup/host/data_access/swinst.h 2021-02-28 14:29:14.950860864 +0100
5 #ifndef NETSNMP_ACCESS_SWINST_CONFIG_H
6 #define NETSNMP_ACCESS_SWINST_CONFIG_H
8 +// quick fix: this file is consulted before RPM_HRMIB_PATH check is made in configure, hardcode a define for now
9 +#define RPM_HRMIB_PATH "/var/cache/hrmib"
13 * all platforms use this generic code
15 @@ -25,7 +29,7 @@ config_exclude(host/hr_swinst)
16 config_require(host/data_access/swinst_apt)
17 #elif defined( HAVE_LIBRPM ) && defined( linux )
18 config_require(host/data_access/swinst_rpm)
19 -#elif defined( HAVE_PKGLOCS_H ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd )
20 +#elif defined( HAVE_PKGLOCS_H ) || defined( RPM_HRMIB_PATH ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd )
21 config_require(host/data_access/swinst_pkginfo)
23 config_warning(This platform does not yet support hrSWInstalledTable rewrites)
24 diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst_pkginfo.c net-snmp-5.9/agent/mibgroup/host/data_access/swinst_pkginfo.c
25 --- net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst_pkginfo.c 2020-08-14 23:41:47.000000000 +0200
26 +++ net-snmp-5.9/agent/mibgroup/host/data_access/swinst_pkginfo.c 2021-02-28 14:29:14.950860864 +0100
27 @@ -61,6 +61,8 @@ netsnmp_swinst_arch_init(void)
30 snprintf( pkg_directory, SNMP_MAXPATH, "%s", PKGLOC );
31 +#elif defined(RPM_HRMIB_PATH)
32 + snprintf( pkg_directory, SNMP_MAXPATH, "%s", RPM_HRMIB_PATH);
34 snprintf( pkg_directory, SNMP_MAXPATH, "/system" );
35 #elif defined(hpux10) || defined(hpux11)
36 diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/host/hr_swinst.c net-snmp-5.9/agent/mibgroup/host/hr_swinst.c
37 --- net-snmp-5.9.org/agent/mibgroup/host/hr_swinst.c 2021-02-28 14:29:14.640851176 +0100
38 +++ net-snmp-5.9/agent/mibgroup/host/hr_swinst.c 2021-02-28 14:29:14.950860864 +0100
39 @@ -196,6 +196,10 @@ oid hrswinst_variables_oid[]
40 #define _PATH_HRSW_directory "/var/cache/hrmib"
43 +#if defined(RPM_HRMIB_PATH)
44 +#define _PATH_HRSW_directory RPM_HRMIB_PATH
50 diff -urNp -x '*.orig' net-snmp-5.9.org/configure.d/config_os_functions net-snmp-5.9/configure.d/config_os_functions
51 --- net-snmp-5.9.org/configure.d/config_os_functions 2020-08-14 23:41:47.000000000 +0200
52 +++ net-snmp-5.9/configure.d/config_os_functions 2021-02-28 14:29:14.950860864 +0100
53 @@ -188,15 +188,6 @@ AC_CHECK_FUNCS([if_freenameindex
57 -# rpmGetPath check needs clean LIBS environment (Linux)
59 -if test "x$with_rpm" != "xno"; then
62 - AC_CHECK_FUNCS(rpmGetPath)
66 # statfs( char *, struct fs_data* ) (Ultrix)
68 AC_MSG_CHECKING([[for two-argument statfs with struct fs_data (Ultrix)]])
69 diff -urNp -x '*.orig' net-snmp-5.9.org/configure.d/config_os_libs1 net-snmp-5.9/configure.d/config_os_libs1
70 --- net-snmp-5.9.org/configure.d/config_os_libs1 2021-02-28 14:29:14.630850863 +0100
71 +++ net-snmp-5.9/configure.d/config_os_libs1 2021-02-28 14:29:14.950860864 +0100
76 -AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
78 -AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
79 -AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
81 -if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
82 - if test "x$with_rpm" = "xyes" ; then
83 - AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
87 +# check if we can use rpm hrmib export
88 +if test "$with_rpm" != "no" ; then
89 + AC_PATH_PROG([RPM], rpm)
90 + if test -n "$RPM"; then
92 + RPM_HRMIB_PATH=$($RPM -E %{_hrmib_path} | sed -e 's,/[^/]\+$,,')
94 + if test -n "$RPM_HRMIB_PATH"; then
95 + AC_DEFINE_UNQUOTED([RPM_HRMIB_PATH], ["$RPM_HRMIB_PATH"], [Directory where RPM exports packages hrmib information])
99 +# otherwise try binary linkin
100 +if test -z "$RPM_HRMIB_PATH"; then
101 + AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
103 + AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
104 + AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
106 + if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
107 + if test "x$with_rpm" = "xyes" ; then
108 + AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
115 # rpm libraries only needed for the host resources mib software
116 @@ -46,6 +61,12 @@ if test "x$with_rpm" != "xno"; then
117 NETSNMP_SEARCH_LIBS(headerGet,, [
118 AC_DEFINE(HAVE_HEADERGET, 1,
119 [Define to 1 if you have the headerGet function.])],, $LMIBLIBS)
123 + AC_CHECK_FUNCS([rpmGetPath])