~alpine/aports

main/apcupsd: add script to execute killpower on shutdown v1 APPLIED

Alex Sivchev: 1
 main/apcupsd: add script to execute killpower on shutdown

 2 files changed, 22 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.alpinelinux.org/~alpine/aports/patches/3637/mbox | git am -3
Learn more about email & git

[PATCH] main/apcupsd: add script to execute killpower on shutdown Export this patch

Executing killpower is needed to ensure that the system will automatically
reboot when the mains power is restored [1].

The script was taken from Gentoo [2].

[1] http://www.apcupsd.org/manual/manual.html#shutdown-sequence
[2] https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-power/apcupsd/files/apcupsd.powerfail.init
---
 main/apcupsd/APKBUILD                |  6 +++++-
 main/apcupsd/apcupsd.powerfail.initd | 17 +++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 main/apcupsd/apcupsd.powerfail.initd

diff --git a/main/apcupsd/APKBUILD b/main/apcupsd/APKBUILD
index ed3b38ade2..fda125aa29 100644
--- a/main/apcupsd/APKBUILD
+++ b/main/apcupsd/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apcupsd
pkgver=3.14.14
pkgrel=1
pkgrel=2
pkgdesc="A Daemon to control APC UPSes"
subpackages="$pkgname-doc $pkgname-webif $pkgname-openrc"
url="http://www.apcupsd.org"
@@ -12,6 +12,7 @@ makedepends="net-snmp-dev linux-headers gd-dev libusb-compat-dev"
options="!check" # no test suite included
source="https://sourceforge.net/projects/apcupsd/files/apcupsd%20-%20Stable/$pkgver/apcupsd-$pkgver.tar.gz
	apcupsd.initd
	apcupsd.powerfail.initd
	apcupsd-alpine.patch
	"

@@ -46,6 +47,8 @@ package() {
	cd "$_builddir"
	make DESTDIR=$pkgdir install
	install -D -m755 "$srcdir"/apcupsd.initd "$pkgdir"/etc/init.d/apcupsd
	install -D -m755 "$srcdir"/apcupsd.powerfail.initd \
		"$pkgdir"/etc/init.d/apcupsd.powerfail
}

webif() {
@@ -56,4 +59,5 @@ webif() {

sha512sums="c953bbf3e08f809748a7978a3952604176390d1cd276f187fe096d9bc3c8993b52127e8350c0363387da41318e24b4d1e00ea58df71f3bb8f50c9a5a64cd2d7f  apcupsd-3.14.14.tar.gz
cd9cb3c812dfd72660007807965cac866dfb2ce4bd8200668f08e94fdcce874cce2ec87a0d832b8f37f254908d093aff0cc2db26e9403d5e613dc192072da617  apcupsd.initd
8d1c266bd86cd1cdf4fccdd171a877957bf5e26e1bb8c20e4c9c6b362a63d8cc1b887a1661939e4e56228a8d23dfc81fe782806b5d1527423c2ef7872cbeb881  apcupsd.powerfail.initd
4f0712519213c4ef14f41eeef681c5498fac7bf42f205de8a855938f8e834d9488d86820d7c883e89d0d305ee287e17e2d321dbbc98ae12f8487bf58aa0d4a6b  apcupsd-alpine.patch"
diff --git a/main/apcupsd/apcupsd.powerfail.initd b/main/apcupsd/apcupsd.powerfail.initd
new file mode 100644
index 0000000000..cd7a1e9210
--- /dev/null
+++ b/main/apcupsd/apcupsd.powerfail.initd
@@ -0,0 +1,17 @@
#!/sbin/openrc-run
# Copyright 2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

description='Signal the UPS to kill power in a power failure condition'

depend() {
	need mount-ro
}

start() {
	if [ "$RC_RUNLEVEL" = "shutdown" -a -f /etc/apcupsd/powerfail ] ; then
		ebegin 'Signaling UPS to kill power'
		/sbin/apcupsd --killpower
		eend $?
	fi
}
-- 
2.33.0