summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2013-08-12 18:35:12 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2013-08-12 18:35:12 +0000
commita187cc4791c30406e492336407c7e932a6071434 (patch)
treea9d9a2e7a700b75527914e2d80f24ce8eec18686 /sys-power/nut
parentMove to distutils-r1 (diff)
downloadgentoo-2-a187cc4791c30406e492336407c7e932a6071434.tar.gz
gentoo-2-a187cc4791c30406e492336407c7e932a6071434.tar.bz2
gentoo-2-a187cc4791c30406e492336407c7e932a6071434.zip
Add support for IPMI drivers, upslog daemon, EAPI5, bash-completion-r1. Fix typos in init scripts. Fix Bug #478556: systemd install location.
(Portage version: 2.2.0_alpha185/cvs/Linux x86_64, unsigned Manifest commit)
Diffstat (limited to 'sys-power/nut')
-rw-r--r--sys-power/nut/ChangeLog13
-rw-r--r--sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch448
-rwxr-xr-xsys-power/nut/files/nut-2.6.5-init.d-upsd38
-rw-r--r--sys-power/nut/files/nut-2.6.5-init.d-upslog31
-rwxr-xr-xsys-power/nut/files/nut-2.6.5-init.d-upsmon30
-rw-r--r--sys-power/nut/metadata.xml3
-rw-r--r--sys-power/nut/nut-2.6.5-r1.ebuild229
7 files changed, 790 insertions, 2 deletions
diff --git a/sys-power/nut/ChangeLog b/sys-power/nut/ChangeLog
index a6a55e58d0ef..3c7e1af224ff 100644
--- a/sys-power/nut/ChangeLog
+++ b/sys-power/nut/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for sys-power/nut
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/ChangeLog,v 1.106 2012/12/03 02:05:51 ssuominen Exp $
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/ChangeLog,v 1.107 2013/08/12 18:35:11 robbat2 Exp $
+
+*nut-2.6.5-r1 (12 Aug 2013)
+
+ 12 Aug 2013; Robin H. Johnson <robbat2@gentoo.org>
+ +files/nut-2.6.5-freeipmi_fru.patch, +files/nut-2.6.5-init.d-upsd,
+ +files/nut-2.6.5-init.d-upslog, +files/nut-2.6.5-init.d-upsmon,
+ +nut-2.6.5-r1.ebuild, metadata.xml:
+ Add support for IPMI drivers, upslog daemon, EAPI5, bash-completion-r1. Fix
+ typos in init scripts. Fix Bug #478556: systemd install location.
03 Dec 2012; Samuli Suominen <ssuominen@gentoo.org> nut-2.6.0-r1.ebuild,
nut-2.6.2.ebuild, nut-2.6.3.ebuild, nut-2.6.5.ebuild:
diff --git a/sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch b/sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch
new file mode 100644
index 000000000000..96ac91d0a48c
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch
@@ -0,0 +1,448 @@
+Update to 1.2.x ipmi_fru declarations.
+
+Starting with the 1.2.1 release, all of the ipmi_fru_parse* declarations (both
+lowercase & uppercase) were renamed to ipmi_fru*. This is a simple search &
+replace of all instances. Upstream should probably have a backwards compatible
+version that supports both variants of the names.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar nut-2.6.5.orig/drivers/nut-libfreeipmi.c nut-2.6.5/drivers/nut-libfreeipmi.c
+--- nut-2.6.5.orig/drivers/nut-libfreeipmi.c 2012-07-31 17:38:59.000000000 +0000
++++ nut-2.6.5/drivers/nut-libfreeipmi.c 2013-08-12 17:55:03.132363518 +0000
+@@ -57,7 +57,7 @@
+
+ /* FreeIPMI contexts and configuration*/
+ ipmi_ctx_t ipmi_ctx = NULL;
+-ipmi_fru_parse_ctx_t fru_parse_ctx = NULL;
++ipmi_fru_ctx_t fru_parse_ctx = NULL;
+ ipmi_monitoring_ctx_t mon_ctx = NULL;
+ struct ipmi_monitoring_ipmi_config ipmi_config;
+ /* SDR management API has changed with 1.1.X and later */
+@@ -78,7 +78,7 @@
+
+ /* Support functions */
+ static const char* libfreeipmi_getfield (uint8_t language_code,
+- ipmi_fru_parse_field_t *field);
++ ipmi_fru_field_t *field);
+
+ static void libfreeipmi_cleanup();
+
+@@ -97,7 +97,7 @@
+ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev)
+ {
+ int ret = -1;
+- uint8_t areabuf[IPMI_FRU_PARSE_AREA_SIZE_MAX+1];
++ uint8_t areabuf[IPMI_FRU_AREA_SIZE_MAX+1];
+ unsigned int area_type = 0;
+ unsigned int area_length = 0;
+
+@@ -134,26 +134,26 @@
+ upsdebugx(1, "FreeIPMI initialized...");
+
+ /* Parse FRU information */
+- if (!(fru_parse_ctx = ipmi_fru_parse_ctx_create (ipmi_ctx)))
++ if (!(fru_parse_ctx = ipmi_fru_ctx_create (ipmi_ctx)))
+ {
+ libfreeipmi_cleanup();
+- fatal_with_errno(EXIT_FAILURE, "ipmi_fru_parse_ctx_create()");
++ fatal_with_errno(EXIT_FAILURE, "ipmi_fru_ctx_create()");
+ }
+
+ /* lots of motherboards calculate checksums incorrectly */
+- if (ipmi_fru_parse_ctx_set_flags (fru_parse_ctx, IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
++ if (ipmi_fru_ctx_set_flags (fru_parse_ctx, IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
+ {
+ libfreeipmi_cleanup();
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_ctx_set_flags: %s\n",
+- ipmi_fru_parse_ctx_strerror (ipmi_fru_parse_ctx_errnum (fru_parse_ctx)));
++ fatalx(EXIT_FAILURE, "ipmi_fru_ctx_set_flags: %s\n",
++ ipmi_fru_ctx_strerror (ipmi_fru_ctx_errnum (fru_parse_ctx)));
+ }
+
+ /* Now open the requested (local) PSU */
+- if (ipmi_fru_parse_open_device_id (fru_parse_ctx, ipmi_id) < 0)
++ if (ipmi_fru_open_device_id (fru_parse_ctx, ipmi_id) < 0)
+ {
+ libfreeipmi_cleanup();
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_open_device_id: %s\n",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatalx(EXIT_FAILURE, "ipmi_fru_open_device_id: %s\n",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+ /* Set IPMI identifier */
+@@ -164,19 +164,19 @@
+ /* clear fields */
+ area_type = 0;
+ area_length = 0;
+- memset (areabuf, '\0', IPMI_FRU_PARSE_AREA_SIZE_MAX + 1);
++ memset (areabuf, '\0', IPMI_FRU_AREA_SIZE_MAX + 1);
+
+ /* parse FRU buffer */
+- if (ipmi_fru_parse_read_data_area (fru_parse_ctx,
++ if (ipmi_fru_read_data_area (fru_parse_ctx,
+ &area_type,
+ &area_length,
+ areabuf,
+- IPMI_FRU_PARSE_AREA_SIZE_MAX) < 0)
++ IPMI_FRU_AREA_SIZE_MAX) < 0)
+ {
+ libfreeipmi_cleanup();
+ fatal_with_errno(EXIT_FAILURE,
+- "ipmi_fru_parse_open_device_id: %s\n",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ "ipmi_fru_open_device_id: %s\n",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+ if (area_length)
+@@ -184,7 +184,7 @@
+ switch (area_type)
+ {
+ /* get generic board information */
+- case IPMI_FRU_PARSE_AREA_TYPE_BOARD_INFO_AREA:
++ case IPMI_FRU_AREA_TYPE_BOARD_INFO_AREA:
+
+ if(libfreeipmi_get_board_info (areabuf, area_length,
+ ipmi_dev) < 0)
+@@ -193,7 +193,7 @@
+ }
+ break;
+ /* get specific PSU information */
+- case IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION:
++ case IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION:
+
+ if(libfreeipmi_get_psu_info (areabuf, area_length, ipmi_dev) < 0)
+ {
+@@ -205,13 +205,13 @@
+ break;
+ }
+ }
+- } while ((ret = ipmi_fru_parse_next (fru_parse_ctx)) == 1);
++ } while ((ret = ipmi_fru_next (fru_parse_ctx)) == 1);
+
+ /* check for errors */
+ if (ret < 0) {
+ libfreeipmi_cleanup();
+- fatal_with_errno(EXIT_FAILURE, "ipmi_fru_parse_next: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatal_with_errno(EXIT_FAILURE, "ipmi_fru_next: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+ else {
+ /* Get all related sensors information */
+@@ -232,25 +232,25 @@
+ }
+
+ static const char* libfreeipmi_getfield (uint8_t language_code,
+- ipmi_fru_parse_field_t *field)
++ ipmi_fru_field_t *field)
+ {
+- static char strbuf[IPMI_FRU_PARSE_AREA_STRING_MAX + 1];
+- unsigned int strbuflen = IPMI_FRU_PARSE_AREA_STRING_MAX;
++ static char strbuf[IPMI_FRU_AREA_STRING_MAX + 1];
++ unsigned int strbuflen = IPMI_FRU_AREA_STRING_MAX;
+
+ if (!field->type_length_field_length)
+ return NULL;
+
+- memset (strbuf, '\0', IPMI_FRU_PARSE_AREA_STRING_MAX + 1);
++ memset (strbuf, '\0', IPMI_FRU_AREA_STRING_MAX + 1);
+
+- if (ipmi_fru_parse_type_length_field_to_string (fru_parse_ctx,
++ if (ipmi_fru_type_length_field_to_string (fru_parse_ctx,
+ field->type_length_field,
+ field->type_length_field_length,
+ language_code,
+ strbuf,
+ &strbuflen) < 0)
+ {
+- upsdebugx (2, "ipmi_fru_parse_type_length_field_to_string: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ upsdebugx (2, "ipmi_fru_type_length_field_to_string: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ return NULL;
+ }
+
+@@ -280,8 +280,8 @@
+ {
+ /* cleanup */
+ if (fru_parse_ctx) {
+- ipmi_fru_parse_close_device_id (fru_parse_ctx);
+- ipmi_fru_parse_ctx_destroy (fru_parse_ctx);
++ ipmi_fru_close_device_id (fru_parse_ctx);
++ ipmi_fru_ctx_destroy (fru_parse_ctx);
+ }
+
+ #ifdef HAVE_FREEIPMI_11X_12X
+@@ -342,7 +342,7 @@
+
+ upsdebugx(1, "entering libfreeipmi_get_psu_info()");
+
+- if (ipmi_fru_parse_multirecord_power_supply_information (fru_parse_ctx,
++ if (ipmi_fru_multirecord_power_supply_information (fru_parse_ctx,
+ areabuf,
+ area_length,
+ &overall_capacity,
+@@ -368,8 +368,8 @@
+ &total_combined_wattage,
+ &predictive_fail_tachometer_lower_threshold) < 0)
+ {
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_multirecord_power_supply_information: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatalx(EXIT_FAILURE, "ipmi_fru_multirecord_power_supply_information: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+ ipmi_dev->overall_capacity = overall_capacity;
+@@ -392,12 +392,12 @@
+ {
+ uint8_t language_code;
+ uint32_t mfg_date_time;
+- ipmi_fru_parse_field_t board_manufacturer;
+- ipmi_fru_parse_field_t board_product_name;
+- ipmi_fru_parse_field_t board_serial_number;
+- ipmi_fru_parse_field_t board_part_number;
+- ipmi_fru_parse_field_t board_fru_file_id;
+- ipmi_fru_parse_field_t board_custom_fields[IPMI_FRU_CUSTOM_FIELDS];
++ ipmi_fru_field_t board_manufacturer;
++ ipmi_fru_field_t board_product_name;
++ ipmi_fru_field_t board_serial_number;
++ ipmi_fru_field_t board_part_number;
++ ipmi_fru_field_t board_fru_file_id;
++ ipmi_fru_field_t board_custom_fields[IPMI_FRU_CUSTOM_FIELDS];
+ const char *string = NULL;
+ time_t timetmp;
+ struct tm mfg_date_time_tm;
+@@ -406,15 +406,15 @@
+ upsdebugx(1, "entering libfreeipmi_get_board_info()");
+
+ /* clear fields */
+- memset (&board_manufacturer, '\0', sizeof (ipmi_fru_parse_field_t));
+- memset (&board_product_name, '\0', sizeof (ipmi_fru_parse_field_t));
+- memset (&board_serial_number, '\0', sizeof (ipmi_fru_parse_field_t));
+- memset (&board_fru_file_id, '\0', sizeof (ipmi_fru_parse_field_t));
++ memset (&board_manufacturer, '\0', sizeof (ipmi_fru_field_t));
++ memset (&board_product_name, '\0', sizeof (ipmi_fru_field_t));
++ memset (&board_serial_number, '\0', sizeof (ipmi_fru_field_t));
++ memset (&board_fru_file_id, '\0', sizeof (ipmi_fru_field_t));
+ memset (&board_custom_fields[0], '\0',
+- sizeof (ipmi_fru_parse_field_t) * IPMI_FRU_CUSTOM_FIELDS);
++ sizeof (ipmi_fru_field_t) * IPMI_FRU_CUSTOM_FIELDS);
+
+ /* parse FRU buffer */
+- if (ipmi_fru_parse_board_info_area (fru_parse_ctx,
++ if (ipmi_fru_board_info_area (fru_parse_ctx,
+ areabuf,
+ area_length,
+ &language_code,
+@@ -428,8 +428,8 @@
+ IPMI_FRU_CUSTOM_FIELDS) < 0)
+ {
+ libfreeipmi_cleanup();
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_board_info_area: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatalx(EXIT_FAILURE, "ipmi_fru_board_info_area: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+
+diff -Nuar nut-2.6.5.orig/m4/nut_check_libfreeipmi.m4 nut-2.6.5/m4/nut_check_libfreeipmi.m4
+--- nut-2.6.5.orig/m4/nut_check_libfreeipmi.m4 2012-07-31 17:38:56.000000000 +0000
++++ nut-2.6.5/m4/nut_check_libfreeipmi.m4 2013-08-12 17:55:03.132363518 +0000
+@@ -66,7 +66,7 @@
+ dnl when version cannot be tested (prior to 1.0.5, with no pkg-config)
+ dnl we have to check for some specific functions
+ AC_SEARCH_LIBS([ipmi_ctx_find_inband], [freeipmi], [], [nut_have_freeipmi=no])
+- AC_SEARCH_LIBS([ipmi_fru_parse_ctx_create], [freeipmi], [], [nut_have_freeipmi=no])
++ AC_SEARCH_LIBS([ipmi_fru_ctx_create], [freeipmi], [], [nut_have_freeipmi=no])
+
+ AC_SEARCH_LIBS([ipmi_monitoring_init], [ipmimonitoring], [nut_have_freeipmi_monitoring=yes], [nut_have_freeipmi_monitoring=no])
+ AC_SEARCH_LIBS([ipmi_monitoring_sensor_read_record_id], [ipmimonitoring], [], [nut_have_freeipmi_monitoring=no])
+diff -Nuar nut-2.6.5.orig/tools/nut-scanner/scan_ipmi.c nut-2.6.5/tools/nut-scanner/scan_ipmi.c
+--- nut-2.6.5.orig/tools/nut-scanner/scan_ipmi.c 2012-07-31 17:38:58.000000000 +0000
++++ nut-2.6.5/tools/nut-scanner/scan_ipmi.c 2013-08-12 17:55:03.132363518 +0000
+@@ -34,24 +34,24 @@
+ static lt_dlhandle dl_handle = NULL;
+ static const char *dl_error = NULL;
+
+-static int (*nut_ipmi_fru_parse_close_device_id) (ipmi_fru_parse_ctx_t ctx);
+-static void (*nut_ipmi_fru_parse_ctx_destroy) (ipmi_fru_parse_ctx_t ctx);
++static int (*nut_ipmi_fru_close_device_id) (ipmi_fru_ctx_t ctx);
++static void (*nut_ipmi_fru_ctx_destroy) (ipmi_fru_ctx_t ctx);
+ #ifdef HAVE_FREEIPMI_11X_12X
+ static void (*nut_ipmi_sdr_ctx_destroy) (ipmi_sdr_ctx_t ctx);
+ #else /* HAVE_FREEIPMI_11X_12X */
+ static void (*nut_ipmi_sdr_cache_ctx_destroy) (ipmi_sdr_cache_ctx_t ctx);
+ static void (*nut_ipmi_sdr_parse_ctx_destroy) (ipmi_sdr_parse_ctx_t ctx);
+ #endif /* HAVE_FREEIPMI_11X_12X */
+-static ipmi_fru_parse_ctx_t (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx_t ipmi_ctx);
+-static int (*nut_ipmi_fru_parse_ctx_set_flags) (ipmi_fru_parse_ctx_t ctx, unsigned int flags);
+-static int (*nut_ipmi_fru_parse_open_device_id) (ipmi_fru_parse_ctx_t ctx, uint8_t fru_device_id);
+-static char * (*nut_ipmi_fru_parse_ctx_errormsg) (ipmi_fru_parse_ctx_t ctx);
+-static int (*nut_ipmi_fru_parse_read_data_area) (ipmi_fru_parse_ctx_t ctx,
++static ipmi_fru_ctx_t (*nut_ipmi_fru_ctx_create) (ipmi_ctx_t ipmi_ctx);
++static int (*nut_ipmi_fru_ctx_set_flags) (ipmi_fru_ctx_t ctx, unsigned int flags);
++static int (*nut_ipmi_fru_open_device_id) (ipmi_fru_ctx_t ctx, uint8_t fru_device_id);
++static char * (*nut_ipmi_fru_ctx_errormsg) (ipmi_fru_ctx_t ctx);
++static int (*nut_ipmi_fru_read_data_area) (ipmi_fru_ctx_t ctx,
+ unsigned int *area_type,
+ unsigned int *area_length,
+ void *areabuf,
+ unsigned int areabuflen);
+-static int (*nut_ipmi_fru_parse_next) (ipmi_fru_parse_ctx_t ctx);
++static int (*nut_ipmi_fru_next) (ipmi_fru_ctx_t ctx);
+ static ipmi_ctx_t (*nut_ipmi_ctx_create) (void);
+ static int (*nut_ipmi_ctx_find_inband) (ipmi_ctx_t ctx,
+ ipmi_driver_type_t *driver_type,
+@@ -92,12 +92,12 @@
+ /* Clear any existing error */
+ lt_dlerror();
+
+- *(void **) (&nut_ipmi_fru_parse_close_device_id) = lt_dlsym(dl_handle, "ipmi_fru_parse_close_device_id");
++ *(void **) (&nut_ipmi_fru_close_device_id) = lt_dlsym(dl_handle, "ipmi_fru_close_device_id");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_destroy");
++ *(void **) (&nut_ipmi_fru_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_fru_ctx_destroy");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+@@ -122,32 +122,32 @@
+ }
+ #endif /* HAVE_FREEIPMI_11X_12X */
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_create) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_create");
++ *(void **) (&nut_ipmi_fru_ctx_create) = lt_dlsym(dl_handle, "ipmi_fru_ctx_create");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_set_flags) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_set_flags");
++ *(void **) (&nut_ipmi_fru_ctx_set_flags) = lt_dlsym(dl_handle, "ipmi_fru_ctx_set_flags");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_open_device_id) = lt_dlsym(dl_handle, "ipmi_fru_parse_open_device_id");
++ *(void **) (&nut_ipmi_fru_open_device_id) = lt_dlsym(dl_handle, "ipmi_fru_open_device_id");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_errormsg) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_errormsg");
++ *(void **) (&nut_ipmi_fru_ctx_errormsg) = lt_dlsym(dl_handle, "ipmi_fru_ctx_errormsg");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_read_data_area) = lt_dlsym(dl_handle, "ipmi_fru_parse_read_data_area");
++ *(void **) (&nut_ipmi_fru_read_data_area) = lt_dlsym(dl_handle, "ipmi_fru_read_data_area");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_next) = lt_dlsym(dl_handle, "ipmi_fru_parse_next");
++ *(void **) (&nut_ipmi_fru_next) = lt_dlsym(dl_handle, "ipmi_fru_next");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+@@ -188,17 +188,17 @@
+
+ /* Cleanup IPMI contexts */
+ #ifdef HAVE_FREEIPMI_11X_12X
+-static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx,
++static void nut_freeipmi_cleanup(ipmi_fru_ctx_t fru_parse_ctx,
+ ipmi_sdr_ctx_t sdr_ctx)
+ #else /* HAVE_FREEIPMI_11X_12X */
+-static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx,
++static void nut_freeipmi_cleanup(ipmi_fru_ctx_t fru_parse_ctx,
+ ipmi_sdr_cache_ctx_t sdr_cache_ctx,
+ ipmi_sdr_parse_ctx_t sdr_parse_ctx)
+ #endif /* HAVE_FREEIPMI_11X_12X */
+ {
+ if (fru_parse_ctx) {
+- (*nut_ipmi_fru_parse_close_device_id) (fru_parse_ctx);
+- (*nut_ipmi_fru_parse_ctx_destroy) (fru_parse_ctx);
++ (*nut_ipmi_fru_close_device_id) (fru_parse_ctx);
++ (*nut_ipmi_fru_ctx_destroy) (fru_parse_ctx);
+ }
+
+ #ifdef HAVE_FREEIPMI_11X_12X
+@@ -226,8 +226,8 @@
+ int ret = -1;
+ unsigned int area_type = 0;
+ unsigned int area_length = 0;
+- uint8_t areabuf[IPMI_FRU_PARSE_AREA_SIZE_MAX+1];
+- ipmi_fru_parse_ctx_t fru_parse_ctx = NULL;
++ uint8_t areabuf[IPMI_FRU_AREA_SIZE_MAX+1];
++ ipmi_fru_ctx_t fru_parse_ctx = NULL;
+ #ifdef HAVE_FREEIPMI_11X_12X
+ ipmi_sdr_ctx_t sdr_ctx = NULL;
+ #else /* HAVE_FREEIPMI_11X_12X */
+@@ -236,14 +236,14 @@
+ #endif /* HAVE_FREEIPMI_11X_12X */
+
+ /* Parse FRU information */
+- if (!(fru_parse_ctx = (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx)))
++ if (!(fru_parse_ctx = (*nut_ipmi_fru_ctx_create) (ipmi_ctx)))
+ {
+- fprintf(stderr, "ipmi_fru_parse_ctx_create()\n");
++ fprintf(stderr, "ipmi_fru_ctx_create()\n");
+ return 0;
+ }
+
+ /* lots of motherboards calculate checksums incorrectly */
+- if ((*nut_ipmi_fru_parse_ctx_set_flags) (fru_parse_ctx, IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
++ if ((*nut_ipmi_fru_ctx_set_flags) (fru_parse_ctx, IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
+ {
+ #ifdef HAVE_FREEIPMI_11X_12X
+ nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
+@@ -253,7 +253,7 @@
+ return 0;
+ }
+
+- if ((*nut_ipmi_fru_parse_open_device_id) (fru_parse_ctx, ipmi_id) < 0)
++ if ((*nut_ipmi_fru_open_device_id) (fru_parse_ctx, ipmi_id) < 0)
+ {
+ #ifdef HAVE_FREEIPMI_11X_12X
+ nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
+@@ -268,14 +268,14 @@
+ /* clear fields */
+ area_type = 0;
+ area_length = 0;
+- memset (areabuf, '\0', IPMI_FRU_PARSE_AREA_SIZE_MAX + 1);
++ memset (areabuf, '\0', IPMI_FRU_AREA_SIZE_MAX + 1);
+
+ /* parse FRU buffer */
+- if ((*nut_ipmi_fru_parse_read_data_area) (fru_parse_ctx,
++ if ((*nut_ipmi_fru_read_data_area) (fru_parse_ctx,
+ &area_type,
+ &area_length,
+ areabuf,
+- IPMI_FRU_PARSE_AREA_SIZE_MAX) < 0)
++ IPMI_FRU_AREA_SIZE_MAX) < 0)
+ {
+ #ifdef HAVE_FREEIPMI_11X_12X
+ nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
+@@ -287,7 +287,7 @@
+
+ if (area_length)
+ {
+- if (area_type == IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION)
++ if (area_type == IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION)
+ {
+ /* Found a POWER_SUPPLY record */
+ #ifdef HAVE_FREEIPMI_11X_12X
+@@ -298,7 +298,7 @@
+ return 1;
+ }
+ }
+- } while ((ret = (*nut_ipmi_fru_parse_next) (fru_parse_ctx)) == 1);
++ } while ((ret = (*nut_ipmi_fru_next) (fru_parse_ctx)) == 1);
+
+ /* No need for further errors checking */
+ #ifdef HAVE_FREEIPMI_11X_12X
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upsd b/sys-power/nut/files/nut-2.6.5-init.d-upsd
new file mode 100755
index 000000000000..4ca7bde9d9f9
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upsd
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/files/nut-2.6.5-init.d-upsd,v 1.1 2013/08/12 18:35:12 robbat2 Exp $
+
+extra_started_commands="reload"
+
+pidfile=/var/lib/nut/upsd.pid
+bin=/usr/sbin/upsd
+
+depend() {
+ use net
+ before upsmon
+ after upsdrv
+}
+
+start() {
+ ebegin "Starting upsd"
+ # clean up first
+ pkill -u root,nut -x ${bin}
+ sleep 1s
+ rm -f ${pidfile}
+ # now start up
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsd"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading upsd"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upslog b/sys-power/nut/files/nut-2.6.5-init.d-upslog
new file mode 100644
index 000000000000..3e5d9b3bf7e7
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upslog
@@ -0,0 +1,31 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/files/nut-2.6.5-init.d-upslog,v 1.1 2013/08/12 18:35:12 robbat2 Exp $
+
+extra_started_commands="reload"
+
+pidfile=/var/run/upslog.pid
+bin=/usr/bin/upslog
+
+depend() {
+ use upsdrv
+ after upsdrv
+}
+
+start() {
+ ebegin "Starting upslog"
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upslog"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+reload() {
+ ebegin "Reloading upslog"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upsmon b/sys-power/nut/files/nut-2.6.5-init.d-upsmon
new file mode 100755
index 000000000000..0c3fb9221214
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upsmon
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/files/nut-2.6.5-init.d-upsmon,v 1.1 2013/08/12 18:35:12 robbat2 Exp $
+
+extra_started_commands="reload"
+
+pidfile=/var/run/upsmon.pid
+bin=/usr/sbin/upsmon
+
+depend() {
+ use net
+}
+
+start() {
+ ebegin "Starting upsmon"
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsmon"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+reload() {
+ ebegin "Reloading upsmon"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/metadata.xml b/sys-power/nut/metadata.xml
index 557ca512951a..a4709d5a95d9 100644
--- a/sys-power/nut/metadata.xml
+++ b/sys-power/nut/metadata.xml
@@ -5,4 +5,7 @@
<email>robbat2@gentoo.org</email>
<name>Robin H. Johnson</name>
</maintainer>
+ <use>
+ <flag name="ipmi">Support IPMI-based UPSes.</flag>
+ </use>
</pkgmetadata>
diff --git a/sys-power/nut/nut-2.6.5-r1.ebuild b/sys-power/nut/nut-2.6.5-r1.ebuild
new file mode 100644
index 000000000000..2a78a4f930a1
--- /dev/null
+++ b/sys-power/nut/nut-2.6.5-r1.ebuild
@@ -0,0 +1,229 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/nut-2.6.5-r1.ebuild,v 1.1 2013/08/12 18:35:11 robbat2 Exp $
+
+EAPI=5
+inherit autotools bash-completion-r1 eutils fixheadtails multilib user systemd
+
+MY_P=${P/_/-}
+
+DESCRIPTION="Network-UPS Tools"
+HOMEPAGE="http://www.networkupstools.org/"
+# Nut mirrors are presently broken
+SRC_URI="http://random.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz
+ http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~x86-fbsd"
+IUSE="avahi cgi ipmi snmp usb ssl tcpd xml"
+
+RDEPEND="avahi? ( net-dns/avahi )
+ cgi? ( >=media-libs/gd-2[png] )
+ snmp? ( net-analyzer/net-snmp )
+ usb? ( virtual/libusb:0 )
+ ssl? ( >=dev-libs/openssl-1 )
+ tcpd? ( sys-apps/tcp-wrappers )
+ xml? ( >=net-libs/neon-0.25.0 )
+ ipmi? ( sys-libs/freeipmi )
+ virtual/udev"
+DEPEND="$RDEPEND
+ >=sys-apps/sed-4
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+# public files should be 644 root:root
+NUT_PUBLIC_FILES="/etc/nut/{ups,upssched}.conf"
+# private files should be 640 root:nut - readable by nut, writeable by root,
+NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
+# public files should be 644 root:root, only installed if USE=cgi
+NUT_CGI_FILES="/etc/nut/{{hosts,upsset}.conf,upsstats{,-single}.html}"
+
+pkg_setup() {
+ enewgroup nut 84
+ enewuser nut 84 -1 /var/lib/nut nut,uucp
+ # As of udev-104, NUT must be in uucp and NOT in tty.
+ gpasswd -d nut tty 2>/dev/null
+ gpasswd -a nut uucp 2>/dev/null
+ # in some cases on old systems it wasn't in the nut group either!
+ gpasswd -a nut nut 2>/dev/null
+ warningmsg ewarn
+}
+
+src_prepare() {
+ ht_fix_file configure.in
+
+ epatch "${FILESDIR}"/${PN}-2.4.1-no-libdummy.patch
+ epatch "${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.3-CVE-2012-2944.patch
+ epatch "${FILESDIR}"/${PN}-2.6.5-freeipmi_fru.patch
+
+ sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
+ -e '/systemdsystemunitdir=.*echo.*sed.*libdir/s,^,#,g' \
+ -i configure.in || die
+
+ sed -e "s:52.nut-usbups.rules:70-nut-usbups.rules:" \
+ -i scripts/udev/Makefile.am || die
+
+ rm -f ltmain.sh m4/lt* m4/libtool.m4
+
+ sed -i \
+ -e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
+ lib/libupsclient{.pc,-config}.in || die #361685
+
+ eautoreconf
+}
+
+src_configure() {
+ local myconf
+
+ if [ -n "${NUT_DRIVERS}" ]; then
+ myconf="${myconf} --with-drivers=${NUT_DRIVERS// /,}"
+ fi
+
+ use cgi && myconf="${myconf} --with-cgipath=/usr/share/nut/cgi"
+
+ # TODO: USE flag for sys-power/powerman
+ econf \
+ --sysconfdir=/etc/nut \
+ --datarootdir=/usr/share/nut \
+ --datadir=/usr/share/nut \
+ --disable-static \
+ --with-statepath=/var/lib/nut \
+ --with-drvpath=/$(get_libdir)/nut \
+ --with-htmlpath=/usr/share/nut/html \
+ --with-user=nut \
+ --with-group=nut \
+ --with-logfacility=LOG_DAEMON \
+ --with-dev \
+ --with-serial \
+ --without-hal \
+ --without-powerman \
+ $(use_with avahi) \
+ $(use_with cgi) \
+ $(use_with ipmi) \
+ $(use_with ipmi freeipmi) \
+ $(use_with snmp) \
+ $(use_with ssl) \
+ $(use_with tcpd wrap) \
+ $(use_with usb) \
+ $(use_with xml neon) \
+ $(systemd_with_unitdir) \
+ ${myconf}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ find "${D}" -name '*.la' -exec rm -f {} +
+
+ dodir /sbin
+ dosym /$(get_libdir)/nut/upsdrvctl /sbin/upsdrvctl
+ # This needs to exist for the scripts
+ dosym /$(get_libdir)/nut/upsdrvctl /usr/sbin/upsdrvctl
+
+ if use cgi; then
+ elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
+ elog "copy them to your web server's ScriptPath to activate (this is a"
+ elog "change from the old location)."
+ elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
+ fi
+
+ # this must be done after all of the install phases
+ for i in "${D}"/etc/nut/*.sample ; do
+ mv "${i}" "${i/.sample/}"
+ done
+
+ dodoc AUTHORS ChangeLog docs/*.txt MAINTAINERS NEWS README TODO UPGRADING || die
+
+ newdoc lib/README README.lib || die
+ newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf || die
+
+ docinto cables
+ dodoc docs/cables/* || die
+
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsd upsd || die
+ newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog || die
+ newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail || die
+
+ keepdir /var/lib/nut
+
+ einfo "Setting up permissions on files and directories"
+ fperms 0700 /var/lib/nut
+ fowners nut:nut /var/lib/nut
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0640 ${NUT_PRIVATE_FILES}
+ eval fowners root:nut ${NUT_PRIVATE_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0644 ${NUT_PUBLIC_FILES}
+ eval fowners root:root ${NUT_PUBLIC_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval fperms 0644 ${NUT_CGI_FILES}
+ eval fowners root:root ${NUT_CGI_FILES}
+ fi
+
+ # this is installed for 2.4 and fbsd guys
+ if ! has_version virtual/udev; then
+ einfo "Installing non-udev hotplug support"
+ insinto /etc/hotplug/usb
+ insopts -m 755
+ doins scripts/hotplug/nut-usbups.hotplug
+ fi
+
+ dobashcomp "${S}"/scripts/misc/nut.bash_completion
+}
+
+pkg_postinst() {
+ # this is to ensure that everybody that installed old versions still has
+ # correct permissions
+
+ chown nut:nut "${ROOT}"/var/lib/nut 2>/dev/null
+ chmod 0700 "${ROOT}"/var/lib/nut 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:nut "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+ eval chmod 0640 "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:root "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval chown root:root "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ fi
+
+ warningmsg elog
+}
+
+warningmsg() {
+ msgfunc="$1"
+ [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
+ ${msgfunc} "Please note that NUT now runs under the 'nut' user."
+ ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
+ ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
+ ${msgfunc} "hotplug rules that are installed, and alter them suitably."
+ ${msgfunc} ''
+ ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
+ ${msgfunc} ''
+ ${msgfunc} "Please note that upsdrv is NOT automatically started by upsd anymore."
+ ${msgfunc} "If you have multiple UPS units, you can use their NUT names to"
+ ${msgfunc} "have a service per UPS:"
+ ${msgfunc} "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
+ ${msgfunc} ''
+ ${msgfunc} 'If you want apcupsd to power off your UPS when it'
+ ${msgfunc} 'shuts down your system in a power failure, you must'
+ ${msgfunc} 'add nut.powerfail to your shutdown runlevel:'
+ ${msgfunc} ''
+ ${msgfunc} 'rc-update add nut.powerfail shutdown'
+ ${msgfunc} ''
+
+}