Simplify init script with the new declarative runscript.
authorDiego Elio Pettenò <flameeyes@gentoo.org>
Fri, 21 Oct 2011 22:06:43 +0000 (22:06 +0000)
committerDiego Elio Pettenò <flameeyes@gentoo.org>
Fri, 21 Oct 2011 22:06:43 +0000 (22:06 +0000)
Package-Manager: portage-2.2.0_alpha69/cvs/Linux x86_64

sys-power/apcupsd/ChangeLog
sys-power/apcupsd/Manifest
sys-power/apcupsd/apcupsd-3.14.10-r1.ebuild [moved from sys-power/apcupsd/apcupsd-3.14.9-r1.ebuild with 96% similarity]
sys-power/apcupsd/apcupsd-3.14.7.ebuild [deleted file]
sys-power/apcupsd/files/apcupsd.init.3 [new file with mode: 0644]

index 764f673f580b59552839f813db87508c16edfc68..6f1780156e7fadcaf67af9dd86623f9f3cb9ab81 100644 (file)
@@ -1,6 +1,12 @@
 # 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.76 2011/10/20 16:39:01 ranger Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/ChangeLog,v 1.77 2011/10/21 22:06:43 flameeyes Exp $
+
+*apcupsd-3.14.10-r1 (21 Oct 2011)
+
+  21 Oct 2011; Diego E. Pettenò <flameeyes@gentoo.org> -apcupsd-3.14.7.ebuild,
+  -apcupsd-3.14.9-r1.ebuild, +apcupsd-3.14.10-r1.ebuild, +files/apcupsd.init.3:
+  Simplify init script with the new declarative runscript.
 
   20 Oct 2011; Brent Baude <ranger@gentoo.org> apcupsd-3.14.8-r1.ebuild:
   Marking apcupsd-3.14.8-r1 ppc for bug 363087
index c153fe6dcec03160ad422186a7dd92519d09c314..278740b9ef1f710fb117bd06e6ccac8fda5f5a53 100644 (file)
@@ -1,15 +1,23 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
 AUX apcupsd-3.14.9-aliasing.patch 2108 RMD160 c906bdab1976ca3bda05ea55e0f3135dfbc8da9f SHA1 c03d48a0c3a7beb884143fda01d48e526fd634fb SHA256 21343f4798121a828a89eee49ca9fe7574b2fb45a5aad35fbfd5aabec7740761
 AUX apcupsd-udev.rules 328 RMD160 359a2b9e275cdf16b9177224599791c786f93c98 SHA1 c681daa68f6b84ba96522ef4ecff583d1acdc82a SHA256 0865097a99b321301ec5b0bb51d0560a01df0a21cca0ee0df61f8d33f888b86a
 AUX apcupsd.init.2 859 RMD160 81cd9edda39ec6f9cf048811df80d4f9dcd7055d SHA1 25c8134f09c362d6e82c5aa32e77a5f89c5eea1a SHA256 7007a2484547e46da2264d9f817a96387885e91a38407ec30e122ba4b637a030
 AUX apcupsd.init.2a 844 RMD160 13d0f7862c2a1d93a2349e7099f90216f8fe1056 SHA1 70e90bb3e3c1c3dd599a457efc0549627388322d SHA256 86be1bafb0cf72db61def444361c659e5c36d0e44b1a007772b3f49aa0e95bcb
+AUX apcupsd.init.3 659 RMD160 9b3a2b7a172e7a8216992cf3e5dbf3aecc884276 SHA1 6cd1ab596b3c221403101633abc9e87c10446f80 SHA256 c3186646f06666ebd1ef265f5f6d56aeff27587face610d5f73c625b5c6053cc
 AUX apcupsd.powerfail.init 520 RMD160 24f766871652220523a18885f41f6608f29ab670 SHA1 0c5f97e556504904ffd6d72ff27ef792ac70e18c SHA256 eee773aa07175674085cb0ab7ed2c071fcc04fc05383d368f38d056e7327ff35
 DIST apcupsd-3.14.10.tar.gz 1336852 RMD160 bb01535232ee96045ee058ade70ddd39c04b5457 SHA1 4a3d5591672121f5d761d33307b56f10d33f5b67 SHA256 0707b5ec9916fbde9e44eb8d18037c8d8f75dfd6aeef51aba5487e189eef2032
-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.10-r1.ebuild 4073 RMD160 2976b4acfa2d135a4d034ce2c06d87d88ea7142f SHA1 09aafc3953b319644ca5556cf405e8b97fc98f84 SHA256 f634575503a6d2e8a784d15a50515c66979ee367c9a69b664750de4a8dae9cf9
 EBUILD apcupsd-3.14.10.ebuild 4070 RMD160 e50e826c9b4ac56f7e44f1787c9006b5e9c24cb6 SHA1 82634fa6ecc8bc892c52e6b995ae7efbcf68b1aa SHA256 fff8d4bb5152fdfc2d5ffb3efff8fd258fa4f177cf29974ff45bc09d2c9bec5b
-EBUILD apcupsd-3.14.7.ebuild 4054 RMD160 95babcf8551ca20746ac11ce3a77d32164c264d0 SHA1 11b79f99dd5e3549eaf2f208489db433d1acd2da SHA256 2271394fd3be4da222814cb4432824c94893139b888d23415642e08b8a99ae78
 EBUILD apcupsd-3.14.8-r1.ebuild 3863 RMD160 e99024d6a2ad475ed1203f27356e314b1c5cb8f6 SHA1 5bf1e4bfd41d3fa83824bacb740c1b2b9bbb9e33 SHA256 f5d984daecd4a0af67bdd5c44abeea7a4f47ed6ee94623e64e89116ff77e83b5
-EBUILD apcupsd-3.14.9-r1.ebuild 4064 RMD160 2a8a4819781c85ce821a0dce9a5a724ac0e21ceb SHA1 a9914ebae05b47899a56756e69b595ef58857ae1 SHA256 ac4d9701ea5eddf422f6771a8ece4f37966eb8db66fb60b14de01861a4bfb771
-MISC ChangeLog 25789 RMD160 b0640c32f8b948bc156b6a1b6621d96c1ebc15dd SHA1 8441716e0c716f43cfe524a6240ecae94884c67c SHA256 75b504fd1a1a41473d4883df80f62e845be1ca284ff5c8ad48e059803b5d162b
+MISC ChangeLog 26047 RMD160 191053148d479f100aa20d7fe766e6f2791b08d2 SHA1 636ebcbaa2d573ef6d28e92b76af18eb267fc94d SHA256 51ffe936b13eb579980afce5b07f6e1d7cd6bd406d41b9c4ca53ea860f11e4c7
 MISC metadata.xml 237 RMD160 2a4fab832a64fbdafe2cd6f59b141b2aa80797ac SHA1 75878fb1a17b8617882c9e02331a6643d647882b SHA256 368acc29aa9214adaa137c17b114b16c6a021c4dfc9efa5f3440e968db04a9b3
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.18 (GNU/Linux)
+
+iEYEARECAAYFAk6h7O8ACgkQAiZjviIA2XiypwCgjOI/guRfqTWPUVoSjN7qX7az
+lu4An0do7BG7U4FB/zq1bndtfk9c2sRj
+=zgTX
+-----END PGP SIGNATURE-----
similarity index 96%
rename from sys-power/apcupsd/apcupsd-3.14.9-r1.ebuild
rename to sys-power/apcupsd/apcupsd-3.14.10-r1.ebuild
index 90aca78e02494882461b8e300a76b1c036aeacb3..604bb1616e506b252cfc718bd156850d3457536f 100644 (file)
@@ -1,6 +1,6 @@
 # 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-r1.ebuild,v 1.1 2011/08/26 10:53:51 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/apcupsd-3.14.10-r1.ebuild,v 1.1 2011/10/21 22:06:43 flameeyes Exp $
 
 EAPI=4
 
@@ -37,7 +37,7 @@ pkg_setup() {
 }
 
 src_prepare() {
-       epatch "${FILESDIR}/${P}-aliasing.patch"
+       epatch "${FILESDIR}/${PN}-3.14.9-aliasing.patch"
 }
 
 src_configure() {
@@ -88,7 +88,7 @@ src_install() {
        dohtml -r doc/manual/*
 
        rm "${D}"/etc/init.d/apcupsd
-       newinitd "${FILESDIR}/${PN}.init.2" "${PN}"
+       newinitd "${FILESDIR}/${PN}.init.3" "${PN}"
        newinitd "${FILESDIR}/${PN}.powerfail.init" "${PN}".powerfail
 
        # remove hal settings, we don't really want to have it around still.
diff --git a/sys-power/apcupsd/apcupsd-3.14.7.ebuild b/sys-power/apcupsd/apcupsd-3.14.7.ebuild
deleted file mode 100644 (file)
index 455909d..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-# 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.7.ebuild,v 1.11 2011/08/29 13:38:55 flameeyes Exp $
-
-WEBAPP_MANUAL_SLOT="yes"
-WEBAPP_OPTIONAL="yes"
-inherit eutils webapp linux-info
-
-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
-               ${WEBAPP_DEPEND} )
-       nls? ( sys-devel/gettext )
-       snmp? ( net-analyzer/net-snmp )
-       gnome? ( =x11-libs/gtk+-2*
-               =dev-libs/glib-2*
-               >=gnome-base/gconf-2.0 )"
-RDEPEND="${DEPEND}
-       virtual/mailx"
-
-pkg_setup() {
-       use cgi && webapp_pkg_setup
-
-       if use kernel_linux &&
-               use usb &&
-               linux_config_exists &&
-               !linux_chkconfig_present USB_HIDDEV; then
-               ewarn "Note: to be able to use the USB support for ${PN} you're going to need"
-               ewarn "the CONFIG_USB_HIDDEV option enabled in your kernel."
-               ewarn "The option hasn't been found enabled, do so before trying to use"
-               ewarn "${PN} with USB UPSes."
-       fi
-}
-
-src_compile() {
-       local myconf
-       use cgi && myconf="${myconf} --enable-cgi --with-cgi-bin=${MY_CGIBINDIR}"
-       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 \
-               || die "econf failed"
-
-       # 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() {
-       use cgi && webapp_src_preinst
-
-       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 || die "doman failed"
-
-       dohtml -r doc/manual/* || die "dodoc failed"
-
-       use cgi && webapp_src_install
-
-       rm "${D}"/etc/init.d/apcupsd
-       newinitd "${FILESDIR}/${PN}.init.2a" "${PN}" || die "newinitd failed"
-
-       if has_version sys-apps/openrc; then
-               newinitd "${FILESDIR}/${PN}.powerfail.init" "${PN}".powerfail || die "newinitd failed"
-       fi
-
-       # 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 "If you are upgrading from a previous version, please note"
-               elog "that the CGI interface is now installed using webapp-config."
-               elog "/var/www/apcupsd is no longer present."
-               webapp_pkg_postinst
-       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 ""
-
-       if [ -d "${ROOT}"/etc/runlevels/shutdown -a \
-                       ! -e "${ROOT}"/etc/runlevels/shutdown/"${PN}".powerfail ] ; then
-               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 ''
-       fi
-}
-
-pkg_prerm() {
-       use cgi && webapp_pkg_prerm
-}
diff --git a/sys-power/apcupsd/files/apcupsd.init.3 b/sys-power/apcupsd/files/apcupsd.init.3
new file mode 100644 (file)
index 0000000..5278761
--- /dev/null
@@ -0,0 +1,28 @@
+#!/sbin/runscript
+# 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.3,v 1.1 2011/10/21 22:06:43 flameeyes Exp $
+
+INSTANCE="${SVCNAME#*.}"
+if [ -z "${INSTANCE}" -o "${SVCNAME}" = "apcupsd" ]; then
+       INSTANCE="apcupsd"
+fi
+
+name="APC UPS Daemon"
+
+pidfile=/var/run/${SVCNAME}.pid
+
+command=/sbin/apcupsd
+command_args="-f /etc/apcupsd/${INSTANCE}.conf -P ${pidfile}"
+start_stop_daemon_args="--wait 300 --retry TERM/5/TERM/5"
+
+depend() {
+       use net
+       after udev
+}
+
+start_pre() {
+       rm -f /etc/apcupsd/powerfail
+
+       export SERVICE="${SVCNAME}"
+}