Version bump, require openrc, fix aliasing issues; increase wait timeout to 3 seconds...
authorDiego Elio Pettenò <flameeyes@gentoo.org>
Mon, 22 Aug 2011 14:27:25 +0000 (14:27 +0000)
committerDiego Elio Pettenò <flameeyes@gentoo.org>
Mon, 22 Aug 2011 14:27:25 +0000 (14:27 +0000)
Package-Manager: portage-2.2.0_alpha51/cvs/Linux x86_64

sys-power/apcupsd/ChangeLog
sys-power/apcupsd/Manifest
sys-power/apcupsd/apcupsd-3.14.9.ebuild [new file with mode: 0644]
sys-power/apcupsd/files/apcupsd-3.14.9-aliasing.patch [new file with mode: 0644]
sys-power/apcupsd/files/apcupsd.init.2

index 33256679cb4a0fd31d849155bb60bf9c085971f0..d8e6f727c184714affec277841514ec1e72d50c6 100644 (file)
@@ -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
index 232f85c4844021e530eafd36f3c987ab6646e7f2..fe334d7e1291e2fe41310e15b9c7c4eba76f560e 100644 (file)
@@ -1,8 +1,21 @@
-AUX apcupsd.init.2 859 RMD160 8ea70ecafcdc72c131e1506f0f9d5269cd24698c SHA1 dda73bfd7f5c4e73e83d4f12b84dac0e5fec028d SHA256 f547396ae1e27949e001edcc08b671ec20ee2d33ed44cb5a5bb9921194abcaf9
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+AUX apcupsd-3.14.9-aliasing.patch 2108 RMD160 c906bdab1976ca3bda05ea55e0f3135dfbc8da9f SHA1 c03d48a0c3a7beb884143fda01d48e526fd634fb SHA256 21343f4798121a828a89eee49ca9fe7574b2fb45a5aad35fbfd5aabec7740761
+AUX apcupsd.init.2 859 RMD160 81cd9edda39ec6f9cf048811df80d4f9dcd7055d SHA1 25c8134f09c362d6e82c5aa32e77a5f89c5eea1a SHA256 7007a2484547e46da2264d9f817a96387885e91a38407ec30e122ba4b637a030
 AUX apcupsd.powerfail.init 520 RMD160 24f766871652220523a18885f41f6608f29ab670 SHA1 0c5f97e556504904ffd6d72ff27ef792ac70e18c SHA256 eee773aa07175674085cb0ab7ed2c071fcc04fc05383d368f38d056e7327ff35
 DIST apcupsd-3.14.7.tar.gz 4272089 RMD160 cb3db3e6e123f39666eef3c5ccfdec65c57a1571 SHA1 9561eb5cf8e0c627215b987dbb97d026a2b2e9b8 SHA256 7e3df3b5552394206f4b8aaac2bd85ac69df540495557676a3df63f84972823c
 DIST apcupsd-3.14.8.tar.gz 1317601 RMD160 f642582e01506ebb986c16df01429e6bb08c7e8b SHA1 cb7a7b401797e129c92a6b8dc2bf7b193b1d6c72 SHA256 8e7f2574d3abaf6637da3e790860c3f9ba64fab1ec7e50bb080de4439441c5a7
+DIST apcupsd-3.14.9.tar.gz 1334762 RMD160 be1a33b85c790fc3bc62bab370a62d014dbf0a57 SHA1 1e9e8a054f17c554c047ec1d7b363d35553058bc SHA256 0041f00b2e628056e668db7298d0af0ad501fe127e0c5c344eec9873a0988a92
 EBUILD apcupsd-3.14.7.ebuild 4050 RMD160 bacec1826beb18300650697b5c5c7d0e8decbdb5 SHA1 638178843d21853e5b544101355b3457322a2c42 SHA256 4816de63a738b4c3d8a1df6dcef37544bb8ac83e66ed6fbe0fc16b625963598c
 EBUILD apcupsd-3.14.8-r1.ebuild 3863 RMD160 8b96f3fb7229985aa81dd9ca7d1af2c5f08215c3 SHA1 2b267d2cdefeabbd6ab0778fc46cc224b818f1a7 SHA256 874dc3a337f1bd4c0905c0f0543e2bfbee716784e891ecc4c933a09d0abeb40b
-MISC ChangeLog 24511 RMD160 76abdaa230745b56b24ffd14dcb1f987f0735393 SHA1 c86589be50b80b888f47f531e6aae8414eef8c63 SHA256 af06a3d9ebb6d7aba900ef41ababa50187c82dd4c855be49e645e171fc5f6472
+EBUILD apcupsd-3.14.9.ebuild 3618 RMD160 c3bf565b6ab0151cf44ef0d51c97146fe67a639f SHA1 d4c826bda2986c8d1dee748356ec1b478c8c18aa SHA256 8c28da1971a8ef5bf899f7426fdd68e825042c6e84bfdd254817d3e7f9b7842f
+MISC ChangeLog 24827 RMD160 734970efc5ba7daa914f20d98bda569b1eed0cb5 SHA1 64d4ec1703f2a9ce2ead358aadf33187b1e76e74 SHA256 915a6041bb4291e987abfe10d105cde6f16af4522664a144aac1e01be01cd19a
 MISC metadata.xml 237 RMD160 2a4fab832a64fbdafe2cd6f59b141b2aa80797ac SHA1 75878fb1a17b8617882c9e02331a6643d647882b SHA256 368acc29aa9214adaa137c17b114b16c6a021c4dfc9efa5f3440e968db04a9b3
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.18 (GNU/Linux)
+
+iEYEARECAAYFAk5SZzYACgkQAiZjviIA2Xir4gCgyFWBscGJpOceUs9GqqHQFOQg
+pSUAnAn5FAe3M+yteEwYcgsvh1PRQH1b
+=6k4V
+-----END PGP SIGNATURE-----
diff --git a/sys-power/apcupsd/apcupsd-3.14.9.ebuild b/sys-power/apcupsd/apcupsd-3.14.9.ebuild
new file mode 100644 (file)
index 0000000..ccc6d64
--- /dev/null
@@ -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 (file)
index 0000000..09d9883
--- /dev/null
@@ -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);
index 1dbd936da9e452fd2ce2bc6de7c51634078c6d3a..6764e335f40a92426b3ebbf2b30bb75771f8afd0 100644 (file)
@@ -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"