From dacae1d9673958dbeceae2ec93758cc3d4b9995e Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Wed, 4 Dec 2013 14:25:28 -0600 Subject: apcupsd: readd for R8. closes#949. runit-scripts: add apcupsd --- abs/core/runit-scripts/PKGBUILD | 7 ++-- abs/core/runit-scripts/fbsplash-runit.sh | 37 ----------------- .../runitscripts/services/apcupsd/run | 8 ++++ abs/extra/apcupsd/PKGBUILD | 47 ++++++++++++++++++++++ abs/extra/apcupsd/__changelog | 3 ++ abs/extra/apcupsd/apcupsd-tmpfiles.conf | 2 + abs/extra/apcupsd/apcupsd.install | 24 +++++++++++ abs/extra/apcupsd/apcupsd.service | 8 ++++ 8 files changed, 95 insertions(+), 41 deletions(-) delete mode 100755 abs/core/runit-scripts/fbsplash-runit.sh create mode 100755 abs/core/runit-scripts/runitscripts/services/apcupsd/run create mode 100644 abs/extra/apcupsd/PKGBUILD create mode 100644 abs/extra/apcupsd/__changelog create mode 100644 abs/extra/apcupsd/apcupsd-tmpfiles.conf create mode 100644 abs/extra/apcupsd/apcupsd.install create mode 100644 abs/extra/apcupsd/apcupsd.service diff --git a/abs/core/runit-scripts/PKGBUILD b/abs/core/runit-scripts/PKGBUILD index 2e5d50b..745edb3 100755 --- a/abs/core/runit-scripts/PKGBUILD +++ b/abs/core/runit-scripts/PKGBUILD @@ -1,6 +1,6 @@ pkgname=runit-scripts pkgver=8.1 -pkgrel=1 +pkgrel=2 pkgdesc="collection of startup scripts for runit" url="http://smarden.org/runit/" license="BSD" @@ -10,7 +10,7 @@ conflicts=() replaces=() backup=('etc/runit/1.local' 'etc/runit/3.local') install=runit.install -source=(fbsplash-runit.sh) +source=() arch=('i686' 'x86_64') build() { @@ -26,10 +26,9 @@ package() { install -d $pkgdir/etc/rc.d/functions.d install -m0700 1 2 3 1.local 3.local ctrlaltdel $pkgdir/etc/runit - install -m755 $srcdir/fbsplash-runit.sh $pkgdir/etc/rc.d/functions.d/fbsplash-runit.sh install -m0755 reboot-runit halt-runit logger $pkgdir/sbin rsync -a --exclude=.svn services/* $pkgdir/etc/sv chmod -R 755 $pkgdir/etc/sv chown -R root:root $pkgdir/etc/sv } -md5sums=('c79246677d5ffe687bcf6df1b9c2abc2') +md5sums=() diff --git a/abs/core/runit-scripts/fbsplash-runit.sh b/abs/core/runit-scripts/fbsplash-runit.sh deleted file mode 100755 index 87435ee..0000000 --- a/abs/core/runit-scripts/fbsplash-runit.sh +++ /dev/null @@ -1,37 +0,0 @@ -# fbsplash functions.d runit script # - -printhlr() { - printf "${C_OTHER}${PREFIX_REG} ${C_H1}${1}${C_CLEAR} \n" - } - -stat_runit(){ - printf "" - printhlr "${C_MAIN}${1}${C_CLEAR} " -} - - -# splash stuff # -if [ -e /etc/conf.d/fbcondecor ] -then - . /etc/conf.d/fbcondecor - . /sbin/splash-functions.sh - - case $0 in /etc/runit/1 ) - # Prevent splash destruction - CONSOLEFONT="" - # Continue to use a splash daemon started in initcpio - if /bin/mountpoint -q /run/.splash-cache; then - /bin/mount --move /run/.splash-cache $spl_cachedir || return - # Mount a tmpfs - else - ( splash_cache_prep ) || return - fi - - splash_comm_send set message "$SPLASH_BOOT_MESSAGE" - - ;; /etc/runit/3 ) - ( splash_cache_prep ) || return - - splash_comm_send set message "$SPLASH_SHUTDOWN_MESSAGE" - esac -fi diff --git a/abs/core/runit-scripts/runitscripts/services/apcupsd/run b/abs/core/runit-scripts/runitscripts/services/apcupsd/run new file mode 100755 index 0000000..70bd9e0 --- /dev/null +++ b/abs/core/runit-scripts/runitscripts/services/apcupsd/run @@ -0,0 +1,8 @@ +#!/bin/sh +exec 2>&1 + +. /etc/rc.conf +. /etc/rc.d/functions + +stat_runit "Starting APC UPS Daemon" +exec /usr/bin/apcupsd -b -f /etc/apcupsd/apcupsd.conf diff --git a/abs/extra/apcupsd/PKGBUILD b/abs/extra/apcupsd/PKGBUILD new file mode 100644 index 0000000..31a3cfa --- /dev/null +++ b/abs/extra/apcupsd/PKGBUILD @@ -0,0 +1,47 @@ +# $Id$ +# Maintainer: Sergej Pupykin +# Maintainer: Todd Musall +# Maintainer: Massimiliano Torromeo + +pkgname=apcupsd +pkgver=3.14.10 +pkgrel=7 +pkgdesc="Power mangement and controlling most of APC's UPS models" +arch=(i686 x86_64) +url="http://www.apcupsd.org" +license=('GPL') +install=apcupsd.install +depends=('gcc-libs') +optdepends=('gd: for CGI' + 'gconf: for frontend' + 'gtk2: for frontend') +makedepends=('pkgconfig' 'gd' 'gconf' 'gtk2') +backup=(etc/apcupsd/apcupsd.conf etc/apcupsd/hosts.conf + etc/apcupsd/multimon.conf) +source=(http://downloads.sourceforge.net/apcupsd/$pkgname-$pkgver.tar.gz + apcupsd.service + apcupsd-tmpfiles.conf) +sha256sums=('0707b5ec9916fbde9e44eb8d18037c8d8f75dfd6aeef51aba5487e189eef2032' + '145e88863335f077fc354b4d263b15f64af67b45a10ed37c68ebd468181e23f7' + 'b00cd1a31de70a172698d486583aa79113b99c1bb4b882ab906d0e37504d7f55') + +build() { + cd "$srcdir/$pkgname-$pkgver" + ./configure --prefix=/usr --libexecdir=/usr/lib/$pkgname \ + --sbindir=/usr/bin \ + --enable-cgi --enable-usb --enable-net \ + --with-upstype=usb --with-upscable=usb \ + --with-serial-dev=/dev/usb/hid/hiddev[0-9] \ + --enable-pthreads --enable-gapcmon + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install + 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" + chmod 755 "$pkgdir"/usr/bin/* + install -dm755 "$pkgdir/usr/lib/$pkgname/cgi-bin" + mv "$pkgdir"/etc/apcupsd/*.cgi "$pkgdir/usr/lib/$pkgname/cgi-bin" +} diff --git a/abs/extra/apcupsd/__changelog b/abs/extra/apcupsd/__changelog new file mode 100644 index 0000000..3c43f29 --- /dev/null +++ b/abs/extra/apcupsd/__changelog @@ -0,0 +1,3 @@ +remove systemd-sysvcompat as dep +add apcupsd.install to have runit start the service + diff --git a/abs/extra/apcupsd/apcupsd-tmpfiles.conf b/abs/extra/apcupsd/apcupsd-tmpfiles.conf new file mode 100644 index 0000000..0ceb410 --- /dev/null +++ b/abs/extra/apcupsd/apcupsd-tmpfiles.conf @@ -0,0 +1,2 @@ +r /etc/apcupsd/powerfail +r /etc/nologin \ No newline at end of file diff --git a/abs/extra/apcupsd/apcupsd.install b/abs/extra/apcupsd/apcupsd.install new file mode 100644 index 0000000..3f1e6b2 --- /dev/null +++ b/abs/extra/apcupsd/apcupsd.install @@ -0,0 +1,24 @@ +# This is a default template for a post-install scriptlet. You can +# remove any functions you don't need (and this header). + +# arg 1: the new package version +post_install() { + add_service.sh apcupsd + /sbin/sv start apcupsd +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install +} + +# arg 1: the old package version +post_remove() { + /sbin/sv stop apcupsd + remove_service.sh apcupsd +} + +op=$1 +shift +$op $* diff --git a/abs/extra/apcupsd/apcupsd.service b/abs/extra/apcupsd/apcupsd.service new file mode 100644 index 0000000..b8dfb9b --- /dev/null +++ b/abs/extra/apcupsd/apcupsd.service @@ -0,0 +1,8 @@ +[Unit] +Description=APC UPS Monitor + +[Service] +ExecStart=/usr/bin/apcupsd -b + +[Install] +WantedBy=multi-user.target -- cgit v0.12