Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 35454782C14 for ; Tue, 31 Aug 2021 09:12:41 +0000 (UTC) Received: by mail-ej1-f49.google.com with SMTP id bt14so37129594ejb.3 for ; Tue, 31 Aug 2021 02:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:mime-version:content-language :content-transfer-encoding; bh=zamiblGieUhInexzyHyadsNHJZrS58PwT5E5PZg5jhw=; b=khRS7XBQOrsvARfDeNPgio+bmfcWKmgPY6rlGKrjlaOHUJ5x23ga0BCZMFTb04HM7G P8PwNeGZi3t6GbEXfjckvwIcmGfOk8WCiJa7fW6bsya7g9eHgmAvDXkG1ULz1iT6gbXa J6lyb5gOj/sHQZJPKsEpUlH8XhQSb0z16SwDDoZde+s8PjjgYGI9WrLimJtM3mzVZ98l 13YRK8vLWsJNhCXXpNHpPBCgiTKFH99jDRnUR9BFLH4VQpoK8xkmpT4yn1tLiIby9j2C TFAeGrcS2l4FZNln9GIpv0IRyFZVT6EUsjxtIvB6WPa6cjmMGrbkCJLrX/guVZ++4xyF LTaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:mime-version :content-language:content-transfer-encoding; bh=zamiblGieUhInexzyHyadsNHJZrS58PwT5E5PZg5jhw=; b=kqZQ70/jY7zXjgI9INhk1bPOyMZ2UWVyj9dpLV38hAuTD/yRYN2ZrooXKHbMa9NoLR Ln6zlfa3KPCc8ltoIdN2r9+fSyPkgu/uiTFaIS2gKDukYRR+w7+dHieYeOxRZdwi5viE +xH5Hde3ZuVQPScR7EZj4XEmI7WoEwxFXAnhIiwVM2jZx1sEan8cGlF9jnr5m1U79Icc VQrXlIoebv2FTtQmhOy3xvazMQAAE+c5xUx2x625ihcZ9Odik6QrYt1LRHHO5KUKrKVX hOIXHyuY4wgjT9ukIgawm5pbn7xJ0jYHnB6mkEQKowItSsKng0O+zMd1C4UjkkwLhD0X hanw== X-Gm-Message-State: AOAM532UJNzSJUfvIO+JLkLtN+mIJVTPMtmBSFGSw1wauPSCPI0NapT9 giEW4QfS4BOR0FU7VRE7VlJdkN6rTBE= X-Google-Smtp-Source: ABdhPJzOnX33Ih86GKZoxrwF3pbVAmOaa2j83R0j/8FMKbqiGzhydPJzcMMZgu73F+R0Ot1MD64xkQ== X-Received: by 2002:a17:906:32d6:: with SMTP id k22mr29341753ejk.228.1630401159832; Tue, 31 Aug 2021 02:12:39 -0700 (PDT) Received: from [127.0.0.1] ([37.63.5.239]) by smtp.gmail.com with ESMTPSA id u4sm3307107ejc.19.2021.08.31.02.12.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Aug 2021 02:12:39 -0700 (PDT) From: Alex Sivchev Subject: [PATCH] main/apcupsd: add script to execute killpower on shutdown To: alpine-aports@lists.alpinelinux.org Message-ID: <1fc94d21-911c-14b9-595f-97a3500ae553@gmail.com> Date: Tue, 31 Aug 2021 12:12:37 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 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