diff options
author | Michael Hanson <hansonorders@verison.net> | 2010-03-25 00:39:23 (GMT) |
---|---|---|
committer | Michael Hanson <hansonorders@verison.net> | 2010-03-25 00:39:23 (GMT) |
commit | 369bb6314419c513693a3b5546f6272bd0a6a20c (patch) | |
tree | a977fe9c416ce402191a6d12de45164877093e95 | |
parent | 698caea6972d83123dfa9f03b67cbd8598e7a2f3 (diff) | |
download | linhes_pkgbuild-369bb6314419c513693a3b5546f6272bd0a6a20c.zip linhes_pkgbuild-369bb6314419c513693a3b5546f6272bd0a6a20c.tar.gz linhes_pkgbuild-369bb6314419c513693a3b5546f6272bd0a6a20c.tar.bz2 |
network-ups-tools: Found a way to run in the foreground without a loop.
8 files changed, 55 insertions, 46 deletions
diff --git a/abs/extra-testing/community/network-ups-tools/PKGBUILD b/abs/extra-testing/community/network-ups-tools/PKGBUILD index ddbe89e..bffe5ea 100644 --- a/abs/extra-testing/community/network-ups-tools/PKGBUILD +++ b/abs/extra-testing/community/network-ups-tools/PKGBUILD @@ -4,7 +4,7 @@ pkgname=network-ups-tools pkgver=2.4.3 -pkgrel=2 +pkgrel=3 pkgdesc="NUT is a collection of programs for monitoring and administering UPS hardware" arch=('i686' 'x86_64') url="http://www.networkupstools.org/" @@ -13,7 +13,8 @@ depends=('openssl' 'hal' 'gd') makedepends=('libusb') backup=(etc/ups/{ups.conf,upsd.conf,upsd.users,upsmon.conf,upssched.conf}) install=nut.install -source=(http://www.networkupstools.org/source/2.4/nut-$pkgver.tar.gz run finish) +source=(http://www.networkupstools.org/source/2.4/nut-$pkgver.tar.gz + run.upsdrvctl run.upsd finish.upsd run.upsmon) options=('!emptydirs' '!libtool') build() { @@ -40,8 +41,10 @@ cd $srcdir/nut-$pkgver install -D -m640 conf/upsd.users.sample $pkgdir/etc/ups/upsd.users install -D -m640 conf/upsmon.conf.sample $pkgdir/etc/ups/upsmon.conf install -D -m644 conf/upssched.conf.sample $pkgdir/etc/ups/upssched.conf - install -D -m755 ../run $pkgdir/etc/sv/upsd/run || return 1 - install -D -m755 ../finish $pkgdir/etc/sv/upsd/finish || return 1 + install -D -m755 ../run.upsdrvctl $pkgdir/etc/sv/upsdrvctl/run || return 1 + install -D -m755 ../run.upsd $pkgdir/etc/sv/upsd/run || return 1 + install -D -m755 ../finish.upsd $pkgdir/etc/sv/upsd/finish || return 1 + install -D -m755 ../run.upsmon $pkgdir/etc/sv/upsmon/run || return 1 # Fix udev rules sed -i "s|SYSFS|ATTRS|g" $pkgdir/etc/udev/rules.d/52-nut-usbups.rules @@ -49,5 +52,7 @@ cd $srcdir/nut-$pkgver mv ${pkgdir}/etc/udev ${pkgdir}/lib } md5sums=('6f893b61b07915e7a139324fa3f79121' - 'a927b0803559e4498bb944d98250f011' - 'b5b2e266774acfbc80e64ddfbd4057ee') + 'a84cbe7194fa85f0cf5eb6993f4a5bda' + '3e456bf9a9a5f592bc11f2f8c78580e2' + '97828241b3a258ae7ab1481cd181c7da' + 'af4fc006d2e1987b4b65580ed3c493bb') diff --git a/abs/extra-testing/community/network-ups-tools/finish b/abs/extra-testing/community/network-ups-tools/finish deleted file mode 100644 index d031d4e..0000000 --- a/abs/extra-testing/community/network-ups-tools/finish +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions - -PID=`pidof -o %PPID /usr/sbin/upsd` - - stat_runit "Stopping UPSd Daemon" - /usr/bin/upsdrvctl stop &> /dev/null - /usr/sbin/upsmon -c stop &> /dev/null - [ ! -z "$PID" ] && kill $PID &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - else - rm_daemon upsd - stat_done - fi diff --git a/abs/extra-testing/community/network-ups-tools/finish.upsd b/abs/extra-testing/community/network-ups-tools/finish.upsd new file mode 100644 index 0000000..4596ff1 --- /dev/null +++ b/abs/extra-testing/community/network-ups-tools/finish.upsd @@ -0,0 +1,10 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +svwaitdown -t 3 -k /var/service/upsdrvctl /var/service/upsmon || exit 1 + +PID=`pidof -o %PPID /usr/sbin/upsd` + stat_runit "Stopping UPSd Daemon" + [ ! -z "$PID" ] && kill $PID &> /dev/null diff --git a/abs/extra-testing/community/network-ups-tools/nut.install b/abs/extra-testing/community/network-ups-tools/nut.install index 5bec199..f7712a6 100644 --- a/abs/extra-testing/community/network-ups-tools/nut.install +++ b/abs/extra-testing/community/network-ups-tools/nut.install @@ -8,11 +8,18 @@ post_install() { echo ">>> Before starting your UPSd daemon, you must" echo ">>> edit /etc/ups/ups.conf in order to set your" echo ">>> UPS driver and port." - echo ">>> Then add upsd as a service." - echo ">>> $ sudo add_service.sh upsd." + echo ">>> Then add the following services: upsdrvctl | upsd | upsmon" + echo ">>> i.e. $ sudo add_service.sh upsdrvctl." +} + +post_upgrade() { + echo ">>> Ensure the following services exist: upsdrvctl | upsd | upsmon" + echo ">>> i.e. $ sudo add_service.sh upsdrvctl." } pre_remove() { + remove_service.sh upsdrvctl + remove_service.sh upsmon remove_service.sh upsd userdel nut >/dev/null 2>&1 groupdel nut >/dev/null 2>&1 diff --git a/abs/extra-testing/community/network-ups-tools/run b/abs/extra-testing/community/network-ups-tools/run deleted file mode 100644 index c4985fd..0000000 --- a/abs/extra-testing/community/network-ups-tools/run +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions - -PID=`pidof -o %PPID /usr/sbin/upsd` - - stat_runit "Starting UPSd Daemon" - /usr/bin/upsdrvctl start &> /dev/null - [ -z "$PID" ] && /usr/sbin/upsd &>/dev/null - /usr/sbin/upsmon &>/dev/null - if [ $? -gt 0 ]; then - stat_fail - else - add_daemon upsd - stat_done - fi - - while [ -n $PID ] ; do - sleep 60 - done diff --git a/abs/extra-testing/community/network-ups-tools/run.upsd b/abs/extra-testing/community/network-ups-tools/run.upsd new file mode 100644 index 0000000..b0a02a3 --- /dev/null +++ b/abs/extra-testing/community/network-ups-tools/run.upsd @@ -0,0 +1,9 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +svwaitup 3 /var/service/upsdrvctl || exit 1 + + stat_runit "Starting UPSd Daemon" + exec /usr/bin/upsd -D &> /dev/null diff --git a/abs/extra-testing/community/network-ups-tools/run.upsdrvctl b/abs/extra-testing/community/network-ups-tools/run.upsdrvctl new file mode 100644 index 0000000..eb787ba --- /dev/null +++ b/abs/extra-testing/community/network-ups-tools/run.upsdrvctl @@ -0,0 +1,7 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + + stat_runit "Starting UPS Driver Daemon" + exec /usr/bin/upsdrvctl -D &> /dev/null diff --git a/abs/extra-testing/community/network-ups-tools/run.upsmon b/abs/extra-testing/community/network-ups-tools/run.upsmon new file mode 100644 index 0000000..bbdc68d --- /dev/null +++ b/abs/extra-testing/community/network-ups-tools/run.upsmon @@ -0,0 +1,9 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +svwaitup 3 /var/service/upsdrvctl /var/service/upsd || exit 1 + + stat_runit "Starting UPS Monitor Daemon" + exec /usr/bin/upsmon -D &> /dev/null |