diff options
author | 2004-07-21 19:51:20 +0000 | |
---|---|---|
committer | 2004-07-21 19:51:20 +0000 | |
commit | 6417f29543f40740e4ee655fa39b4b3a00f9a435 (patch) | |
tree | 1061ce2e9b487c3bd5b725098aed243559e2e039 /net-analyzer/net-snmp | |
parent | x86 stable (diff) | |
download | historical-6417f29543f40740e4ee655fa39b4b3a00f9a435.tar.gz historical-6417f29543f40740e4ee655fa39b4b3a00f9a435.tar.bz2 historical-6417f29543f40740e4ee655fa39b4b3a00f9a435.zip |
added lm_sensor support (x86/amd64), closes #57450
Diffstat (limited to 'net-analyzer/net-snmp')
-rw-r--r-- | net-analyzer/net-snmp/ChangeLog | 9 | ||||
-rw-r--r-- | net-analyzer/net-snmp/Manifest | 27 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/digest-net-snmp-5.1.1-r1 | 1 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/net-snmp-lm_sensors.patch | 475 | ||||
-rw-r--r-- | net-analyzer/net-snmp/net-snmp-5.1.1-r1.ebuild | 96 |
5 files changed, 600 insertions, 8 deletions
diff --git a/net-analyzer/net-snmp/ChangeLog b/net-analyzer/net-snmp/ChangeLog index 8a2ef929516d..6ab1bdbea72f 100644 --- a/net-analyzer/net-snmp/ChangeLog +++ b/net-analyzer/net-snmp/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for net-analyzer/net-snmp # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/ChangeLog,v 1.51 2004/07/16 02:26:04 tgall Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/ChangeLog,v 1.52 2004/07/21 19:51:20 eldad Exp $ + +*net-snmp-5.1.1-r1 (21 Jul 2004) + + 21 Jul 2004; Eldad Zack <eldad@gentoo.org> +files/net-snmp-lm_sensors.patch, + +net-snmp-5.1.1-r1.ebuild: + Added lm_sensor support (only for amd64 and x86). Thanks to Joshua Gerrish + <jgerrish@itsdarkhere.com> for the patch. Closes #57450. 15 Jul 2004; Tom Gall <tgall@gentoo.org> net-snmp-5.1.1.ebuild: added ~ppc64, bug #55548 diff --git a/net-analyzer/net-snmp/Manifest b/net-analyzer/net-snmp/Manifest index 25ba421fc449..e8229d1d230e 100644 --- a/net-analyzer/net-snmp/Manifest +++ b/net-analyzer/net-snmp/Manifest @@ -1,15 +1,28 @@ -MD5 3c586038d23213ecd4e4780cfe80d44a ChangeLog 7911 -MD5 feec9ceb3ba9f6a8b860a4a130998500 metadata.xml 214 -MD5 f597261fb689d5987bd724f686d8bd8c net-snmp-5.0.9-r1.ebuild 1659 -MD5 c9cad6967c195fe67becfed53488a95b net-snmp-5.0.9-r3.ebuild 2253 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + MD5 1ae570c9108ef200409f8caaea8497ba net-snmp-5.1.1.ebuild 2138 +MD5 f597261fb689d5987bd724f686d8bd8c net-snmp-5.0.9-r1.ebuild 1659 MD5 469a9d0b2d836a307178f2fa26042d51 net-snmp-5.1.ebuild 2142 +MD5 c9cad6967c195fe67becfed53488a95b net-snmp-5.0.9-r3.ebuild 2253 +MD5 0513cd6cc7e3bc99e2ff448bc4cf7adb net-snmp-5.1.1-r1.ebuild 2660 +MD5 9e4e3beb6f2220c3d3e15cb5d5a298ff ChangeLog 8190 +MD5 feec9ceb3ba9f6a8b860a4a130998500 metadata.xml 214 MD5 8cadda02e3a8f7279f531b660164c310 files/digest-net-snmp-5.0.9-r1 67 MD5 8cadda02e3a8f7279f531b660164c310 files/digest-net-snmp-5.0.9-r3 67 -MD5 d37d58ebf8d67438ae7a607ffe281b0a files/digest-net-snmp-5.1 65 +MD5 b492aa2a6ad459eb41a26932d4c0740b files/digest-net-snmp-5.1.1-r1 67 MD5 b492aa2a6ad459eb41a26932d4c0740b files/digest-net-snmp-5.1.1 67 +MD5 d37d58ebf8d67438ae7a607ffe281b0a files/digest-net-snmp-5.1 65 +MD5 e5fc72e56ec3671cc1847d822fcfe9e6 files/snmpd.conf 600 MD5 1cc5b20de8fc9e7c807195c320ab2f4b files/net-snmp-proc.patch 2448 MD5 ed2e953a9a923caec45eeca95bec2efc files/snmpd-5.1.conf 606 -MD5 0dbde7b1bdd9c9dc988039e676800337 files/snmpd-5.1.rc6 714 -MD5 e5fc72e56ec3671cc1847d822fcfe9e6 files/snmpd.conf 600 MD5 662833e61042a47d4bd8aaae404f4245 files/snmpd.rc6 710 +MD5 2fc90e7bc5fccb2c9435ecdb7497d467 files/net-snmp-lm_sensors.patch 13688 +MD5 0dbde7b1bdd9c9dc988039e676800337 files/snmpd-5.1.rc6 714 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iD8DBQFA/siAT+MN7JbqCpMRAslqAJ0b/yjrgnkkxcUzNy5wLDcHijp1CwCeMcGB ++yQ35tmqqK6tgdomotucAZM= +=GVl7 +-----END PGP SIGNATURE----- diff --git a/net-analyzer/net-snmp/files/digest-net-snmp-5.1.1-r1 b/net-analyzer/net-snmp/files/digest-net-snmp-5.1.1-r1 new file mode 100644 index 000000000000..b8c9c3775eda --- /dev/null +++ b/net-analyzer/net-snmp/files/digest-net-snmp-5.1.1-r1 @@ -0,0 +1 @@ +MD5 68f6c946387718e4f300cbb8b6c4bd43 net-snmp-5.1.1.tar.gz 2977122 diff --git a/net-analyzer/net-snmp/files/net-snmp-lm_sensors.patch b/net-analyzer/net-snmp/files/net-snmp-lm_sensors.patch new file mode 100644 index 000000000000..55a3274d0de4 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-lm_sensors.patch @@ -0,0 +1,475 @@ +diff -Naur net-snmp-5.1.1.old/agent/mibgroup/host/hr_sensor.c net-snmp-5.1.1/agent/mibgroup/host/hr_sensor.c +--- net-snmp-5.1.1.old/agent/mibgroup/host/hr_sensor.c 1970-01-01 02:00:00.000000000 +0200 ++++ net-snmp-5.1.1/agent/mibgroup/host/hr_sensor.c 2003-10-21 12:49:57.000000000 +0300 +@@ -0,0 +1,322 @@ ++/* This file was generated by mib2c and is intended for use as a mib module ++ for the ucd-snmp snmpd agent. */ ++ ++#include <net-snmp/net-snmp-config.h> ++ ++#include <stdio.h> ++#if HAVE_STDLIB_H ++#include <stdlib.h> ++#endif ++#if HAVE_STRING_H ++#include <string.h> ++#else ++#include <strings.h> ++#endif ++ ++#include <getopt.h> ++#include <errno.h> ++#include <dlfcn.h> ++ ++#include "sensors/sensors.h" ++#include "sensors/error.h" ++ ++#include "host_res.h" ++#include "hr_sensor.h" ++ ++ ++/* ++ * hr_sensor_variables_oid: ++ * this is the top level oid that we want to register under. This ++ * is essentially a prefix, with the suffix appearing in the ++ * variable below. ++ */ ++ ++ ++oid hr_sensor_variables_oid[] = { 1,3,6,1,2,1,25,8 }; ++ ++ ++/* ++ * variable2 hr_sensor_variables: ++ * this variable defines function callbacks and type return information ++ * for the hr_sensor mib section ++ */ ++ ++ ++struct variable2 hr_sensor_variables[] = { ++ /* magic number , variable type , ro/rw , callback fn , L, oidsuffix */ ++#define HRSENSORMAPPING 2 ++ { HRSENSORMAPPING, ASN_INTEGER , RONLY , var_hr_sensor, 2, { 1,1 } }, ++#define HRSENSORNUMBER 3 ++ { HRSENSORNUMBER, ASN_INTEGER , RONLY , var_hr_sensor, 2, { 1,2 } }, ++#define HRSENSORNAME 4 ++ { HRSENSORNAME , ASN_OCTET_STR , RONLY , var_hr_sensor, 2, { 1,3 } }, ++#define HRSENSORLABEL 5 ++ { HRSENSORLABEL , ASN_OCTET_STR , RONLY , var_hr_sensor, 2, { 1,4 } }, ++#define HRSENSORVALUE 6 ++ { HRSENSORVALUE , ASN_OCTET_STR , RONLY , var_hr_sensor, 2, { 1,5 } }, ++ ++}; ++/* (L = length of the oidsuffix) */ ++ ++ ++#define DEFAULT_CONFIG_FILE_NAME "sensors.conf" ++ ++static char *config_file_name; ++FILE *config_file; ++static const char *config_file_path[] = ++{ "/etc", "/usr/lib/sensors", "/usr/local/lib/sensors", "/usr/lib", ++ "/usr/local/lib", ".", 0 }; ++ ++static void open_config_file(void); ++static int open_this_config_file(char *filename); ++ ++ ++/* ++ * functions that are dynamically loaded if the lm_sensors library is ++ * installed. ++ */ ++static int (*sensors_get_label_dl)(sensors_chip_name name, int feature, ++ char **result); ++static int (*sensors_init_dl)(FILE *input); ++static int (*sensors_get_feature_dl)(sensors_chip_name name, int feature, ++ double *result); ++static const sensors_feature_data *(*sensors_get_all_features_dl) ++ (sensors_chip_name name, int *nr1,int *nr2); ++static const sensors_chip_name *(*sensors_get_detected_chips_dl)(int *nr); ++ ++#define CHIPS_MAX 20 ++static sensors_chip_name chips[CHIPS_MAX]; ++static int chips_count=0; ++static int do_sets; ++ ++/* This examines global var config_file, and leaves the name there too. ++ It also opens config_file. */ ++static void open_config_file(void) ++{ ++#define MAX_FILENAME_LEN 1024 ++ char *filename; ++ char buffer[MAX_FILENAME_LEN]; ++ int res,i; ++ ++ if (config_file_name && !strcmp(config_file_name,"-")) { ++ config_file = stdin; ++ return; ++ } else if (config_file_name && index(config_file_name,'/')) { ++ if ((res = open_this_config_file(config_file_name))) { ++ fprintf(stderr,"Could not locate or open config file\n"); ++ fprintf(stderr,"%s: %s\n",config_file_name,strerror(res)); ++ exit(1); ++ } ++ } ++ else { ++ if (config_file_name) ++ filename = config_file_name; ++ else ++ filename = strdup(DEFAULT_CONFIG_FILE_NAME); ++ for (i = 0; config_file_path[i]; i++) { ++ if ((snprintf(buffer,MAX_FILENAME_LEN, ++ "%s/%s",config_file_path[i],filename)) < 1) { ++ fprintf(stderr, ++ "open_config_file: ridiculous long config file name!\n"); ++ exit(1); ++ } ++ if (!open_this_config_file(buffer)) { ++ free(config_file_name); ++ config_file_name = strdup(buffer); ++ return; ++ } ++ } ++ fprintf(stderr,"Could not locate or open config file!\n"); ++ exit(1); ++ } ++} ++ ++static int open_this_config_file(char *filename) ++{ ++ config_file = fopen(filename,"r"); ++ if (! config_file) ++ return -errno; ++ return 0; ++} ++ ++static long *sensor_tbl = 0; ++sensors_chip_name *chip_tbl = 0; ++static int sensor_maxnum = 0; ++ ++static void do_register(sensors_chip_name name) ++{ ++ const char *algo,*adap; ++ ++ { ++ const sensors_feature_data *sensor; ++ const char *map=0; ++ int index0 = 0, index1 = 0; ++ ++ printf("%s\n", name); ++ ++ while ((sensor = sensors_get_all_features_dl (name, &index0, &index1)) ++ != NULL) { ++ if(sensor_tbl = realloc(sensor_tbl, sizeof(long) * (sensor_maxnum+2))) ++ sensor_tbl[sensor_maxnum] = sensor->number; ++ if (chip_tbl = realloc(chip_tbl, sizeof(sensors_chip_name) * (sensor_maxnum+2))) ++ chip_tbl[sensor_maxnum] = name; ++ sensor_maxnum++; ++ } ++ } ++} ++ ++/* ++ * init_hr_sensor(): ++ * Initialization routine. This is called when the agent starts up. ++ * At a minimum, registration of your variables should take place here. ++ */ ++void init_hr_sensor(void) { ++ ++ const sensors_chip_name *chip; ++ int chip_nr,i; ++ int c,res; ++ void *sensors_library; ++ ++ /* This could probably due with a bit more error reporting. */ ++ sensors_library=dlopen("libsensors.so.2",RTLD_LAZY); ++ if(sensors_library==NULL) ++ return; // return before anything is registered ++ ++ sensors_get_label_dl=dlsym(sensors_library,"sensors_get_label"); ++ sensors_init_dl=dlsym(sensors_library,"sensors_init"); ++ sensors_get_feature_dl=dlsym(sensors_library,"sensors_get_feature"); ++ sensors_get_all_features_dl=dlsym(sensors_library, ++ "sensors_get_all_features"); ++ sensors_get_detected_chips_dl=dlsym(sensors_library, ++ "sensors_get_detected_chips"); ++ if(sensors_get_label_dl==NULL || sensors_init_dl==NULL || ++ sensors_get_feature_dl==NULL || sensors_get_all_features_dl==NULL || ++ sensors_get_detected_chips_dl==NULL) ++ return; // return before anything is registered ++ ++ /* register ourselves with the agent to handle our mib tree */ ++ REGISTER_MIB("hr_sensor", hr_sensor_variables, variable2, ++ hr_sensor_variables_oid); ++ ++ ++ /* place any other initialization junk you need here */ ++ ++ ++ chips[0].prefix = SENSORS_CHIP_NAME_PREFIX_ANY; ++ chips[0].bus = SENSORS_CHIP_NAME_BUS_ANY; ++ chips[0].addr = SENSORS_CHIP_NAME_ADDR_ANY; ++ chips_count = 1; ++ ++ open_config_file(); ++ ++ if ((res = sensors_init_dl(config_file))) { ++ return; ++ } ++ ++ for (chip_nr = 0; (chip = sensors_get_detected_chips_dl(&chip_nr));) ++ do_register (*chip); ++} ++ ++ ++/* ++ * var_hr_sensor(): ++ * This function is called every time the agent gets a request for ++ * a scalar variable that might be found within your mib section ++ * registered above. It is up to you to do the right thing and ++ * return the correct value. ++ * You should also correct the value of "var_len" if necessary. ++ * ++ * Please see the documentation for more information about writing ++ * module extensions, and check out the examples in the examples ++ * and mibII directories. ++ */ ++unsigned char * ++var_hr_sensor(struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method) ++{ ++ /* variables we may use later */ ++ static long long_ret; ++ static char *string = 0; ++ static oid objid[MAX_OID_LEN]; ++ static struct counter64 c64; ++ ++ const sensors_feature_data *sensor; ++ const char *map=0; ++ int index0 = 0, index1 = 0; ++ int sensor_idx = 0, sensor_num = 0; ++ sensors_chip_name chip_name; ++ double value; ++ ++ ++ if (header_simple_table(vp,name,length,exact,var_len,write_method,sensor_maxnum) ++ == MATCH_FAILED ) ++ return NULL; ++ ++ sensor_idx = name[*length - 1] - 1; ++ sensor_num = sensor_tbl[sensor_idx]; ++ chip_name = chip_tbl[sensor_idx]; ++ ++ while ((sensor = sensors_get_all_features_dl (chip_name, &index0, &index1)) ++ != NULL) { ++ if(sensor_num == sensor->number) { ++ /* ++ * this is where we do the value assignments for the mib results. ++ */ ++ switch(vp->magic) { ++ ++ ++ case HRSENSORMAPPING: ++ ++ long_ret = sensor->mapping; ++ return (unsigned char *) &long_ret; ++ ++ case HRSENSORNUMBER: ++ ++ long_ret = sensor_num; ++ return (unsigned char *) &long_ret; ++ ++ case HRSENSORNAME: ++ ++ string = malloc(SPRINT_MAX_LEN); ++ strncpy(string, sensor->name, SPRINT_MAX_LEN); ++ *var_len = strlen(string); ++ return (unsigned char *) string; ++ ++ case HRSENSORLABEL: ++ ++ string = malloc(SPRINT_MAX_LEN); ++ ++ if (sensors_get_label_dl (chip_name, sensor->number, &string)) { ++ return 0; ++ } ++ ++ *var_len = strlen(string); ++ return (unsigned char *) string; ++ ++ case HRSENSORVALUE: ++ ++ if (!(sensor->mode & SENSORS_MODE_R)) { ++ return 0; ++ } else if (!(sensor->mode & SENSORS_MODE_R)) { ++ return 0; ++ } else if (sensors_get_feature_dl (chip_name, sensor->number, &value)){ ++ return 0; ++ } ++ string = malloc(SPRINT_MAX_LEN); ++ snprintf(string, SPRINT_MAX_LEN, "%f", value); ++ *var_len = strlen(string); ++ return (unsigned char *) string; ++ ++ default: ++ ERROR_MSG(""); ++ return NULL; ++ } ++ } ++ } ++ return NULL; ++} ++ +diff -Naur net-snmp-5.1.1.old/agent/mibgroup/host/hr_sensor.h net-snmp-5.1.1/agent/mibgroup/host/hr_sensor.h +--- net-snmp-5.1.1.old/agent/mibgroup/host/hr_sensor.h 1970-01-01 02:00:00.000000000 +0200 ++++ net-snmp-5.1.1/agent/mibgroup/host/hr_sensor.h 2003-10-21 12:47:04.000000000 +0300 +@@ -0,0 +1,24 @@ ++/* This file was generated by mib2c and is intended for use as a mib module ++ for the ucd-snmp snmpd agent. */ ++ ++ ++#ifndef _MIBGROUP_HRSENSOR_H ++#define _MIBGROUP_HRSENSOR_H ++ ++ ++/* we may use header_generic and header_simple_table from the util_funcs module */ ++ ++ ++config_require(util_funcs) ++ ++ ++/* function prototypes */ ++ ++ ++extern void init_hr_sensor(void); ++extern FindVarMethod var_hr_sensor; ++ ++ ++ ++ ++#endif /* _MIBGROUP_HRSENSOR_H */ +diff -Naur net-snmp-5.1.1.old/agent/mibgroup/host.h net-snmp-5.1.1/agent/mibgroup/host.h +--- net-snmp-5.1.1.old/agent/mibgroup/host.h 2002-04-20 10:30:00.000000000 +0300 ++++ net-snmp-5.1.1/agent/mibgroup/host.h 2003-10-21 12:47:04.000000000 +0300 +@@ -15,6 +15,7 @@ + config_require(host/hr_filesys) + config_require(host/hr_swrun) + config_require(host/hr_swinst) ++ config_require(host/hr_sensor) + + /* add the host resources mib to the default mibs to load */ + config_add_mib(HOST-RESOURCES-MIB) +diff -Naur net-snmp-5.1.1.old/mibs/HOST-RESOURCES-MIB.txt net-snmp-5.1.1/mibs/HOST-RESOURCES-MIB.txt +--- net-snmp-5.1.1.old/mibs/HOST-RESOURCES-MIB.txt 2002-04-20 10:30:15.000000000 +0300 ++++ net-snmp-5.1.1/mibs/HOST-RESOURCES-MIB.txt 2003-10-21 12:47:04.000000000 +0300 +@@ -106,6 +106,7 @@ + hrSWRunPerf OBJECT IDENTIFIER ::= { host 5 } + hrSWInstalled OBJECT IDENTIFIER ::= { host 6 } + hrMIBAdminInfo OBJECT IDENTIFIER ::= { host 7 } ++hrSensor OBJECT IDENTIFIER ::= { host 8 } + + -- textual conventions + +@@ -1390,6 +1391,66 @@ + (hex)'00 00 01 01 00 00 00 00'." + ::= { hrSWInstalledEntry 5 } + ++ ++hrSensorEntry OBJECT-TYPE ++ SYNTAX hrSensorEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The CPU temperature sensor settings." ++ INDEX { hrSensor } ++ ::= { hrSensor 1 } ++ ++hrSensorEntry ::= SEQUENCE { ++ hrSensorNumber Integer32, ++ hrSensorMapping Integer32, ++ hrSensorName DisplayString, ++ hrSensorLabel DisplayString, ++ hrSensorValue DisplayString ++ } ++ ++ ++ ++hrSensorMapping OBJECT-TYPE ++ SYNTAX Integer32 (1..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The mapping" ++ ::= { hrSensorEntry 1 } ++ ++hrSensorNumber OBJECT-TYPE ++ SYNTAX Integer32 (1..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Number" ++ ::= { hrSensorEntry 2 } ++ ++hrSensorName OBJECT-TYPE ++ SYNTAX DisplayString ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The name of the sensor." ++ ::= { hrSensorEntry 3 } ++ ++hrSensorLabel OBJECT-TYPE ++ SYNTAX DisplayString ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The label of the sensor." ++ ::= { hrSensorEntry 4 } ++ ++hrSensorValue OBJECT-TYPE ++ SYNTAX DisplayString ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The value of the sensor" ++ ::= { hrSensorEntry 5 } ++ + -- Conformance information + + hrMIBCompliances OBJECT IDENTIFIER ::= { hrMIBAdminInfo 2 } +@@ -1456,6 +1517,13 @@ + "The Installed Software Group. + Implementation of this group is at the discretion + of the implementor." ++ ++ GROUP hrSensorGroup ++ DESCRIPTION ++ "The Sensors Group. ++ Implementation of this group is at the discretion ++ of the implementor." ++ + ::= { hrMIBCompliances 1 } + + hrSystemGroup OBJECT-GROUP +@@ -1537,4 +1605,17 @@ + "The Host Resources Installed Software Group." + ::= { hrMIBGroups 6 } + ++ hrSensorGroup OBJECT-GROUP ++ OBJECTS { ++ hrSensorEntry, ++ hrSensorNumber, ++ hrSensorMapping, ++ hrSensorName, ++ hrSensorLabel, ++ hrSensorValue ++ } ++ STATUS current ++ DESCRIPTION ++ "The Sensor Resources Group." ++ ::= { hrMIBGroups 7 } + END diff --git a/net-analyzer/net-snmp/net-snmp-5.1.1-r1.ebuild b/net-analyzer/net-snmp/net-snmp-5.1.1-r1.ebuild new file mode 100644 index 000000000000..af4af701218a --- /dev/null +++ b/net-analyzer/net-snmp/net-snmp-5.1.1-r1.ebuild @@ -0,0 +1,96 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/net-snmp-5.1.1-r1.ebuild,v 1.1 2004/07/21 19:51:20 eldad Exp $ + +inherit eutils + +DESCRIPTION="Software for generating and retrieving SNMP data" +HOMEPAGE="http://net-snmp.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" + +LICENSE="as-is" +SLOT="0" +KEYWORDS="~x86 ~ppc ~sparc ~alpha ~arm ~hppa ~amd64 ~ia64 ~s390 ~ppc64" +IUSE="perl ipv6 ssl tcpd X lm_sensors" + +PROVIDE="virtual/snmp" +DEPEND="virtual/libc + <sys-libs/db-2 + >=sys-libs/zlib-1.1.4 + >=sys-apps/sed-4 + ssl? ( >=dev-libs/openssl-0.9.6d ) + tcpd? ( >=sys-apps/tcp-wrappers-7.6 ) + perl? ( + >=sys-devel/libperl-5.8.0 + >=dev-perl/ExtUtils-MakeMaker-6.11-r1 + ) + x86? || amd64? ( lm_sensors? ( sys-apps/lm-sensors ) ) + " +RDEPEND="${DEPEND} + perl? ( X? ( dev-perl/perl-tk ) ) + !virtual/snmp" + +src_unpack() { + unpack ${A} + cd ${S} + + if use lm_sensors; then + if use x86 || use amd64; then + epatch ${FILESDIR}/${PN}-lm_sensors.patch + else + eerror "Unfortunatly you are trying to enable lm_sensors support for an unsupported arch." + eerror "please check the availability of sys-apps/lm-sensors - if it is available on" + eerror "your arch, please file a bug about this." + die "lm_sensors patch error: unsupported arch." + fi + fi +} + +src_compile() { + local myconf + myconf="${myconf} `use_enable perl embedded-perl`" + myconf="${myconf} `use_with ssl openssl` `use_enable !ssl internal-md5`" + myconf="${myconf} `use_with tcpd libwrap`" + myconf="${myconf} `use_enable ipv6`" + + econf \ + --with-sys-location="Unknown" \ + --with-sys-contact="root@Unknown" \ + --with-default-snmp-version="3" \ + --with-mib-modules="host smux ucd-snmp/dlmod" \ + --with-logfile=/var/log/net-snmpd.log \ + --with-persistent-directory=/var/lib/net-snmp \ + --enable-ucd-snmp-compatibility \ + --enable-shared \ + --with-zlib \ + ${myconf} || die "econf failed" + + emake -j1 || die "compile problem" + + if use perl ; then + emake perlmodules || die "compile perl modules problem" + fi +} + +src_install () { + einstall exec_prefix="${D}/usr" persistentdir="${D}/var/lib/net-snmp" + + if use perl ; then + make DESTDIR="${D}" perlinstall || die "make perlinstall failed" + if ! use X ; then + rm -f "${D}/usr/bin/tkmib" + fi + else + rm -f "${D}/usr/bin/mib2c" "${D}/usr/bin/tkmib" + fi + + dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO + newdoc EXAMPLE.conf.def EXAMPLE.conf + + exeinto /etc/init.d + newexe "${FILESDIR}/snmpd-5.1.rc6" snmpd + insinto /etc/conf.d + newins "${FILESDIR}/snmpd-5.1.conf" snmpd + + keepdir /etc/snmp /var/lib/net-snmp +} |