From nobody Sun Aug 28 21:19:39 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MG60C5py5z4bNmT; Sun, 28 Aug 2022 21:19:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MG60C5Lxqz3r52; Sun, 28 Aug 2022 21:19:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661721579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A2dEvxSSNawWfdOj/fPXTS5V8AoeKp1SxXpskz+c90k=; b=ZuukTMGq9zgGiw1PclFUJpoFALuWca/e/AWw4/OUdO/+ACS0lcHNcqMu/WPangpoEH6QjW 9gy1+V3+UOAjdghSt5Z+F6+fDTfUowmnKjnFcialKGQNMjBT6MoiZFuF9p0LnvbILaD9Or SHebfM5z12EMBDt5ZPaKG+cbd94q5yogm5aBbTTRaj9Rh0j69l6aXwX66BpUwrcTU0Ghao J27lQLQAste0i/K9SkW7mxwR6Ec5L0H4Rk5uB0NUgDpf1oJ8grdKYS86zbErtJ+Xa9DPDI kZ4ImtZD/DYJhbU90tb2M+stb4HJt9N5i2a35HiyjxoNSJEgBskygSJ1ZDy2rw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MG60C44YRz1CBK; Sun, 28 Aug 2022 21:19:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27SLJdZ5034179; Sun, 28 Aug 2022 21:19:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27SLJd8U034178; Sun, 28 Aug 2022 21:19:39 GMT (envelope-from git) Date: Sun, 28 Aug 2022 21:19:39 GMT Message-Id: <202208282119.27SLJd8U034178@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Cy Schubert Subject: git: 0b5e039674aa - main - sysutils/nut*: Alternate upslog support for multiple UPSs List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b5e039674aa1f529e2ebc67da11bdadcb4db6e6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661721579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A2dEvxSSNawWfdOj/fPXTS5V8AoeKp1SxXpskz+c90k=; b=iBD2WDjrA3cDHR6kFctmpiIJBz++dkrq+Bb1dPLANUWIPkLosrRvZdGyaqw01nhnTREGMc 6mxKrV8DMep1aOvDi1OcN++NgubePbmVwkkEmBdh+FrKbQSEKTkicuaq3rtxM6Qzqn3W8d lrin2zr3/fZhXvdQWFsjs+8QfLdxnjWFeJq3q/sOGTYARA7w/l7knR/dT4oTu6/SakV591 YNgcomUsiCg1rVviAJFWyLJ725KJdBJ1udKlBPX/spUwIQxoOBWEgy9YFnSM0QVNYTRWGj THaveYi674KFKT2pOPt/owYQ9H+s/iPSgUhyn9RQ3puokr3nqIhsBVrwbTGc8A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661721579; a=rsa-sha256; cv=none; b=mkqS9n+IbfOFD9zAteQmi5SJhBk+3gdkkvJnJnCUY+9sVuqB0PY/IDgL9/rFlQ+mM62Tor caM0OD5ONtxl71hk/N3TKEtXpc33cda0i8++cXuIcXYjX+tDrLB0XxP3pf9WhN6hUBk3Oz A0TI2Lyyg7TNENSYRwg/237HK5CoaeIK81z5dKDusIeFXbXB/uIGCps7S+q7tJj715Fvmq Ax/a570V1qck6KYqS8eiwH96aXZZudknKQibgFAbGaWU6VyEiCEGpeUturNX7TRP1yothc Sp+xsyCkalbhXLWDFHFgGbTDEKiYpprBDfSmPuYdrb+9OlFCPm0oS8VZb2pBew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/ports/commit/?id=0b5e039674aa1f529e2ebc67da11bdadcb4db6e6 commit 0b5e039674aa1f529e2ebc67da11bdadcb4db6e6 Author: Cy Schubert AuthorDate: 2022-08-21 15:21:51 +0000 Commit: Cy Schubert CommitDate: 2022-08-28 21:16:40 +0000 sysutils/nut*: Alternate upslog support for multiple UPSs Add sample rc script to allow a user to copy a sample rc script to rc.d, allowing the user to use multiple instances of upslog(8) with multiple instances of the rc script to log multiple UPSs on the same system. The sample rc script was provided by vvd@unislabs.com. PR: 265963 Reported by: vvd@unislabs.com Submitted by: vvd@unislabs.com --- sysutils/nut-devel/Makefile | 3 +- sysutils/nut-devel/files/nut_upslog.sample | 52 ++++++++++++++++++++++++++++++ sysutils/nut-devel/pkg-plist | 1 + sysutils/nut/Makefile | 3 +- sysutils/nut/files/nut_upslog.sample | 52 ++++++++++++++++++++++++++++++ sysutils/nut/pkg-plist | 1 + 6 files changed, 110 insertions(+), 2 deletions(-) diff --git a/sysutils/nut-devel/Makefile b/sysutils/nut-devel/Makefile index e40b38582e55..d2d54676e8dc 100644 --- a/sysutils/nut-devel/Makefile +++ b/sysutils/nut-devel/Makefile @@ -1,6 +1,6 @@ PORTNAME= nut PORTVERSION= ${NUT_COMMIT_DATE} -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils PKGNAMESUFFIX= -devel # MASTER_SITES= http://www.networkupstools.org/source/${PORTVERSION:R}/ @@ -164,6 +164,7 @@ post-install: @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} ${INSTALL_DATA} ${PATCHDIR}/nut.syslog ${STAGEDIR}${EXAMPLESDIR}/syslog.sample ${INSTALL_DATA} ${PATCHDIR}/nut.newsyslog ${STAGEDIR}${EXAMPLESDIR}/newsyslog.sample + ${INSTALL_DATA} ${PATCHDIR}/nut_upslog.sample ${STAGEDIR}${EXAMPLESDIR}/nut_upslog.sample ${MKDIR} ${STAGEDIR}/var/log/nut .include diff --git a/sysutils/nut-devel/files/nut_upslog.sample b/sysutils/nut-devel/files/nut_upslog.sample new file mode 100644 index 000000000000..126a47a70d3a --- /dev/null +++ b/sysutils/nut-devel/files/nut_upslog.sample @@ -0,0 +1,52 @@ +#!/bin/sh + +# Authored by vvd@unislabs.com. + +# PROVIDE: nut_upslog +# REQUIRE: NETWORKING nut +# BEFORE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +case $0 in +/etc/rc*) + # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), + # so get the name of the script from $_file + name=$_file + ;; +*) + name=$0 + ;; +esac + +name=${name##*/} +rcvar=${name}_enable + +load_rc_config "${name}" + +# Define these nut_upslog* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/nut_upslog +# +# If you want to log several different UPSes: +# ln -s nut_upslog /usr/local/etc/rc.d/NAME +# then set variables NAME_enable, NAME_ups, NAME_pidbase, NAME_logfile and etc. +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +eval "${rcvar}=\${${rcvar}:-'NO'}" +eval "_prefix=\${${name}_prefix:-'/usr/local'}" +eval "_logfile=\${${name}_logfile:-'/var/log/nut/ups.log'}" +eval "_interval=\${${name}_interval:-'300'}" +eval "_ups=\${${name}_ups:-'myups@localhost'}" +eval "_pidbase=\${${name}_pidbase:-'upslog'}" +eval "_format=\${${name}_format:+-f \${${name}_format}}" +eval "${name}_flags=\${${name}_flags:-'-s ${_ups} -l ${_logfile} -i ${_interval} -p ${_pidbase} ${_format}'}" + +required_dirs="%%STATEDIR%%" +pidfile="%%STATEDIR%%/${_pidbase}.pid" +command="${_prefix}/bin/upslog" + +run_rc_command "$1" diff --git a/sysutils/nut-devel/pkg-plist b/sysutils/nut-devel/pkg-plist index 66f4d6398ca9..d8fb87805dce 100644 --- a/sysutils/nut-devel/pkg-plist +++ b/sysutils/nut-devel/pkg-plist @@ -18,6 +18,7 @@ @sample %%ETCDIR%%/upsmon.conf.sample @sample %%ETCDIR%%/upssched.conf.sample @sample %%EXAMPLESDIR%%/newsyslog.sample etc/newsyslog.conf.d/nut.conf +@sample %%EXAMPLESDIR%%/nut_upslog.sample @sample %%EXAMPLESDIR%%/syslog.sample etc/syslog.d/nut %%USB%%etc/devd/nut-usb.conf bin/nut-scanner diff --git a/sysutils/nut/Makefile b/sysutils/nut/Makefile index e388164c19b6..4d5bacca82db 100644 --- a/sysutils/nut/Makefile +++ b/sysutils/nut/Makefile @@ -1,6 +1,6 @@ PORTNAME= nut PORTVERSION= 2.8.0 -PORTREVISION= 7 +PORTREVISION= 8 CATEGORIES= sysutils MASTER_SITES= http://www.networkupstools.org/source/${PORTVERSION:R}/ @@ -142,6 +142,7 @@ post-install: @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} ${INSTALL_DATA} ${PATCHDIR}/nut.syslog ${STAGEDIR}${EXAMPLESDIR}/syslog.sample ${INSTALL_DATA} ${PATCHDIR}/nut.newsyslog ${STAGEDIR}${EXAMPLESDIR}/newsyslog.sample + ${INSTALL_DATA} ${PATCHDIR}/nut_upslog.sample ${STAGEDIR}${EXAMPLESDIR}/nut_upslog.sample ${MKDIR} ${STAGEDIR}/var/log/nut @${RM} ${STAGEDIR}${PREFIX}/etc/nut/solaris-init/nut @${RMDIR} ${STAGEDIR}${PREFIX}/etc/nut/solaris-init diff --git a/sysutils/nut/files/nut_upslog.sample b/sysutils/nut/files/nut_upslog.sample new file mode 100644 index 000000000000..126a47a70d3a --- /dev/null +++ b/sysutils/nut/files/nut_upslog.sample @@ -0,0 +1,52 @@ +#!/bin/sh + +# Authored by vvd@unislabs.com. + +# PROVIDE: nut_upslog +# REQUIRE: NETWORKING nut +# BEFORE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +case $0 in +/etc/rc*) + # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), + # so get the name of the script from $_file + name=$_file + ;; +*) + name=$0 + ;; +esac + +name=${name##*/} +rcvar=${name}_enable + +load_rc_config "${name}" + +# Define these nut_upslog* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/nut_upslog +# +# If you want to log several different UPSes: +# ln -s nut_upslog /usr/local/etc/rc.d/NAME +# then set variables NAME_enable, NAME_ups, NAME_pidbase, NAME_logfile and etc. +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +eval "${rcvar}=\${${rcvar}:-'NO'}" +eval "_prefix=\${${name}_prefix:-'/usr/local'}" +eval "_logfile=\${${name}_logfile:-'/var/log/nut/ups.log'}" +eval "_interval=\${${name}_interval:-'300'}" +eval "_ups=\${${name}_ups:-'myups@localhost'}" +eval "_pidbase=\${${name}_pidbase:-'upslog'}" +eval "_format=\${${name}_format:+-f \${${name}_format}}" +eval "${name}_flags=\${${name}_flags:-'-s ${_ups} -l ${_logfile} -i ${_interval} -p ${_pidbase} ${_format}'}" + +required_dirs="%%STATEDIR%%" +pidfile="%%STATEDIR%%/${_pidbase}.pid" +command="${_prefix}/bin/upslog" + +run_rc_command "$1" diff --git a/sysutils/nut/pkg-plist b/sysutils/nut/pkg-plist index 51fabcb8782c..d8fbf6fc4567 100644 --- a/sysutils/nut/pkg-plist +++ b/sysutils/nut/pkg-plist @@ -18,6 +18,7 @@ @sample %%ETCDIR%%/upsmon.conf.sample @sample %%ETCDIR%%/upssched.conf.sample @sample %%EXAMPLESDIR%%/newsyslog.sample etc/newsyslog.conf.d/nut.conf +@sample %%EXAMPLESDIR%%/nut_upslog.sample @sample %%EXAMPLESDIR%%/syslog.sample etc/syslog.d/nut %%USB%%etc/devd/nut-usb.conf bin/nut-scanner