summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2011-08-22 14:27:25 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2011-08-22 14:27:25 +0000
commit1c0be7c5969c9827c2a774af48615dafb0df91ba (patch)
treed254170eb6bc15bce5a8a2792a1a81f69acebf1b /sys-power
parentMark stable on AMD64 based on arch testing by Agostino "ago" Sarubbo & Ian "i... (diff)
downloadgentoo-2-1c0be7c5969c9827c2a774af48615dafb0df91ba.tar.gz
gentoo-2-1c0be7c5969c9827c2a774af48615dafb0df91ba.tar.bz2
gentoo-2-1c0be7c5969c9827c2a774af48615dafb0df91ba.zip
Version bump, require openrc, fix aliasing issues; increase wait timeout to 3 seconds, rather than 1.5, as it can still fail to start.
(Portage version: 2.2.0_alpha51/cvs/Linux x86_64)
Diffstat (limited to 'sys-power')
-rw-r--r--sys-power/apcupsd/ChangeLog9
-rw-r--r--sys-power/apcupsd/apcupsd-3.14.9.ebuild124
-rw-r--r--sys-power/apcupsd/files/apcupsd-3.14.9-aliasing.patch39
-rw-r--r--sys-power/apcupsd/files/apcupsd.init.26
4 files changed, 174 insertions, 4 deletions
diff --git a/sys-power/apcupsd/ChangeLog b/sys-power/apcupsd/ChangeLog
index 33256679cb4a..d8e6f727c184 100644
--- a/sys-power/apcupsd/ChangeLog
+++ b/sys-power/apcupsd/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for sys-power/apcupsd
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/ChangeLog,v 1.70 2011/06/15 16:05:51 cardoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/ChangeLog,v 1.71 2011/08/22 14:27:25 flameeyes Exp $
+
+*apcupsd-3.14.9 (22 Aug 2011)
+
+ 22 Aug 2011; Diego E. Pettenò <flameeyes@gentoo.org> +apcupsd-3.14.9.ebuild,
+ +files/apcupsd-3.14.9-aliasing.patch, files/apcupsd.init.2:
+ Version bump, require openrc, fix aliasing issues; increase wait timeout to 3
+ seconds, rather than 1.5, as it can still fail to start.
15 Jun 2011; Doug Goldstein <cardoe@gentoo.org> apcupsd-3.14.8-r1.ebuild:
Set USB to be the default mode since all APC products in recent times use the
diff --git a/sys-power/apcupsd/apcupsd-3.14.9.ebuild b/sys-power/apcupsd/apcupsd-3.14.9.ebuild
new file mode 100644
index 000000000000..ccc6d6418408
--- /dev/null
+++ b/sys-power/apcupsd/apcupsd-3.14.9.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/apcupsd-3.14.9.ebuild,v 1.1 2011/08/22 14:27:25 flameeyes Exp $
+
+EAPI=4
+
+inherit eutils linux-info flag-o-matic
+
+DESCRIPTION="APC UPS daemon with integrated tcp/ip remote shutdown"
+HOMEPAGE="http://www.apcupsd.org/"
+SRC_URI="mirror://sourceforge/apcupsd/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~x86-fbsd"
+IUSE="snmp +usb cgi nls gnome kernel_linux"
+
+DEPEND="
+ cgi? ( >=media-libs/gd-1.8.4 )
+ nls? ( sys-devel/gettext )
+ snmp? ( net-analyzer/net-snmp )
+ gnome? ( >=x11-libs/gtk+-2.4.0:2
+ dev-libs/glib:2
+ >=gnome-base/gconf-2.0 )"
+RDEPEND="${DEPEND}
+ sys-apps/openrc
+ virtual/mailx"
+
+CONFIG_CHECK="~USB_HIDDEV ~HIDRAW"
+ERROR_USB_HIDDEV="CONFIG_USB_HIDDEV: needed to access USB-attached UPSes"
+ERROR_HIDRAW="CONFIG_HIDRAW: needed to access USB-attached UPSes"
+
+pkg_setup() {
+ if use kernel_linux && use usb && linux_config_exists; then
+ check_extra_config
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}-aliasing.patch"
+}
+
+src_configure() {
+ local myconf
+ use cgi && myconf="${myconf} --enable-cgi --with-cgi-bin=/usr/libexec/${PN}/cgi-bin"
+ if use usb; then
+ myconf="${myconf} --with-upstype=usb --with-upscable=usb --enable-usb --with-dev= "
+ else
+ myconf="${myconf} --with-upstype=apcsmart --with-upscable=smart --disable-usb"
+ fi
+
+ # We force the DISTNAME to gentoo so it will use gentoo's layout also
+ # when installed on non-linux systems.
+ econf \
+ --sbindir=/sbin \
+ --sysconfdir=/etc/apcupsd \
+ --with-pwrfail-dir=/etc/apcupsd \
+ --with-lock-dir=/var/lock \
+ --with-pid-dir=/var/run \
+ --with-log-dir=/var/log \
+ --with-nis-port=3551 \
+ --enable-net --enable-pcnet \
+ --with-distname=gentoo \
+ $(use_enable snmp net-snmp) \
+ $(use_enable gnome gapcmon) \
+ ${myconf} \
+ APCUPSD_MAIL=/bin/mail
+}
+
+src_compile() {
+ # Workaround for bug #280674; upstream should really just provide
+ # the text files in the distribution, but I wouldn't count on them
+ # doing that anytime soon.
+ MANPAGER=$(type -p cat) \
+ emake || die "emake failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "installed failed"
+ rm -f "${D}"/etc/init.d/halt
+
+ insinto /etc/apcupsd
+ newins examples/safe.apccontrol safe.apccontrol
+
+ dodoc ChangeLog* ReleaseNotes
+ doman doc/*.8 doc/*.5
+
+ dohtml -r doc/manual/*
+
+ rm "${D}"/etc/init.d/apcupsd
+ newinitd "${FILESDIR}/${PN}.init.2" "${PN}"
+ newinitd "${FILESDIR}/${PN}.powerfail.init" "${PN}".powerfail
+
+ # remove hal settings, we don't really want to have it around still.
+ rm -r "${D}"/usr/share/hal
+
+ # Without this it'll crash at startup. When merging in ROOT= this
+ # won't be created by default, so we want to make sure we got it!
+ keepdir /var/lock
+ fowners root:uucp /var/lock
+ fperms 0775 /var/lock
+}
+
+pkg_postinst() {
+ if use cgi; then
+ elog "The cgi-bin directory for ${PN} is /usr/libexec/${PN}/cgi-bin."
+ elog "Set up your ScriptAlias or symbolic links accordingly."
+ fi
+
+ elog ""
+ elog "Since version 3.14.0 you can use multiple apcupsd instances to"
+ elog "control more than one UPS in a single box."
+ elog "To do this, create a link between /etc/init.d/apcupsd to a new"
+ elog "/etc/init.d/apcupsd.something, and it will then load the"
+ elog "configuration file at /etc/apcupsd/something.conf."
+ elog ""
+
+ elog 'If you want apcupsd to power off your UPS when it'
+ elog 'shuts down your system in a power failure, you must'
+ elog 'add apcupsd.powerfail to your shutdown runlevel:'
+ elog ''
+ elog ' \e[01m rc-update add apcupsd.powerfail shutdown \e[0m'
+ elog ''
+}
diff --git a/sys-power/apcupsd/files/apcupsd-3.14.9-aliasing.patch b/sys-power/apcupsd/files/apcupsd-3.14.9-aliasing.patch
new file mode 100644
index 000000000000..09d9883a22f2
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd-3.14.9-aliasing.patch
@@ -0,0 +1,39 @@
+Index: apcupsd-3.14.9/src/apctest.c
+===================================================================
+--- apcupsd-3.14.9.orig/src/apctest.c
++++ apcupsd-3.14.9/src/apctest.c
+@@ -2206,18 +2206,18 @@ static struct {
+ const char *config_directive;
+ const char *descript;
+ char type;
+- int *data;
++ void *data;
+ } cmd_table[] = {
+ {'u', "HITRANSFER", "Upper transfer voltage", 'i', &eeprom_ups.hitrans},
+ {'l', "LOTRANSFER", "Lower transfer voltage", 'i', &eeprom_ups.lotrans},
+ {'e', "RETURNCHARGE", "Return threshold", 'i', &eeprom_ups.rtnpct},
+ {'o', "OUTPUTVOLTS", "Output voltage on batts", 'i', &eeprom_ups.NomOutputVoltage},
+- {'s', "SENSITIVITY", "Sensitivity", 'c', (int *)eeprom_ups.sensitivity},
++ {'s', "SENSITIVITY", "Sensitivity", 'c', eeprom_ups.sensitivity},
+ {'q', "LOWBATT", "Low battery warning", 'i', &eeprom_ups.dlowbatt},
+ {'p', "SLEEP", "Shutdown grace delay", 'i', &eeprom_ups.dshutd},
+- {'k', "BEEPSTATE", "Alarm delay", 'c', (int *)eeprom_ups.beepstate},
++ {'k', "BEEPSTATE", "Alarm delay", 'c', eeprom_ups.beepstate},
+ {'r', "WAKEUP", "Wakeup delay", 'i', &eeprom_ups.dwake},
+- {'E', "SELFTEST", "Self test interval", 'c', (int *)eeprom_ups.selftest},
++ {'E', "SELFTEST", "Self test interval", 'c', eeprom_ups.selftest},
+ {0, NULL, NULL} /* Last entry */
+ };
+
+@@ -2240,9 +2240,9 @@ static void print_valid_eeprom_values(UP
+ for (j = 0; cmd_table[j].cmd; j++) {
+ if (cmd[i].cmd == cmd_table[j].cmd) {
+ if (cmd_table[j].type == 'c')
+- asnprintf(val, sizeof(val), "%s", (char *)cmd_table[j].data);
++ asnprintf(val, sizeof(val), "%s", cmd_table[j].data);
+ else
+- asnprintf(val, sizeof(val), "%d", *cmd_table[j].data);
++ asnprintf(val, sizeof(val), "%d", *((int*)cmd_table[j].data));
+
+ pmsg("%-24s %-12s %-6s ", cmd_table[j].descript,
+ cmd_table[j].config_directive, val);
diff --git a/sys-power/apcupsd/files/apcupsd.init.2 b/sys-power/apcupsd/files/apcupsd.init.2
index 1dbd936da9e4..6764e335f40a 100644
--- a/sys-power/apcupsd/files/apcupsd.init.2
+++ b/sys-power/apcupsd/files/apcupsd.init.2
@@ -1,7 +1,7 @@
#!/sbin/runscript
-# Copyright 2007-2011 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/files/apcupsd.init.2,v 1.2 2011/06/04 18:42:57 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/files/apcupsd.init.2,v 1.3 2011/08/22 14:27:25 flameeyes Exp $
INSTANCE="${SVCNAME#*.}"
if [ -z "${INSTANCE}" ] || [ "${SVCNAME}" = "apcupsd" ]; then
@@ -20,7 +20,7 @@ start() {
ebegin "Starting APC UPS daemon"
start-stop-daemon \
--start --pidfile "/var/run/${SVCNAME}.pid" \
- --wait 1500 \
+ --wait 3000 \
--exec /sbin/apcupsd -- \
-f "/etc/apcupsd/${INSTANCE}.conf" \
-P "/var/run/${SVCNAME}.pid"