summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authormartin <martin@pkgsrc.org>2001-03-11 19:20:50 +0000
committermartin <martin@pkgsrc.org>2001-03-11 19:20:50 +0000
commit25b4e14643d8c3e139c713201f0c922f0cc4359f (patch)
treef299226ccd45c0ac920e29956b6deccd969dd791 /sysutils
parent45a38999bd0dfb72aea4705478e46a1faedf0620 (diff)
downloadpkgsrc-25b4e14643d8c3e139c713201f0c922f0cc4359f.tar.gz
Bring upsd startup script more in line with /etc/rc.d and /etc/rc.conf.
Now updating does not destroy parts of the local configuration any more.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/ups-nut/Makefile4
-rw-r--r--sysutils/ups-nut/files/md52
-rw-r--r--sysutils/ups-nut/files/patch-sum3
-rwxr-xr-xsysutils/ups-nut/files/upsd38
-rw-r--r--sysutils/ups-nut/patches/patch-ac21
5 files changed, 42 insertions, 26 deletions
diff --git a/sysutils/ups-nut/Makefile b/sysutils/ups-nut/Makefile
index 2170cf010de..466a57339a9 100644
--- a/sysutils/ups-nut/Makefile
+++ b/sysutils/ups-nut/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2001/03/11 13:46:11 martin Exp $
+# $NetBSD: Makefile,v 1.5 2001/03/11 19:20:50 martin Exp $
#
DISTNAME= nut-0.44.3-pre5
@@ -67,7 +67,7 @@ pre-install:
post-install:
@${SED} -e "/%%PREFIX%%/s##${LOCALBASE}#g" \
- ${WRKSRC}/scripts/NetBSD/upsd \
+ files/upsd \
>${LOCALBASE}/etc/rc.d/upsd
@${CHMOD} 0755 ${LOCALBASE}/etc/rc.d/upsd
@${INSTALL} -d -o ${NUT_USER} -g ${NUT_GROUP} -m 0770 /var/db/nut
diff --git a/sysutils/ups-nut/files/md5 b/sysutils/ups-nut/files/md5
index 8bb828a196c..6a1c6872583 100644
--- a/sysutils/ups-nut/files/md5
+++ b/sysutils/ups-nut/files/md5
@@ -1,3 +1,3 @@
-$NetBSD: md5,v 1.2 2001/03/11 13:46:12 martin Exp $
+$NetBSD: md5,v 1.3 2001/03/11 19:20:51 martin Exp $
SHA1 (nut-0.44.3-pre5.tar.gz) = 066d62ec6ebd522aa9b7d0f046856cfb1a34f61a
diff --git a/sysutils/ups-nut/files/patch-sum b/sysutils/ups-nut/files/patch-sum
index b93bac912db..471eb778359 100644
--- a/sysutils/ups-nut/files/patch-sum
+++ b/sysutils/ups-nut/files/patch-sum
@@ -1,8 +1,7 @@
-$NetBSD: patch-sum,v 1.3 2001/03/11 16:22:08 martin Exp $
+$NetBSD: patch-sum,v 1.4 2001/03/11 19:20:51 martin Exp $
SHA1 (patch-aa) = 2919c36f928d7b3a22574f8ca0633cd11bb99c70
SHA1 (patch-ab) = da464964fd63f2c3cb34d06f2d6de9e5c1aa356a
-SHA1 (patch-ac) = 3713ae0f24c70789a85b8636db2864148b09a2b7
SHA1 (patch-ad) = 2e325eb1a8bd85ef81d265df76e866d8a31a6b57
SHA1 (patch-ae) = a895fb6f94730db349375b46e4649257cebdcc58
SHA1 (patch-af) = 6bc9661388928d6a294cdfa156e77aa5fe9669cb
diff --git a/sysutils/ups-nut/files/upsd b/sysutils/ups-nut/files/upsd
new file mode 100755
index 00000000000..8fcaddde58f
--- /dev/null
+++ b/sysutils/ups-nut/files/upsd
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# PROVIDE: upsd
+# REQUIRE: NETWORK syslogd mountcritremote
+
+# You need to set some parameters for this script in /etc/rc.conf,
+# examples are:
+#upsd=YES upsd_flags=""
+# upsd_dev="/dev/tty01"
+# upsd_driver="apcsmart"
+#upsmon=YES upsmon_host="localhost"
+
+. /etc/rc.conf
+
+if [ -z "$1" -o "x$1" = xstart ]; then
+ if [ "x${upsd}" = xYES ]; then
+ %%PREFIX%%/bin/${upsd_driver} ${upsd_flags} ${upsd_dev}
+ %%PREFIX%%/sbin/upsd
+ fi
+
+ if [ "x${upsmon}" = xYES ]; then
+ %%PREFIX%%/sbin/upsmon ${upsmon_host}
+ fi
+elif [ "x$1" = xstop ]; then
+ echo "Stopping upsd - caveat, this may not work if multiple instances are running"
+ dpid=`ps ax | fgrep %%PREFIX%%/bin/${upsd_driver} | fgrep -v fgrep | awk '{print $1}'`
+ upid=`ps ax | fgrep %%PREFIX%%/sbin/upsd | fgrep -v fgrep | awk '{print $1}'`
+ if [ ! -z "${upid}" ]; then
+ kill ${upid}
+ fi
+ if [ ! -z "${dpid}" ]; then
+ kill ${dpid}
+ fi
+ if [ -r /var/run/upsmon.pid ]; then
+ mpid=`/bin/cat /var/run/upsmon.pid`
+ kill ${mpid}
+ fi
+fi
diff --git a/sysutils/ups-nut/patches/patch-ac b/sysutils/ups-nut/patches/patch-ac
deleted file mode 100644
index f8f1aca384e..00000000000
--- a/sysutils/ups-nut/patches/patch-ac
+++ /dev/null
@@ -1,21 +0,0 @@
-$NetBSD: patch-ac,v 1.2 2001/03/11 13:46:12 martin Exp $
-
-diff -Pur scripts-orig/NetBSD/upsd.sh scripts/NetBSD/upsd.sh
---- scripts-orig/NetBSD/upsd Wed Dec 31 16:00:00 1969
-+++ scripts/NetBSD/upsd Thu Dec 14 21:19:34 2000
-@@ -0,0 +1,15 @@
-+#!/bin/sh
-+UPS_DRIVER="apcsmart"
-+DRIVER_OPTIONS=""
-+SPECIAL_FILE="/dev/dty00"
-+MONITOR_HOST="localhost"
-+
-+if [ -z "$1" -o "x$1" = xstart ]
-+then
-+ if [ x$MONITOR_HOST = xlocalhost ]
-+ then
-+ %%PREFIX%%/bin/$UPS_DRIVER $DRIVER_OPTIONS $SPECIAL_FILE
-+ %%PREFIX%%/sbin/upsd
-+ fi
-+ %%PREFIX%%/sbin/upsmon $MONITOR_HOST
-+fi