Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apcupsd: add powerfail logic at shutdown #53171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions srcpkgs/apcupsd/files/apcupsd-powerfail.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PWRFAILDIR="$( awk '$1 == "PWRFAILDIR" {print $2; exit}' /etc/apcupsd/apcupsd.conf )"
PWRFAILDIR="${PWRFAILDIR:-/etc/apcupsd}"

if [ -f "${PWRFAILDIR}/powerfail" ]; then
msg "Powering off the UPS with APCUPSD..."
/etc/apcupsd/apccontrol killpower
fi
7 changes: 6 additions & 1 deletion srcpkgs/apcupsd/files/apcupsd/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/sh
exec 2>&1
[ -r conf] && . ./conf

PWRFAILDIR="$( awk '$1 == "PWRFAILDIR" {print $2; exit}' /etc/apcupsd/apcupsd.conf )"
PWRFAILDIR="${PWRFAILDIR:-/etc/apcupsd}"
rm -f "${PWRFAILDIR}/powerfail"

[ -r conf ] && . ./conf
exec apcupsd -b ${OPTS}
14 changes: 14 additions & 0 deletions srcpkgs/apcupsd/patches/skip-man-txt-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Do not generate *.man.txt files at build time. The build rule depends on the
deprecated `col` command and the files are only needed for the MinGW platform.
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -3,9 +3,6 @@
SUBDIRS =
include $(topdir)/autoconf/targets.mak

-all-targets: apcupsd.man.txt apcaccess.man.txt apctest.man.txt \
- apccontrol.man.txt apcupsd.conf.man.txt
-
apcupsd.man.txt: apcupsd.8
$(call MANIFY,$<,$@)
apcaccess.man.txt: apcaccess.8
3 changes: 2 additions & 1 deletion srcpkgs/apcupsd/template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Template file for 'apcupsd'
pkgname=apcupsd
version=3.14.14
revision=1
revision=2
build_style=gnu-configure
configure_args="
--disable-install-distdir
Expand Down Expand Up @@ -37,4 +37,5 @@ post_install() {
# This binary is not needed and conflicts with a binary from an other package.
rm ${DESTDIR}/usr/bin/smtp
vsv apcupsd
vinstall ${FILESDIR}/apcupsd-powerfail.sh 644 etc/runit/shutdown.d 89-apcupsd-powerfail.sh
}
Loading