summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2012-07-29 02:46:27 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2012-07-29 02:46:27 +0000
commite382abc0e0e6ca9686d5fddfb74ad1e0564996e6 (patch)
tree1076600cdd7f26f41c9f5626fc41909d25813e75
parentresolve DESCRIPTION issue wrt bug #428304 (diff)
downloadgentoo-2-e382abc0e0e6ca9686d5fddfb74ad1e0564996e6.tar.gz
gentoo-2-e382abc0e0e6ca9686d5fddfb74ad1e0564996e6.tar.bz2
gentoo-2-e382abc0e0e6ca9686d5fddfb74ad1e0564996e6.zip
Backport the threshold patch from upstream.
(Portage version: 2.2.0_alpha120/cvs/Linux x86_64)
-rw-r--r--sys-libs/freeipmi/ChangeLog8
-rw-r--r--sys-libs/freeipmi/files/freeipmi-1.1.6-thresholds.patch454
-rw-r--r--sys-libs/freeipmi/freeipmi-1.1.6-r1.ebuild74
3 files changed, 535 insertions, 1 deletions
diff --git a/sys-libs/freeipmi/ChangeLog b/sys-libs/freeipmi/ChangeLog
index 8fd0d2f11650..4ef207c66079 100644
--- a/sys-libs/freeipmi/ChangeLog
+++ b/sys-libs/freeipmi/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-libs/freeipmi
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/freeipmi/ChangeLog,v 1.50 2012/07/05 14:23:43 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/freeipmi/ChangeLog,v 1.51 2012/07/29 02:46:27 flameeyes Exp $
+
+*freeipmi-1.1.6-r1 (29 Jul 2012)
+
+ 29 Jul 2012; Diego E. Pettenò <flameeyes@gentoo.org>
+ +files/freeipmi-1.1.6-thresholds.patch, +freeipmi-1.1.6-r1.ebuild:
+ Backport the threshold patch from upstream.
05 Jul 2012; Diego E. Pettenò <flameeyes@gentoo.org>
-files/freeipmi-1.0.5-strictaliasing.patch, -freeipmi-1.0.8.ebuild,
diff --git a/sys-libs/freeipmi/files/freeipmi-1.1.6-thresholds.patch b/sys-libs/freeipmi/files/freeipmi-1.1.6-thresholds.patch
new file mode 100644
index 000000000000..f3a74c68461c
--- /dev/null
+++ b/sys-libs/freeipmi/files/freeipmi-1.1.6-thresholds.patch
@@ -0,0 +1,454 @@
+commit 9f1ac701f28d32eae557590da324f58bc83077dc
+Author: chu11 <chu11@f7bdd6f0-feb3-4745-876d-a5d75e847258>
+Date: Sat Jul 28 06:50:54 2012 +0000
+
+ support --output-sensor-thresholds in ipmi-senosrs
+
+ git-svn-id: svn://svn.savannah.gnu.org/freeipmi/branches/ipmisensorsoutputthreshold@9392 f7bdd6f0-feb3-4745-876d-a5d75e847258
+
+diff --git a/ChangeLog b/ChangeLog
+index 2573c83..61a6ae6 100644
+diff --git a/NEWS b/NEWS
+index 84c77ba..4746148 100644
+diff --git a/common/toolcommon/tool-config-file-common.c b/common/toolcommon/tool-config-file-common.c
+index 27974ea..7ba77ee 100644
+--- a/common/toolcommon/tool-config-file-common.c
++++ b/common/toolcommon/tool-config-file-common.c
+@@ -3592,7 +3592,6 @@ config_file_parse (const char *filename,
+ &(ipmi_sensors_data.sensor_state_config_file),
+ 0
+ },
+-
+ {
+ "ipmi-sensors-entity-sensor-names",
+ CONFFILE_OPTION_BOOL,
+@@ -3605,6 +3604,17 @@ config_file_parse (const char *filename,
+ 0,
+ },
+ {
++ "ipmi-sensors-output-sensor-thresholds",
++ CONFFILE_OPTION_BOOL,
++ -1,
++ _config_file_bool,
++ 1,
++ 0,
++ &(ipmi_sensors_data.output_sensor_thresholds_count),
++ &(ipmi_sensors_data.output_sensor_thresholds),
++ 0,
++ },
++ {
+ "ipmi-sensors-no-sensor-type-output",
+ CONFFILE_OPTION_BOOL,
+ -1,
+diff --git a/common/toolcommon/tool-config-file-common.h b/common/toolcommon/tool-config-file-common.h
+index 219ff2a..06ec454 100644
+--- a/common/toolcommon/tool-config-file-common.h
++++ b/common/toolcommon/tool-config-file-common.h
+@@ -229,6 +229,8 @@ struct config_file_data_ipmi_sensors
+ int output_sensor_state_count;
+ char *sensor_state_config_file;
+ int sensor_state_config_file_count;
++ int output_sensor_thresholds;
++ int output_sensor_thresholds_count;
+ int no_sensor_type_output;
+ int no_sensor_type_output_count;
+ int comma_separated_output_count;
+diff --git a/etc/freeipmi.conf b/etc/freeipmi.conf
+index eafe147..9d99116 100644
+--- a/etc/freeipmi.conf
++++ b/etc/freeipmi.conf
+@@ -472,6 +472,8 @@
+ #
+ # ipmi-sensors-entity-sensor-names DISABLE
+ #
++# ipmi-sensors-output-sensor-thresholds DISABLE
++#
+ # ipmi-sensors-no-sensor-type-output DISABLE
+ #
+ # ipmi-sensors-comma-separated-output DISABLE
+diff --git a/ipmi-sensors/ipmi-sensors-argp.c b/ipmi-sensors/ipmi-sensors-argp.c
+index 455f316..28836e0 100644
+--- a/ipmi-sensors/ipmi-sensors-argp.c
++++ b/ipmi-sensors/ipmi-sensors-argp.c
+@@ -127,19 +127,21 @@ static struct argp_option cmdline_options[] =
+ "Specify an alternate sensor state configuration file.", 52},
+ { "entity-sensor-names", ENTITY_SENSOR_NAMES_KEY, NULL, 0,
+ "Output sensor names with entity ids and instances.", 53},
++ { "output-sensor-thresholds", OUTPUT_SENSOR_THRESHOLDS_KEY, NULL, 0,
++ "Output sensor thresholds in output.", 54},
+ { "no-sensor-type-output", NO_SENSOR_TYPE_OUTPUT_KEY, 0, 0,
+- "Do not show sensor type output.", 54},
++ "Do not show sensor type output.", 55},
+ { "comma-separated-output", COMMA_SEPARATED_OUTPUT_KEY, 0, 0,
+- "Output fields in comma separated format.", 55},
++ "Output fields in comma separated format.", 56},
+ { "no-header-output", NO_HEADER_OUTPUT_KEY, 0, 0,
+- "Do not output column headers.", 56},
++ "Do not output column headers.", 57},
+ { "non-abbreviated-units", NON_ABBREVIATED_UNITS_KEY, 0, 0,
+- "Output non-abbreviated units (e.g. 'Amps' insetead of 'A').", 57},
++ "Output non-abbreviated units (e.g. 'Amps' insetead of 'A').", 58},
+ { "legacy-output", LEGACY_OUTPUT_KEY, 0, 0,
+- "Output in legacy format.", 58},
++ "Output in legacy format.", 59},
+ /* ipmimonitoring legacy support */
+ { "ipmimonitoring-legacy-output", IPMIMONITORING_LEGACY_OUTPUT_KEY, 0, 0,
+- "Output in ipmimonitoring legacy format.", 58},
++ "Output in ipmimonitoring legacy format.", 60},
+ { NULL, 0, NULL, 0, NULL, 0}
+ };
+
+@@ -294,6 +296,9 @@ cmdline_parse (int key, char *arg, struct argp_state *state)
+ case ENTITY_SENSOR_NAMES_KEY:
+ cmd_args->entity_sensor_names = 1;
+ break;
++ case OUTPUT_SENSOR_THRESHOLDS_KEY:
++ cmd_args->output_sensor_thresholds = 1;
++ break;
+ case NO_SENSOR_TYPE_OUTPUT_KEY:
+ cmd_args->no_sensor_type_output = 1;
+ break;
+@@ -415,6 +420,8 @@ _ipmi_sensors_config_file_parse (struct ipmi_sensors_arguments *cmd_args)
+ cmd_args->sensor_state_config_file = config_file_data.sensor_state_config_file;
+ if (config_file_data.entity_sensor_names_count)
+ cmd_args->entity_sensor_names = config_file_data.entity_sensor_names;
++ if (config_file_data.output_sensor_thresholds_count)
++ cmd_args->output_sensor_thresholds = config_file_data.output_sensor_thresholds;
+ if (config_file_data.no_sensor_type_output_count)
+ cmd_args->no_sensor_type_output = config_file_data.no_sensor_type_output;
+ if (config_file_data.comma_separated_output_count)
+@@ -497,6 +504,7 @@ ipmi_sensors_argp_parse (int argc, char **argv, struct ipmi_sensors_arguments *c
+ cmd_args->output_sensor_state = 0;
+ cmd_args->sensor_state_config_file = NULL;
+ cmd_args->entity_sensor_names = 0;
++ cmd_args->output_sensor_thresholds = 0;
+ cmd_args->no_sensor_type_output = 0;
+ cmd_args->comma_separated_output = 0;
+ cmd_args->no_header_output = 0;
+diff --git a/ipmi-sensors/ipmi-sensors-simple-output.c b/ipmi-sensors/ipmi-sensors-simple-output.c
+index 07ef472..8314b18 100644
+--- a/ipmi-sensors/ipmi-sensors-simple-output.c
++++ b/ipmi-sensors/ipmi-sensors-simple-output.c
+@@ -683,6 +683,12 @@ _simple_output_full_record (ipmi_sensors_state_data_t *state_data,
+ {
+ char fmt[IPMI_SENSORS_FMT_BUFLEN + 1];
+ uint8_t event_reading_type_code;
++ double *lower_non_critical_threshold = NULL;
++ double *upper_non_critical_threshold = NULL;
++ double *lower_critical_threshold = NULL;
++ double *upper_critical_threshold = NULL;
++ double *lower_non_recoverable_threshold = NULL;
++ double *upper_non_recoverable_threshold = NULL;
+ int rv = -1;
+
+ assert (state_data);
+@@ -760,6 +766,100 @@ _simple_output_full_record (ipmi_sensors_state_data_t *state_data,
+ }
+ }
+
++ if (state_data->prog_data->args->output_sensor_thresholds)
++ {
++ char thresholdfmt[IPMI_SENSORS_FMT_BUFLEN + 1];
++ char nafmt[IPMI_SENSORS_FMT_BUFLEN + 1];
++
++ if (ipmi_sensors_get_thresholds (state_data,
++ sdr_record,
++ sdr_record_len,
++ &lower_non_critical_threshold,
++ &lower_critical_threshold,
++ &lower_non_recoverable_threshold,
++ &upper_non_critical_threshold,
++ &upper_critical_threshold,
++ &upper_non_recoverable_threshold) < 0)
++ goto cleanup;
++
++ memset (fmt, '\0', IPMI_SENSORS_FMT_BUFLEN + 1);
++
++ if (state_data->prog_data->args->comma_separated_output)
++ {
++ snprintf (thresholdfmt,
++ IPMI_SENSORS_FMT_BUFLEN,
++ ",%%.2f");
++
++ snprintf (nafmt,
++ IPMI_SENSORS_FMT_BUFLEN,
++ ",%%s");
++ }
++ else
++ {
++ snprintf (thresholdfmt,
++ IPMI_SENSORS_FMT_BUFLEN,
++ " | %%-10.2f");
++
++ snprintf (nafmt,
++ IPMI_SENSORS_FMT_BUFLEN,
++ " | %%-10s");
++ }
++
++ if (lower_non_recoverable_threshold)
++ pstdout_printf (state_data->pstate,
++ thresholdfmt,
++ *lower_non_recoverable_threshold);
++ else
++ pstdout_printf (state_data->pstate,
++ nafmt,
++ IPMI_SENSORS_NA_STRING);
++
++ if (lower_critical_threshold)
++ pstdout_printf (state_data->pstate,
++ thresholdfmt,
++ *lower_critical_threshold);
++ else
++ pstdout_printf (state_data->pstate,
++ nafmt,
++ IPMI_SENSORS_NA_STRING);
++
++ if (lower_non_critical_threshold)
++ pstdout_printf (state_data->pstate,
++ thresholdfmt,
++ *lower_non_critical_threshold);
++ else
++ pstdout_printf (state_data->pstate,
++ nafmt,
++ IPMI_SENSORS_NA_STRING);
++
++ if (upper_non_critical_threshold)
++ pstdout_printf (state_data->pstate,
++ thresholdfmt,
++ *upper_non_critical_threshold);
++ else
++ pstdout_printf (state_data->pstate,
++ nafmt,
++ IPMI_SENSORS_NA_STRING);
++
++ if (upper_critical_threshold)
++ pstdout_printf (state_data->pstate,
++ thresholdfmt,
++ *upper_critical_threshold);
++ else
++ pstdout_printf (state_data->pstate,
++ nafmt,
++ IPMI_SENSORS_NA_STRING);
++
++ if (upper_non_recoverable_threshold)
++ pstdout_printf (state_data->pstate,
++ thresholdfmt,
++ *upper_non_recoverable_threshold);
++ else
++ pstdout_printf (state_data->pstate,
++ nafmt,
++ IPMI_SENSORS_NA_STRING);
++ }
++
+ if (state_data->prog_data->args->comma_separated_output)
+ pstdout_printf (state_data->pstate, ",");
+ else
+@@ -799,11 +897,11 @@ _simple_output_full_record (ipmi_sensors_state_data_t *state_data,
+ if (state_data->prog_data->args->comma_separated_output)
+ snprintf (fmt,
+ IPMI_SENSORS_FMT_BUFLEN,
+- ",%%.2f,%%s,");
++ ",%%.2f,%%s");
+ else
+ snprintf (fmt,
+ IPMI_SENSORS_FMT_BUFLEN,
+- " | %%-10.2f | %%-%ds | ",
++ " | %%-10.2f | %%-%ds",
+ state_data->column_width.sensor_units);
+
+ pstdout_printf (state_data->pstate,
+@@ -818,11 +916,11 @@ _simple_output_full_record (ipmi_sensors_state_data_t *state_data,
+ if (state_data->prog_data->args->comma_separated_output)
+ snprintf (fmt,
+ IPMI_SENSORS_FMT_BUFLEN,
+- ",%%s,%%s,");
++ ",%%s,%%s");
+ else
+ snprintf (fmt,
+ IPMI_SENSORS_FMT_BUFLEN,
+- " | %%-10s | %%-%ds | ",
++ " | %%-10s | %%-%ds",
+ state_data->column_width.sensor_units);
+
+ pstdout_printf (state_data->pstate,
+@@ -831,13 +929,33 @@ _simple_output_full_record (ipmi_sensors_state_data_t *state_data,
+ IPMI_SENSORS_NA_STRING);
+ }
+ }
+- else
++
++ if (state_data->prog_data->args->output_sensor_thresholds)
+ {
+ if (state_data->prog_data->args->comma_separated_output)
++ pstdout_printf (state_data->pstate,
++ ",%s,%s,%s,%s,%s,%s",
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING);
++ else
++ pstdout_printf (state_data->pstate,
++ " | %-10s | %-10s | %-10s | %-10s | %-10s | %-10s",
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING);
++ }
++
++ if (state_data->prog_data->args->comma_separated_output)
+ pstdout_printf (state_data->pstate, ",");
+ else
+ pstdout_printf (state_data->pstate, " | ");
+- }
+
+ if (ipmi_sensors_output_event_message_list (state_data,
+ event_message_output_type,
+@@ -852,6 +970,12 @@ _simple_output_full_record (ipmi_sensors_state_data_t *state_data,
+
+ rv = 0;
+ cleanup:
++ free (lower_non_critical_threshold);
++ free (upper_non_critical_threshold);
++ free (lower_critical_threshold);
++ free (upper_critical_threshold);
++ free (lower_non_recoverable_threshold);
++ free (upper_non_recoverable_threshold);
+ return (rv);
+ }
+
+@@ -883,11 +1007,11 @@ _simple_output_compact_record (ipmi_sensors_state_data_t *state_data,
+ if (state_data->prog_data->args->comma_separated_output)
+ snprintf (fmt,
+ IPMI_SENSORS_FMT_BUFLEN,
+- ",%%s,%%s,");
++ ",%%s,%%s");
+ else
+ snprintf (fmt,
+ IPMI_SENSORS_FMT_BUFLEN,
+- " | %%-10s | %%-%ds | ",
++ " | %%-10s | %%-%ds",
+ state_data->column_width.sensor_units);
+
+ pstdout_printf (state_data->pstate,
+@@ -895,13 +1019,33 @@ _simple_output_compact_record (ipmi_sensors_state_data_t *state_data,
+ IPMI_SENSORS_NA_STRING,
+ IPMI_SENSORS_NA_STRING);
+ }
+- else
++
++ if (state_data->prog_data->args->output_sensor_thresholds)
+ {
+ if (state_data->prog_data->args->comma_separated_output)
++ pstdout_printf (state_data->pstate,
++ ",%s,%s,%s,%s,%s,%s",
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING);
++ else
++ pstdout_printf (state_data->pstate,
++ " | %-10s | %-10s | %-10s | %-10s | %-10s | %-10s",
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING,
++ IPMI_SENSORS_NA_STRING);
++ }
++
++ if (state_data->prog_data->args->comma_separated_output)
+ pstdout_printf (state_data->pstate, ",");
+ else
+ pstdout_printf (state_data->pstate, " | ");
+- }
+
+ if (ipmi_sensors_output_event_message_list (state_data,
+ event_message_output_type,
+@@ -1027,6 +1171,16 @@ _output_headers (ipmi_sensors_state_data_t *state_data)
+ SENSORS_HEADER_UNITS_STR);
+ }
+
++ if (state_data->prog_data->args->output_sensor_thresholds)
++ {
++ if (state_data->prog_data->args->comma_separated_output)
++ pstdout_printf (state_data->pstate,
++ ",Lower NR,Lower C,Lower NC,Upper NC,Upper C,Upper NR");
++ else
++ pstdout_printf (state_data->pstate,
++ " | Lower NR | Lower C | Lower NC | Upper NC | Upper C | Upper NR ");
++ }
++
+ if (state_data->prog_data->args->comma_separated_output)
+ pstdout_printf (state_data->pstate,
+ ",%s\n",
+diff --git a/ipmi-sensors/ipmi-sensors.h b/ipmi-sensors/ipmi-sensors.h
+index bfc246e..e385510 100644
+--- a/ipmi-sensors/ipmi-sensors.h
++++ b/ipmi-sensors/ipmi-sensors.h
+@@ -51,12 +51,13 @@ enum ipmi_sensors_argp_option_keys
+ OUTPUT_SENSOR_STATE_KEY = 169,
+ SENSOR_STATE_CONFIG_FILE_KEY = 170,
+ ENTITY_SENSOR_NAMES_KEY = 171,
+- NO_SENSOR_TYPE_OUTPUT_KEY = 172,
+- COMMA_SEPARATED_OUTPUT_KEY = 173,
+- NO_HEADER_OUTPUT_KEY = 174,
+- NON_ABBREVIATED_UNITS_KEY = 175,
+- LEGACY_OUTPUT_KEY = 176,
+- IPMIMONITORING_LEGACY_OUTPUT_KEY = 177,
++ OUTPUT_SENSOR_THRESHOLDS_KEY = 172,
++ NO_SENSOR_TYPE_OUTPUT_KEY = 173,
++ COMMA_SEPARATED_OUTPUT_KEY = 174,
++ NO_HEADER_OUTPUT_KEY = 175,
++ NON_ABBREVIATED_UNITS_KEY = 176,
++ LEGACY_OUTPUT_KEY = 177,
++ IPMIMONITORING_LEGACY_OUTPUT_KEY = 178,
+ };
+
+ struct ipmi_sensors_arguments
+@@ -83,6 +84,7 @@ struct ipmi_sensors_arguments
+ int output_sensor_state;
+ char *sensor_state_config_file;
+ int entity_sensor_names;
++ int output_sensor_thresholds;
+ int no_sensor_type_output;
+ int comma_separated_output;
+ int no_header_output;
+diff --git a/man/freeipmi.conf.5.pre.in b/man/freeipmi.conf.5.pre.in
+index 9b4bf96..af1047f 100644
+--- a/man/freeipmi.conf.5.pre.in
++++ b/man/freeipmi.conf.5.pre.in
+@@ -1184,6 +1184,11 @@ Specify the default sensor state configuration file.
+ Specify if output of sensor names should include entity ids and
+ instances by default or not.
+ .TP
++\fBipmi\-sensors\-output\-sensor\-thresholds\fR \fIENABLE|DISABLE\fR
++Specify if
++.B ipmi-sensors
++should output sensor thresholds by default.
++.TP
+ \fBipmi\-sensors\-no\-sensor\-type\-output\fR \fIENABLE|DISABLE\fR
+ Specify if output of the sensor type should be output by default or
+ not.
+diff --git a/man/ipmi-sensors.8.pre.in b/man/ipmi-sensors.8.pre.in
+index d0950d0..bcd13f7 100644
+--- a/man/ipmi-sensors.8.pre.in
++++ b/man/ipmi-sensors.8.pre.in
+@@ -156,6 +156,12 @@ previously output by
+ Specify an alternate sensor state configuration file. Option ignored
+ if \fB\-\-output\-sensor\-state\fR not specified.
+ #include <@top_srcdir@/man/manpage-common-entity-sensor-names.man>
++.TP
++\fB\-\-output\-sensor\-thresholds\fR
++Output sensor thresholds in output. This will add columns to the
++default output for lower non-recoverable, lower critical, lower
++non-critical, upper non-critical, upper critical, and upper
++non-recoverable thresholds.
+ #include <@top_srcdir@/man/manpage-common-no-sensor-type-output.man>
+ #include <@top_srcdir@/man/manpage-common-comma-separated-output.man>
+ #include <@top_srcdir@/man/manpage-common-no-header-output.man>
diff --git a/sys-libs/freeipmi/freeipmi-1.1.6-r1.ebuild b/sys-libs/freeipmi/freeipmi-1.1.6-r1.ebuild
new file mode 100644
index 000000000000..abf66f6c45df
--- /dev/null
+++ b/sys-libs/freeipmi/freeipmi-1.1.6-r1.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/freeipmi/freeipmi-1.1.6-r1.ebuild,v 1.1 2012/07/29 02:46:27 flameeyes Exp $
+
+EAPI=4
+
+inherit autotools eutils
+
+DESCRIPTION="Provides Remote-Console and System Management Software as per IPMI v1.5/2.0"
+HOMEPAGE="http://www.gnu.org/software/freeipmi/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz
+ http://ftp.gluster.com/pub/${PN}/${PV}/${P}.tar.gz"
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug"
+
+RDEPEND="dev-libs/libgcrypt"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+RDEPEND="${RDEPEND}
+ sys-apps/openrc"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.1.1-strictaliasing.patch
+ epatch "${FILESDIR}"/${P}-thresholds.patch
+
+ AT_M4DIR="config" eautoreconf
+}
+
+src_configure() {
+ econf \
+ $(use_enable debug) \
+ --disable-dependency-tracking \
+ --enable-fast-install \
+ --disable-static \
+ --disable-init-scripts \
+ --enable-logrotate-config \
+ --localstatedir=/var
+}
+
+# There are no tests
+src_test() { :; }
+
+src_install() {
+ emake DESTDIR="${D}" docdir="/usr/share/doc/${PF}" install
+ find "${D}" -name '*.la' -delete
+
+ # freeipmi by defaults install _all_ commands to /usr/sbin, but
+ # quite a few can be run remotely as standard user, so move them
+ # in /usr/bin afterwards.
+ dodir /usr/bin
+ for file in ipmi{detect,ping,power,console}; do
+ mv "${D}"/usr/{s,}bin/${file} || die
+
+ # The default install symlinks these commands to add a dash
+ # after the ipmi prefix; we repeat those after move for
+ # consistency.
+ rm "${D}"/usr/sbin/${file/ipmi/ipmi-}
+ dosym ${file} /usr/bin/${file/ipmi/ipmi-}
+ done
+
+ dodoc AUTHORS ChangeLog* DISCLAIMER* NEWS README* TODO doc/*.txt
+
+ keepdir \
+ /var/cache/ipmimonitoringsdrcache \
+ /var/lib/freeipmi \
+ /var/log/{freeipmi,ipmiconsole}
+
+ newinitd "${FILESDIR}"/ipmidetectd.initd.3 ipmidetectd
+
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.3 bmc-watchdog
+ newconfd "${FILESDIR}"/bmc-watchdog.confd bmc-watchdog
+}