From 10b4773ed5a39f59be3b9d9de0ddd7a53381df99 Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verison.net>
Date: Thu, 25 Mar 2010 17:42:02 +0000
Subject: network-ups-tools: Revert recent changes because they did not work as
 expected re-instated looper in the run file

---
 abs/extra-testing/community/network-ups-tools/PKGBUILD   | 13 ++++---------
 .../community/network-ups-tools/finish.upsd              | 14 ++++++++++----
 .../community/network-ups-tools/nut.install              | 11 ++---------
 abs/extra-testing/community/network-ups-tools/run.upsd   | 16 ++++++++++++++--
 .../community/network-ups-tools/run.upsdrvctl            |  7 -------
 abs/extra-testing/community/network-ups-tools/run.upsmon |  9 ---------
 6 files changed, 30 insertions(+), 40 deletions(-)
 delete mode 100644 abs/extra-testing/community/network-ups-tools/run.upsdrvctl
 delete mode 100644 abs/extra-testing/community/network-ups-tools/run.upsmon

diff --git a/abs/extra-testing/community/network-ups-tools/PKGBUILD b/abs/extra-testing/community/network-ups-tools/PKGBUILD
index bffe5ea..2b90eb7 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=3
+pkgrel=4
 pkgdesc="NUT is a collection of programs for monitoring and administering UPS hardware"
 arch=('i686' 'x86_64')
 url="http://www.networkupstools.org/"
@@ -13,8 +13,7 @@ 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.upsdrvctl run.upsd finish.upsd run.upsmon)
+source=(http://www.networkupstools.org/source/2.4/nut-$pkgver.tar.gz run.upsd finish.upsd)
 options=('!emptydirs' '!libtool')
 
 build() {
@@ -41,10 +40,8 @@ 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.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
@@ -52,7 +49,5 @@ cd $srcdir/nut-$pkgver
   mv ${pkgdir}/etc/udev ${pkgdir}/lib
 }
 md5sums=('6f893b61b07915e7a139324fa3f79121'
-         'a84cbe7194fa85f0cf5eb6993f4a5bda'
-         '3e456bf9a9a5f592bc11f2f8c78580e2'
-         '97828241b3a258ae7ab1481cd181c7da'
-         'af4fc006d2e1987b4b65580ed3c493bb')
+         'd7af81650a966660f6fd41f957c66165'
+         'd50f13385848a9bb8f8cbc9ee5dd9fd5')
diff --git a/abs/extra-testing/community/network-ups-tools/finish.upsd b/abs/extra-testing/community/network-ups-tools/finish.upsd
index 4596ff1..8eb335b 100644
--- a/abs/extra-testing/community/network-ups-tools/finish.upsd
+++ b/abs/extra-testing/community/network-ups-tools/finish.upsd
@@ -3,8 +3,14 @@
 . /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
+     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/nut.install b/abs/extra-testing/community/network-ups-tools/nut.install
index f7712a6..f2f02d6 100644
--- a/abs/extra-testing/community/network-ups-tools/nut.install
+++ b/abs/extra-testing/community/network-ups-tools/nut.install
@@ -8,18 +8,11 @@ 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 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."
+  echo ">>> Then add the the upsd service:"
+  echo ">>> $ sudo add_service.sh upsd"
 }
 
 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.upsd b/abs/extra-testing/community/network-ups-tools/run.upsd
index b0a02a3..83be88d 100644
--- a/abs/extra-testing/community/network-ups-tools/run.upsd
+++ b/abs/extra-testing/community/network-ups-tools/run.upsd
@@ -3,7 +3,19 @@
 . /etc/rc.conf
 . /etc/rc.d/functions
 
-svwaitup 3 /var/service/upsdrvctl || exit 1
+PID=`pidof -o %PPID /usr/sbin/upsd`
 
     stat_runit "Starting UPSd Daemon"
-      exec /usr/bin/upsd -D &> /dev/null
+    /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.upsdrvctl b/abs/extra-testing/community/network-ups-tools/run.upsdrvctl
deleted file mode 100644
index eb787ba..0000000
--- a/abs/extra-testing/community/network-ups-tools/run.upsdrvctl
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/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
deleted file mode 100644
index bbdc68d..0000000
--- a/abs/extra-testing/community/network-ups-tools/run.upsmon
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/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
-- 
cgit v0.12

