pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [pkgsrc-2022Q3] pkgsrc/sysutils/ups-nut



Module Name:    pkgsrc
Committed By:   gdt
Date:           Sat Jan  7 16:07:59 UTC 2023

Modified Files:
        pkgsrc/sysutils/ups-nut [pkgsrc-2022Q3]: Makefile
        pkgsrc/sysutils/ups-nut/files [pkgsrc-2022Q3]: ups.sh upsd.sh
            upsdriver.sh upslog.sh upsmon.sh

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.67.2.1 pkgsrc/sysutils/ups-nut/Makefile
cvs rdiff -u -r1.10 -r1.10.158.1 pkgsrc/sysutils/ups-nut/files/ups.sh
cvs rdiff -u -r1.7 -r1.7.134.1 pkgsrc/sysutils/ups-nut/files/upsd.sh \
    pkgsrc/sysutils/ups-nut/files/upsmon.sh
cvs rdiff -u -r1.9 -r1.9.34.1 pkgsrc/sysutils/ups-nut/files/upsdriver.sh
cvs rdiff -u -r1.6 -r1.6.154.1 pkgsrc/sysutils/ups-nut/files/upslog.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/sysutils/ups-nut/Makefile
diff -u pkgsrc/sysutils/ups-nut/Makefile:1.67 pkgsrc/sysutils/ups-nut/Makefile:1.67.2.1
--- pkgsrc/sysutils/ups-nut/Makefile:1.67       Mon Aug 22 22:27:12 2022
+++ pkgsrc/sysutils/ups-nut/Makefile    Sat Jan  7 16:07:58 2023
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.67 2022/08/22 22:27:12 tnn Exp $
+# $NetBSD: Makefile,v 1.67.2.1 2023/01/07 16:07:58 gdt Exp $
 
-PKGREVISION= 2
+PKGREVISION= 3
 .include "Makefile.common"
 
 PKGNAME=               ups-${DISTNAME}

Index: pkgsrc/sysutils/ups-nut/files/ups.sh
diff -u pkgsrc/sysutils/ups-nut/files/ups.sh:1.10 pkgsrc/sysutils/ups-nut/files/ups.sh:1.10.158.1
--- pkgsrc/sysutils/ups-nut/files/ups.sh:1.10   Fri Sep 20 02:02:01 2002
+++ pkgsrc/sysutils/ups-nut/files/ups.sh        Sat Jan  7 16:07:59 2023
@@ -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.10.158.1 2023/01/07 16:07:59 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 @@ rcd_dir=`@DIRNAME@ $0`
 #
 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 @@ forward_commands()
 
 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 @@ stop_cmd="reverse_commands"
 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

Index: pkgsrc/sysutils/ups-nut/files/upsd.sh
diff -u pkgsrc/sysutils/ups-nut/files/upsd.sh:1.7 pkgsrc/sysutils/ups-nut/files/upsd.sh:1.7.134.1
--- pkgsrc/sysutils/ups-nut/files/upsd.sh:1.7   Tue Aug 15 12:07:15 2006
+++ pkgsrc/sysutils/ups-nut/files/upsd.sh       Sat Jan  7 16:07:59 2023
@@ -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.7.134.1 2023/01/07 16:07:59 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 @@ command="@PREFIX@/sbin/${name}"
 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
Index: pkgsrc/sysutils/ups-nut/files/upsmon.sh
diff -u pkgsrc/sysutils/ups-nut/files/upsmon.sh:1.7 pkgsrc/sysutils/ups-nut/files/upsmon.sh:1.7.134.1
--- pkgsrc/sysutils/ups-nut/files/upsmon.sh:1.7 Tue Aug 15 12:07:15 2006
+++ pkgsrc/sysutils/ups-nut/files/upsmon.sh     Sat Jan  7 16:07:59 2023
@@ -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.7.134.1 2023/01/07 16:07:59 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 @@ command="@PREFIX@/sbin/${name}"
 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

Index: pkgsrc/sysutils/ups-nut/files/upsdriver.sh
diff -u pkgsrc/sysutils/ups-nut/files/upsdriver.sh:1.9 pkgsrc/sysutils/ups-nut/files/upsdriver.sh:1.9.34.1
--- pkgsrc/sysutils/ups-nut/files/upsdriver.sh:1.9      Fri Sep 21 00:59:53 2018
+++ pkgsrc/sysutils/ups-nut/files/upsdriver.sh  Sat Jan  7 16:07:59 2023
@@ -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.9.34.1 2023/01/07 16:07:59 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}

Index: pkgsrc/sysutils/ups-nut/files/upslog.sh
diff -u pkgsrc/sysutils/ups-nut/files/upslog.sh:1.6 pkgsrc/sysutils/ups-nut/files/upslog.sh:1.6.154.1
--- pkgsrc/sysutils/ups-nut/files/upslog.sh:1.6 Sun Feb 15 13:14:25 2004
+++ pkgsrc/sysutils/ups-nut/files/upslog.sh     Sat Jan  7 16:07:59 2023
@@ -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.6.154.1 2023/01/07 16:07:59 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 @@ rcvar="${name}"
 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



Home | Main Index | Thread Index | Old Index