mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
extra/net-snmp to 5.7.2-7.1, patch for pci issue
This commit is contained in:
parent
63c0286625
commit
631ff357bc
2 changed files with 75 additions and 17 deletions
|
@ -1,13 +1,13 @@
|
|||
# $Id: PKGBUILD 176934 2013-02-02 19:39:14Z eric $
|
||||
# Maintainer:
|
||||
# $Id$
|
||||
# Maintainer:
|
||||
# Contributor: Dale Blount <dale@archlinux.org>
|
||||
|
||||
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
|
||||
# - don't use PCI on v5/v6
|
||||
# - patch for pci issue: ifmib.patch (http://sourceforge.net/p/net-snmp/bugs/2449/)
|
||||
|
||||
pkgname=net-snmp
|
||||
pkgver=5.7.2
|
||||
pkgrel=7
|
||||
pkgrel=7.1
|
||||
pkgdesc="A suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6"
|
||||
arch=('i686' 'x86_64')
|
||||
url="http://www.net-snmp.org/"
|
||||
|
@ -19,21 +19,24 @@ optdepends=('perl-term-readkey: for snmpcheck application'
|
|||
'python2: for the python modules')
|
||||
options=('!libtool' '!emptydirs' '!makeflags')
|
||||
source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz{,.asc}
|
||||
snmpd.service snmptrapd.service libnl32.patch)
|
||||
snmpd.service snmptrapd.service libnl32.patch ifmib.patch)
|
||||
sha1sums=('c493027907f32400648244d81117a126aecd27ee'
|
||||
'SKIP'
|
||||
'84e32c54d32e6b608747054e04a3ddfe6d6638cc'
|
||||
'0244e91c7baa0abebfb5c0560e8ce04c966c5992'
|
||||
'74a9848b95f63378eb1753fc309d2b74de5afb0f')
|
||||
'74a9848b95f63378eb1753fc309d2b74de5afb0f'
|
||||
'405dbbb4df02eb5ee3531c4566cfe2ae12fa04b5')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
# http://sourceforge.net/tracker/index.php?func=detail&aid=3250304&group_id=12694&atid=112694
|
||||
cd ${pkgname}-${pkgver}
|
||||
# http://sourceforge.net/tracker/index.php?func=detail&aid=3250304&group_id=12694&atid=112694
|
||||
patch -Np1 -i "$srcdir/libnl32.patch"
|
||||
patch -Np1 -i "$srcdir/ifmib.patch"
|
||||
autoreconf -f -i
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${pkgname}-${pkgver}"
|
||||
cd ${pkgname}-${pkgver}
|
||||
PYTHONPROG=/usr/bin/python2 ./configure --prefix=/usr \
|
||||
--sysconfdir=/etc --sbindir=/usr/bin \
|
||||
--mandir=/usr/share/man \
|
||||
|
@ -47,18 +50,11 @@ build() {
|
|||
--with-mib-modules="host misc/ipfwacc ucd-snmp/diskio tunnel ucd-snmp/dlmod" \
|
||||
--with-persistent-directory="/var/net-snmp" \
|
||||
--disable-static
|
||||
|
||||
# ALARM: don't use PCI on v5/v6
|
||||
if [ "$CARCH" = "arm" -o "$CARCH" = "armv6h" ]; then
|
||||
sed -i 's/HAVE_PCI_LOOKUP_NAME 1/HAVE_PCI_LOOKUP_NAME 0/' include/net-snmp/net-snmp-config.h
|
||||
sed -i 's/HAVE_PCI_PCI_H 1/HAVE_PCI_PCI_H 0/' include/net-snmp/net-snmp-config.h
|
||||
fi
|
||||
|
||||
make NETSNMP_DONT_CHECK_VERSION=1
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${pkgname}-${pkgver}"
|
||||
cd ${pkgname}-${pkgver}
|
||||
sed -i -e "s:install --basedir=\$\$dir:install --basedir=\$\$dir --root=${pkgdir}:" Makefile
|
||||
make DESTDIR="${pkgdir}" INSTALL_PREFIX="${pkgdir}" INSTALLDIRS=vendor install
|
||||
install -D -m644 "${srcdir}/snmpd.service" "${pkgdir}/usr/lib/systemd/system/snmpd.service"
|
||||
|
|
62
extra/net-snmp/ifmib.patch
Normal file
62
extra/net-snmp/ifmib.patch
Normal file
|
@ -0,0 +1,62 @@
|
|||
diff --git a/agent/mibgroup/if-mib/data_access/interface_linux.c b/agent/mibgroup/if-mib/data_access/interface_linux.c
|
||||
index 3419811..d6eb91a 100644
|
||||
--- a/agent/mibgroup/if-mib/data_access/interface_linux.c
|
||||
+++ b/agent/mibgroup/if-mib/data_access/interface_linux.c
|
||||
@@ -18,7 +18,31 @@ netsnmp_feature_require(interface_ioctl_flags_set)
|
||||
|
||||
#ifdef HAVE_PCI_LOOKUP_NAME
|
||||
#include <pci/pci.h>
|
||||
+#include <setjmp.h>
|
||||
static struct pci_access *pci_access;
|
||||
+
|
||||
+/* Avoid letting libpci call exit(1) when no PCI bus is available. */
|
||||
+static int do_longjmp =0;
|
||||
+static jmp_buf err_buf;
|
||||
+static void
|
||||
+netsnmp_pci_error(char *msg, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+ char *buf;
|
||||
+ int buflen;
|
||||
+
|
||||
+ va_start(args, msg);
|
||||
+ buflen = strlen("pcilib: ")+strlen(msg)+2;
|
||||
+ buf = malloc(buflen);
|
||||
+ snprintf(buf, buflen, "pcilib: %s\n", msg);
|
||||
+ snmp_vlog(LOG_ERR, buf, args);
|
||||
+ free(buf);
|
||||
+ va_end(args);
|
||||
+ if (do_longjmp)
|
||||
+ longjmp(err_buf, 1);
|
||||
+ else
|
||||
+ exit(1);
|
||||
+}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LINUX_ETHTOOL_H
|
||||
@@ -147,10 +171,22 @@ netsnmp_arch_interface_init(void)
|
||||
|
||||
#ifdef HAVE_PCI_LOOKUP_NAME
|
||||
pci_access = pci_alloc();
|
||||
- if (pci_access)
|
||||
+ if (!pci_access) {
|
||||
+ snmp_log(LOG_ERR, "pcilib: pci_alloc failed\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ pci_access->error = netsnmp_pci_error;
|
||||
+
|
||||
+ do_longjmp = 1;
|
||||
+ if (setjmp(err_buf)) {
|
||||
+ pci_cleanup(pci_access);
|
||||
+ snmp_log(LOG_ERR, "pcilib: pci_init failed\n");
|
||||
+ pci_access = NULL;
|
||||
+ }
|
||||
+ else if (pci_access)
|
||||
pci_init(pci_access);
|
||||
- else
|
||||
- snmp_log(LOG_ERR, "Unable to create pci access method\n");
|
||||
+ do_longjmp = 0;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in a new issue