summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorjlam <jlam>2001-11-21 20:39:40 +0000
committerjlam <jlam>2001-11-21 20:39:40 +0000
commit556710e5fadc5f77b89c26602bfd5dcf7f21198a (patch)
treec154ae430d28689b5d6058669c66eb3732fd8c8c /sysutils
parent7d4b3d58c0fd05a24dd9233bb6a2fb482c05e7fb (diff)
downloadpkgsrc-556710e5fadc5f77b89c26602bfd5dcf7f21198a.tar.gz
Be smarter about how to control the UPS drivers. If upsdriver_type is
unset, then we use upsdrvctl to control the UPS drivers. Otherwise, we control the one specified by ${upsdriver_type}.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/ups-nut/files/upsdriver.sh41
1 files changed, 30 insertions, 11 deletions
diff --git a/sysutils/ups-nut/files/upsdriver.sh b/sysutils/ups-nut/files/upsdriver.sh
index 5ba7f67da5c..5c332fe3018 100644
--- a/sysutils/ups-nut/files/upsdriver.sh
+++ b/sysutils/ups-nut/files/upsdriver.sh
@@ -1,6 +1,6 @@
#! /bin/sh
#
-# $NetBSD: upsdriver.sh,v 1.1 2001/11/21 15:50:56 jlam Exp $
+# $NetBSD: upsdriver.sh,v 1.2 2001/11/21 20:39:40 jlam Exp $
#
# PROVIDE: upsdriver
# REQUIRE: NETWORK syslogd mountcritremote
@@ -12,8 +12,9 @@
# upsdriver_type="newapc"
# upsdriver_flags="-a smartups"
#
-# Please refer to nutupsdrv(8) for more information about the arguments to
-# pass to the UPS drivers.
+# If "upsdriver_type" is unset, then use "upsdrvctl" to control the UPS
+# drivers. Please refer to nutupsdrv(8) for more information about the
+# arguments to pass to the UPS drivers.
if [ -d /etc/rc.d -a -f /etc/rc.subr ]
then
@@ -22,18 +23,36 @@ fi
name="upsdriver"
rcvar=$name
-command="@PREFIX@/sbin/ups-drivers/${upsdriver_type}"
-#
-# XXX - We need a way to easily determine the pidfile, which is of the form
-# XXX - @NUT_STATEDIR@/${updriver_type}-${tty}.pid
-#
-#pidfile="@NUT_STATEDIR@/${upsdriver_type}-${tty}.pid"
+
+if [ -d /etc/rc.d ]
+then
+ load_rc_config $name
+fi
+
+if [ "${upsdriver_type:-upsdrvctl}" = "upsdrvctl" ]
+then
+ ctl_command="@PREFIX@/sbin/upsdrvctl"
+ required_files="@NUT_CONFDIR@/ups.conf"
+ start_cmd="${ctl_command} start"
+ stop_cmd="${ctl_command} stop"
+else
+ command="@PREFIX@/sbin/ups-drivers/${upsdriver_type}"
+ #
+ # XXX - We need a way to easily determine the pidfile, which is of
+ # XXX - the form @NUT_STATEDIR@/${updriver_type}-${tty}.pid
+ #
+ #pidfile="@NUT_STATEDIR@/${upsdriver_type}-${tty}.pid"
+fi
if [ ! -d /etc/rc.d ]
then
@ECHO@ -n " ${name}"
- ${command} ${upsdriver_flags} ${command_args}
+ if [ -n "${start_cmd}" ]
+ then
+ ${start_cmd}
+ else
+ ${command} ${upsdriver_flags} ${command_args}
+ fi
else
- load_rc_config $name
run_rc_command "$1"
fi