pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/ups-nut sysutils/ups-nut: Rototill rc.d scripts
details: https://anonhg.NetBSD.org/pkgsrc/rev/bd52f061f4cd
branches: trunk
changeset: 391287:bd52f061f4cd
user: gdt <gdt%pkgsrc.org@localhost>
date: Sat Jan 07 16:16:10 2023 +0000
description:
sysutils/ups-nut: Rototill rc.d scripts
- Fix strange sh style: don't have then on a new line
- Ensure main daemons started before SERVERS
- Slot upsmon after SERVERS and before LOGIN
- Rewrite upsdriver instructions to make upsdrvctl the standard approach
- Drop compat for ancient (<1.6) NetBSD
diffstat:
sysutils/ups-nut/Makefile | 4 +-
sysutils/ups-nut/files/ups.sh | 20 +++++++----------
sysutils/ups-nut/files/upsd.sh | 8 ++----
sysutils/ups-nut/files/upsdriver.sh | 41 +++++++++++++++++-------------------
sysutils/ups-nut/files/upslog.sh | 11 ++++-----
sysutils/ups-nut/files/upsmon.sh | 9 +++----
6 files changed, 41 insertions(+), 52 deletions(-)
diffs (241 lines):
diff -r e97ef7920401 -r bd52f061f4cd sysutils/ups-nut/Makefile
--- a/sysutils/ups-nut/Makefile Sat Jan 07 15:32:28 2023 +0000
+++ b/sysutils/ups-nut/Makefile Sat Jan 07 16:16:10 2023 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.67 2022/08/22 22:27:12 tnn Exp $
+# $NetBSD: Makefile,v 1.68 2023/01/07 16:16:10 gdt Exp $
-PKGREVISION= 2
+PKGREVISION= 3
.include "Makefile.common"
PKGNAME= ups-${DISTNAME}
diff -r e97ef7920401 -r bd52f061f4cd sysutils/ups-nut/files/ups.sh
--- a/sysutils/ups-nut/files/ups.sh Sat Jan 07 15:32:28 2023 +0000
+++ b/sysutils/ups-nut/files/ups.sh Sat Jan 07 16:16:10 2023 +0000
@@ -1,11 +1,14 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: ups.sh,v 1.10 2002/09/20 02:02:01 grant Exp $
+# $NetBSD: ups.sh,v 1.11 2023/01/07 16:16:10 gdt Exp $
#
# KEYWORD: nostart
-if [ -f /etc/rc.subr ]
-then
+# NB: This file is not intended to be run automaticlally at boot. It
+# is a convenience script for humans to start or stop all 4 nut-ups
+# daemons as a group.
+
+if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
@@ -15,9 +18,6 @@
#
forward_commands()
{
- # Backward compat with NetBSD <1.6:
- [ -z "$rc_arg" ] && rc_arg=$_arg
-
for file in $COMMAND_LIST; do
$rcd_dir/$file $rc_arg
done
@@ -25,9 +25,6 @@
reverse_commands()
{
- # Backward compat with NetBSD <1.6:
- [ -z "$rc_arg" ] && rc_arg=$_arg
-
REVCOMMAND_LIST=
for file in $COMMAND_LIST; do
REVCOMMAND_LIST="$file $REVCOMMAND_LIST"
@@ -45,11 +42,10 @@
status_cmd="forward_commands"
extra_commands="status"
-if [ -f /etc/rc.subr ]
-then
+if [ -f /etc/rc.subr ]; then
run_rc_command "$1"
else
@ECHO@ -n " ${name}"
- _arg="$1"
+ rc_arg="$1"
${start_cmd}
fi
diff -r e97ef7920401 -r bd52f061f4cd sysutils/ups-nut/files/upsd.sh
--- a/sysutils/ups-nut/files/upsd.sh Sat Jan 07 15:32:28 2023 +0000
+++ b/sysutils/ups-nut/files/upsd.sh Sat Jan 07 16:16:10 2023 +0000
@@ -1,14 +1,13 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: upsd.sh,v 1.7 2006/08/15 12:07:15 ghen Exp $
+# $NetBSD: upsd.sh,v 1.8 2023/01/07 16:16:10 gdt Exp $
#
# PROVIDE: upsd
# REQUIRE: upsdriver
# BEFORE: upsmon
# KEYWORD: shutdown
-if [ -f /etc/rc.subr ]
-then
+if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
@@ -18,8 +17,7 @@
required_files="@NUT_CONFDIR@/${name}.conf"
pidfile="@NUT_STATEDIR@/${name}.pid"
-if [ -f /etc/rc.subr ]
-then
+if [ -f /etc/rc.subr ]; then
load_rc_config $name
run_rc_command "$1"
else
diff -r e97ef7920401 -r bd52f061f4cd sysutils/ups-nut/files/upsdriver.sh
--- a/sysutils/ups-nut/files/upsdriver.sh Sat Jan 07 15:32:28 2023 +0000
+++ b/sysutils/ups-nut/files/upsdriver.sh Sat Jan 07 16:16:10 2023 +0000
@@ -1,56 +1,53 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: upsdriver.sh,v 1.9 2018/09/21 00:59:53 jym Exp $
+# $NetBSD: upsdriver.sh,v 1.10 2023/01/07 16:16:10 gdt Exp $
#
# PROVIDE: upsdriver
# REQUIRE: NETWORK syslogd mountcritremote
#
-# You will need to set some variables in /etc/rc.conf to start the UPS
-# driver(s) properly, e.g.
+# The standard approach is to leave "upsdriver_type" unset, so that
+# upsdrvctl is used to start and stop the driver(s). (Note that a
+# system might have more than one UPS, and upsdrvctl should support
+# this.) See nutupsdrv(8), but upsdrvctl will invoke the driver
+# properly.
+#
+# An alternative is to set the driver type and flags. This only works
+# for a single driver. This approach is deprecated and may be removed.
#
# upsdriver=YES
# upsdriver_type="newapc"
# upsdriver_flags="-a smartups"
-#
-# 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 [ -f /etc/rc.subr ]
-then
+if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
name="upsdriver"
rcvar=$name
-if [ -f /etc/rc.subr ]
-then
+if [ -f /etc/rc.subr ]; then
load_rc_config $name
fi
-if [ "${upsdriver_type:-upsdrvctl}" = "upsdrvctl" ]
-then
+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"
+ # XXX implement status after upsdrvctl does
else
command="@PREFIX@/libexec/nut/${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"
+ # XXX Restructure upsname into variable, but really just
+ # delete this option.
+ #upsname=`echo $upsdriver_flags | sed -e 's/^-a //'
+ #pidfile="@NUT_STATEDIR@/${upsdriver_type}-${upsname}.pid"
fi
-if [ -f /etc/rc.subr ]
-then
+if [ -f /etc/rc.subr ]; then
run_rc_command "$1"
else
@ECHO@ -n " ${name}"
- if [ -n "${start_cmd}" ]
- then
+ if [ -n "${start_cmd}" ]; then
${start_cmd}
else
${command} ${upsdriver_flags} ${command_args}
diff -r e97ef7920401 -r bd52f061f4cd sysutils/ups-nut/files/upslog.sh
--- a/sysutils/ups-nut/files/upslog.sh Sat Jan 07 15:32:28 2023 +0000
+++ b/sysutils/ups-nut/files/upslog.sh Sat Jan 07 16:16:10 2023 +0000
@@ -1,9 +1,10 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: upslog.sh,v 1.6 2004/02/15 13:14:25 lukem Exp $
+# $NetBSD: upslog.sh,v 1.7 2023/01/07 16:16:10 gdt Exp $
#
# PROVIDE: upslog
-# REQUIRE: upsd
+# REQUIRE: upsd DAEMON
+# BEFORE: LOGIN
#
# You will need to set some variables in /etc/rc.conf to start upslog
# properly, e.g.
@@ -14,8 +15,7 @@
# Please refer to upslog(8) for more information about the arguments to pass
# to upslog.
-if [ -f /etc/rc.subr ]
-then
+if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
@@ -24,8 +24,7 @@
command="@PREFIX@/bin/${name}"
pidfile="@NUT_STATEDIR@/${name}.pid"
-if [ -f /etc/rc.subr ]
-then
+if [ -f /etc/rc.subr ]; then
load_rc_config $name
run_rc_command "$1"
else
diff -r e97ef7920401 -r bd52f061f4cd sysutils/ups-nut/files/upsmon.sh
--- a/sysutils/ups-nut/files/upsmon.sh Sat Jan 07 15:32:28 2023 +0000
+++ b/sysutils/ups-nut/files/upsmon.sh Sat Jan 07 16:16:10 2023 +0000
@@ -1,12 +1,12 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: upsmon.sh,v 1.7 2006/08/15 12:07:15 ghen Exp $
+# $NetBSD: upsmon.sh,v 1.8 2023/01/07 16:16:10 gdt Exp $
#
# PROVIDE: upsmon
+# BEFORE: SERVERS
# KEYWORD: shutdown
-if [ -f /etc/rc.subr ]
-then
+if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
@@ -16,8 +16,7 @@
pidfile="@NUT_STATEDIR@/${name}.pid"
required_files="@NUT_CONFDIR@/${name}.conf"
-if [ -f /etc/rc.subr ]
-then
+if [ -f /etc/rc.subr ]; then
load_rc_config $name
run_rc_command "$1"
else
Home |
Main Index |
Thread Index |
Old Index