diff options
-rw-r--r-- | .SRCINFO | 39 | ||||
-rw-r--r-- | PKGBUILD | 77 | ||||
-rw-r--r-- | apcupsd-3.14.4-shutdown.patch | 19 | ||||
-rw-r--r-- | apcupsd-tmpfiles.conf | 3 | ||||
-rw-r--r-- | apcupsd.service | 12 | ||||
-rw-r--r-- | apcupsd_shutdown | 9 |
6 files changed, 159 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..1e5d7cebc659 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,39 @@ +pkgbase = apcupsd-nosmtp + pkgdesc = Power mangement and controlling most of APC's UPS models. Version without smtp. + pkgver = 3.14.14 + pkgrel = 1 + url = http://www.apcupsd.org + arch = x86_64 + license = GPL + makedepends = gd + depends = gcc-libs + depends = systemd-sysvcompat + depends = libusb-compat + optdepends = gd: for CGI + conflicts = apcupsd + backup = etc/apcupsd/apcupsd.conf + backup = etc/apcupsd/hosts.conf + backup = etc/apcupsd/multimon.conf + backup = etc/apcupsd/apcupsd.css + backup = etc/apcupsd/changeme + backup = etc/apcupsd/commfailure + backup = etc/apcupsd/commok + backup = etc/apcupsd/offbattery + backup = etc/apcupsd/onbattery + backup = etc/apcupsd/apccontrol + source = https://downloads.sourceforge.net/apcupsd/apcupsd-3.14.14.tar.gz + source = https://downloads.sourceforge.net/apcupsd/apcupsd-3.14.14.tar.gz.sig + source = apcupsd.service + source = apcupsd-3.14.4-shutdown.patch + source = apcupsd_shutdown + source = apcupsd-tmpfiles.conf + validpgpkeys = 635B9D943945DCA05BE9AB0A24E84804A57B2D90 + sha256sums = db7748559b6b4c3784f9856561ef6ac6199ef7bd019b3edcd7e0a647bf8f9867 + sha256sums = SKIP + sha256sums = 41c79787172299f842e8edf5228d68978a83927264aa245982426b5988a64233 + sha256sums = 714468c0fbb07022ab29a58eac142eafd5aec9a0ab21e670266ebe7e760ccaf4 + sha256sums = a5e3a4c3a47d1abdf23b0a7c3832ad5a00e1cab03fe51336a4ee5f236152a60d + sha256sums = a4474cfcd607c5e9b64e27eec7cbc2b0bcf08c8ea37fd1f0f28e98ac2883fd4f + +pkgname = apcupsd-nosmtp + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..f0078cbe677b --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,77 @@ +# Maintainer: Florian Pritz <bluewind@xinu.at> +# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com> +# Contributor: Todd Musall <tmusall@comcast.net> +# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com> +# Contributor: Anthony Danilov <frimen.c@gmail.com> + + +pkgname=apcupsd-nosmtp +_pkgname_origin=${pkgname%%-*} +pkgver=3.14.14 +pkgrel=1 +pkgdesc="Power mangement and controlling most of APC's UPS models. Version without smtp." +arch=(x86_64) +url="http://www.apcupsd.org" +license=('GPL') +depends=('gcc-libs' 'systemd-sysvcompat' 'libusb-compat') +optdepends=('gd: for CGI') +makedepends=('gd') +conflicts=('apcupsd') +backup=(etc/apcupsd/apcupsd.conf + etc/apcupsd/hosts.conf + etc/apcupsd/multimon.conf + etc/apcupsd/apcupsd.css + etc/apcupsd/changeme + etc/apcupsd/commfailure + etc/apcupsd/commok + etc/apcupsd/offbattery + etc/apcupsd/onbattery + etc/apcupsd/apccontrol) +source=(https://downloads.sourceforge.net/apcupsd/$_pkgname_origin-$pkgver.tar.gz{,.sig} + apcupsd.service + apcupsd-3.14.4-shutdown.patch + apcupsd_shutdown + apcupsd-tmpfiles.conf) +sha256sums=('db7748559b6b4c3784f9856561ef6ac6199ef7bd019b3edcd7e0a647bf8f9867' + 'SKIP' + '41c79787172299f842e8edf5228d68978a83927264aa245982426b5988a64233' + '714468c0fbb07022ab29a58eac142eafd5aec9a0ab21e670266ebe7e760ccaf4' + 'a5e3a4c3a47d1abdf23b0a7c3832ad5a00e1cab03fe51336a4ee5f236152a60d' + 'a4474cfcd607c5e9b64e27eec7cbc2b0bcf08c8ea37fd1f0f28e98ac2883fd4f') +validpgpkeys=(635B9D943945DCA05BE9AB0A24E84804A57B2D90) + +prepare() { + cd "$srcdir/$_pkgname_origin-$pkgver" + patch -p1 -i "$srcdir/apcupsd-3.14.4-shutdown.patch" +} + +build() { + cd "$srcdir/$_pkgname_origin-$pkgver" + ./configure --prefix=/usr --libexecdir=/usr/lib/$_pkgname_origin \ + --sbindir=/usr/bin \ + --enable-cgi --enable-usb --enable-net \ + --with-upstype=usb --with-upscable=usb \ + --with-serial-dev=/dev/usb/hid/hiddev[0-9] \ + --disable-gapcmon --enable-modbus-usb + make +} + +package() { + cd "$srcdir/$_pkgname_origin-$pkgver" + + make DESTDIR="$pkgdir" install + + sed -i 's#^LOCKFILE .*$#LOCKFILE /run/apcupsd#' "$pkgdir/etc/apcupsd/apcupsd.conf" + + install -Dm644 "$srcdir/apcupsd.service" "$pkgdir/usr/lib/systemd/system/apcupsd.service" + install -Dm644 "$srcdir/apcupsd-tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/apcupsd.conf" + install -Dm755 "$srcdir/apcupsd_shutdown" "$pkgdir/usr/lib/systemd/system-shutdown/apcupsd_shutdown" + + chmod 755 "$pkgdir"/usr/bin/* + + install -dm755 "$pkgdir/usr/lib/$_pkgname_origin/cgi-bin" + mv "$pkgdir"/etc/apcupsd/*.cgi "$pkgdir/usr/lib/$_pkgname_origin/cgi-bin" + + rm -rf "$pkgdir/usr/share/hal" + rm -f "$pkgdir/usr/bin/smtp" +} diff --git a/apcupsd-3.14.4-shutdown.patch b/apcupsd-3.14.4-shutdown.patch new file mode 100644 index 000000000000..17671f07a637 --- /dev/null +++ b/apcupsd-3.14.4-shutdown.patch @@ -0,0 +1,19 @@ +This is needed to properly halt the machine without powering it down. + +See: + https://bugzilla.redhat.com/show_bug.cgi?id=348701 + https://bugzilla.redhat.com/show_bug.cgi?id=1442577 + + +diff -up apcupsd-3.14.4/platforms/apccontrol.in.shutdown apcupsd-3.14.4/platforms/apccontrol.in +--- apcupsd-3.14.4/platforms/apccontrol.in.shutdown 2008-05-28 09:15:47.000000000 +0200 ++++ apcupsd-3.14.4/platforms/apccontrol.in 2008-05-28 09:16:04.000000000 +0200 +@@ -104,7 +104,7 @@ case "$1" in + ;; + doshutdown) + echo "UPS ${2} initiated Shutdown Sequence" | ${WALL} +- ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown" ++ ${SHUTDOWN} -h -H now "apcupsd UPS ${2} initiated shutdown" + ;; + annoyme) + echo "Power problems with UPS ${2}. Please logoff." | ${WALL} diff --git a/apcupsd-tmpfiles.conf b/apcupsd-tmpfiles.conf new file mode 100644 index 000000000000..60f8316839e6 --- /dev/null +++ b/apcupsd-tmpfiles.conf @@ -0,0 +1,3 @@ +r /etc/apcupsd/powerfail +r /etc/nologin +d /run/apcupsd 0755 root root diff --git a/apcupsd.service b/apcupsd.service new file mode 100644 index 000000000000..614fec21d557 --- /dev/null +++ b/apcupsd.service @@ -0,0 +1,12 @@ +[Unit] +Description=APC UPS Power Control Daemon for Linux +After=syslog.target +After=network-online.target + +[Service] +ExecStartPre=-/bin/rm -f /etc/apcupsd/powerfail +ExecStart=/sbin/apcupsd -b -f /etc/apcupsd/apcupsd.conf +KillMode=process + +[Install] +WantedBy=multi-user.target diff --git a/apcupsd_shutdown b/apcupsd_shutdown new file mode 100644 index 000000000000..4eff1ed697d7 --- /dev/null +++ b/apcupsd_shutdown @@ -0,0 +1,9 @@ +#!/bin/sh + +# See if this is a powerfail situation. +if [ -f /etc/apcupsd/powerfail ]; then + echo + echo "APCUPSD will now power off the UPS" + echo + /etc/apcupsd/apccontrol killpower +fi |