From ff57dccc6d55c3a33cad1aeca6147e1b4c8bb75a Mon Sep 17 00:00:00 2001 From: pav Date: Wed, 29 Mar 2006 12:03:54 +0000 Subject: - Update to 2.0.3 - Split rc.d script into three - one for each daemon - Introduce user configurable variable NUT_USER, defaults to uucp PR: ports/95015 Submitted by: Joerg Pulz (maintainer) --- sysutils/nut22/Makefile | 43 +++++++++++----------- sysutils/nut22/distinfo | 12 +++---- sysutils/nut22/files/nut.sh.in | 44 +++++++++++++++++++++++ sysutils/nut22/files/nut.sh.sample | 49 -------------------------- sysutils/nut22/files/nut_upslog.sh.in | 36 +++++++++++++++++++ sysutils/nut22/files/nut_upsmon.sh.in | 34 ++++++++++++++++++ sysutils/nut22/files/patch-Makefile.in | 14 +++----- sysutils/nut22/files/patch-drivers_Makefile.in | 11 ++++++ sysutils/nut22/pkg-plist | 13 ++++--- 9 files changed, 166 insertions(+), 90 deletions(-) create mode 100644 sysutils/nut22/files/nut.sh.in delete mode 100644 sysutils/nut22/files/nut.sh.sample create mode 100644 sysutils/nut22/files/nut_upslog.sh.in create mode 100644 sysutils/nut22/files/nut_upsmon.sh.in create mode 100644 sysutils/nut22/files/patch-drivers_Makefile.in (limited to 'sysutils/nut22') diff --git a/sysutils/nut22/Makefile b/sysutils/nut22/Makefile index edd9314862ff..70a860b49a31 100644 --- a/sysutils/nut22/Makefile +++ b/sysutils/nut22/Makefile @@ -6,8 +6,7 @@ # PORTNAME= nut -PORTVERSION= 2.0.2 -PORTREVISION= 1 +PORTVERSION= 2.0.3 CATEGORIES= sysutils MASTER_SITES= http://eu1.networkupstools.org/source/${PORTVERSION:R}/ \ http://us1.networkupstools.org/source/${PORTVERSION:R}/ @@ -30,29 +29,35 @@ CONFIGURE_ARGS= --sysconfdir=${PREFIX}/etc/nut \ --with-statepath=${STATEDIR} \ --with-altpidpath=${STATEDIR} \ --with-pidpath=${STATEDIR} \ - --with-linux-hiddev=no -USE_RC_SUBR= yes + --with-linux-hiddev=no \ + --with-user=${NUT_USER} + +NUT_USER?= uucp STATEDIR= ${DESTDIR}/var/db/nut .include .if ${SUBSYS} == base +USE_RC_SUBR= nut.sh nut_upsmon.sh nut_upslog.sh +SUB_LIST+= STATEDIR=${STATEDIR} +PLIST_SUB+= STATEDIR=${STATEDIR} + MAN5= ups.conf.5 upsd.conf.5 upsd.users.5 upsmon.conf.5 \ upssched.conf.5 MAN8= apcsmart.8 bcmxcp.8 belkin.8 belkinunv.8 bestuferrups.8 \ bestups.8 bestfcom.8 cpsups.8 cyberpower.8 etapro.8 everups.8 \ - fentonups.8 genericups.8 ippon.8 isbmex.8 liebert.8 \ - masterguard.8 metasys.8 mge-shut.8 mge-utalk.8 mustek.8 \ - nutupsdrv.8 oneac.8 powercom.8 powermust.8 safenet.8 sms.8 \ - solis.8 tripplite.8 tripplitesu.8 upsc.8 upscmd.8 upscode2.8 \ - upsd.8 upsdrvctl.8 upslog.8 upsmon.8 upsrw.8 upssched.8 \ - victronups.8 + fentonups.8 gamatronic.8 genericups.8 ippon.8 isbmex.8 \ + liebert.8 masterguard.8 metasys.8 mge-shut.8 mge-utalk.8 \ + mustek.8 nutupsdrv.8 oneac.8 powercom.8 powermust.8 safenet.8 \ + sms.8 solis.8 tripplite.8 tripplitesu.8 upsc.8 upscmd.8 \ + upscode2.8 upsd.8 upsdrvctl.8 upslog.8 upsmon.8 upsrw.8 \ + upssched.8 victronups.8 ALL_TARGET= all INSTALL_TARGET= install install-conf .if defined(WITH_NUT_CGI) -LIB_DEPENDS= gd.4:${PORTSDIR}/graphics/gd +LIB_DEPENDS+= gd.4:${PORTSDIR}/graphics/gd ALL_TARGET+= cgi INSTALL_TARGET+=install-cgi install-cgi-conf MAN5+= hosts.conf.5 upsset.conf.5 upsstats.html.5 @@ -76,15 +81,15 @@ PLIST_SUB+= CGIETC="@comment " .endif .if ${SUBSYS} == usb -LIB_DEPENDS= usb-0.1.8:${PORTSDIR}/devel/libusb +LIB_DEPENDS+= usb-0.1.8:${PORTSDIR}/devel/libusb ALL_TARGET= usb INSTALL_TARGET= install-usb -MAN8= newhidups.8 +MAN8= bcmxcp_usb.8 newhidups.8 tripplite_usb.8 .endif .if ${SUBSYS} == snmp -LIB_DEPENDS= netsnmp.9:${PORTSDIR}/net-mgmt/net-snmp +LIB_DEPENDS+= netsnmp.9:${PORTSDIR}/net-mgmt/net-snmp ALL_TARGET= snmp INSTALL_TARGET= install-snmp @@ -112,18 +117,12 @@ pre-install: .endif @${MKDIR} ${PREFIX}/libexec/nut @${MKDIR} ${STATEDIR} - @${CHOWN} uucp:wheel ${STATEDIR} + @${CHOWN} ${NUT_USER}:wheel ${STATEDIR} @${CHMOD} 0750 ${STATEDIR} -post-install: - @${SED} -e "s#%%PREFIX%%#${PREFIX}#g" \ - -e "s#%%RC_SUBR%%#${RC_SUBR}#g" \ - -e "s#%%STATEDIR%%#${STATEDIR}#g" \ - <${FILESDIR}/nut.sh.sample >${WRKSRC}/nut.sh - ${INSTALL_SCRIPT} ${WRKSRC}/nut.sh ${PREFIX}/etc/rc.d/nut.sh .if !defined(NOPORTDOCS) +post-install: @${MKDIR} ${DOCSDIR}/cables - @${MKDIR} ${DOCSDIR}/drivers ${INSTALL_DATA} ${WRKSRC}/docs/cables/*.txt ${DOCSDIR}/cables ${INSTALL_DATA} ${WRKSRC}/docs/*.txt ${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/docs/FAQ ${DOCSDIR} diff --git a/sysutils/nut22/distinfo b/sysutils/nut22/distinfo index 666f682a473f..90d364db3a63 100644 --- a/sysutils/nut22/distinfo +++ b/sysutils/nut22/distinfo @@ -1,6 +1,6 @@ -MD5 (nut-2.0.2.tar.gz) = 6560df8d0a42f0f585d34ed1ae8c6f67 -SHA256 (nut-2.0.2.tar.gz) = 0d79137da31bea3a042c0300ebada73fe46a7f1b4051e75c9b4acc94b2719c51 -SIZE (nut-2.0.2.tar.gz) = 609977 -MD5 (nut-2.0.2.tar.gz.sig) = 65bfaa136df1b0a1b73f983f51d706b3 -SHA256 (nut-2.0.2.tar.gz.sig) = 4fd823488011fc924039ddbbe0112af2a961a4e019b78219d22386e5d217ff29 -SIZE (nut-2.0.2.tar.gz.sig) = 65 +MD5 (nut-2.0.3.tar.gz) = ed2d3104d021a6ddb864f23d8cbd1cf6 +SHA256 (nut-2.0.3.tar.gz) = e4ded1fd1f119a71ee500d043bfa08d912d84793738d81b2bd08871e34ed8f95 +SIZE (nut-2.0.3.tar.gz) = 656376 +MD5 (nut-2.0.3.tar.gz.sig) = fa059f3c1310b80f36ba80f13e417bc2 +SHA256 (nut-2.0.3.tar.gz.sig) = 3677a547953abb04200ddf912bf07e9b06f81135a02edda5d31a5325f7c23a89 +SIZE (nut-2.0.3.tar.gz.sig) = 65 diff --git a/sysutils/nut22/files/nut.sh.in b/sysutils/nut22/files/nut.sh.in new file mode 100644 index 000000000000..9cd40c1430b5 --- /dev/null +++ b/sysutils/nut22/files/nut.sh.in @@ -0,0 +1,44 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: nut +# REQUIRE: NETWORKING +# BEFORE: LOGIN +# KEYWORD: shutdown + +# Define these nut_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/nut +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +nut_enable=${nut_enable-"NO"} +nut_prefix=${nut_prefix-"%%PREFIX%%"} + +. %%RC_SUBR%% + +name="nut" +rcvar=`set_rcvar` + +load_rc_config $name + +required_dirs="%%STATEDIR%%" +required_files="${nut_prefix}/etc/nut/ups.conf ${nut_prefix}/etc/nut/upsd.conf ${nut_prefix}/etc/nut/upsd.users" +command="${nut_prefix}/sbin/upsd" +pidfile="%%STATEDIR%%/upsd.pid" + +start_precmd="nut_prestart" +stop_postcmd="nut_poststop" + +nut_prestart() { + ${nut_prefix}/libexec/nut/upsdrvctl start +} + +nut_poststop() { + ${nut_prefix}/libexec/nut/upsdrvctl stop +} + +run_rc_command "$1" diff --git a/sysutils/nut22/files/nut.sh.sample b/sysutils/nut22/files/nut.sh.sample deleted file mode 100644 index 85638b71c5af..000000000000 --- a/sysutils/nut22/files/nut.sh.sample +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# -# $FreeBSD$ -# - -# PROVIDE: nut -# REQUIRE: NETWORKING -# BEFORE: LOGIN -# KEYWORD: shutdown - -# Define these nut_* variables in one of these files: -# /etc/rc.conf -# /etc/rc.conf.local -# /etc/rc.conf.d/nut -# -# DO NOT CHANGE THESE DEFAULT VALUES HERE -# -nut_enable=${nut_enable-"NO"} -nut_prefix=${nut_prefix-"%%PREFIX%%"} -nut_pidfile=${nut_pidfile-"%%STATEDIR%%/nut.pid"} -nut_upslog=${nut_upslog-"/var/log/ups.log"} -nut_upsloginterval=${nut_upsloginterval-"300"} -nut_upslogmail=${nut_upslogmail-"backups@localhost"} - -. %%RC_SUBR%% - -name="nut" -rcvar=`set_rcvar` - -required_dirs="%%STATEDIR%%" -required_files="${nut_prefix}/etc/nut/ups.conf ${nut_prefix}/etc/nut/upsd.conf ${nut_prefix}/etc/nut/upsd.users ${nut_prefix}/etc/nut/upsmon.conf" - -start_postcmd="nut_start" -stop_cmd="nut_stop" - -nut_start() { - ${nut_prefix}/libexec/nut/upsdrvctl start - ${nut_prefix}/sbin/upsd - ${nut_prefix}/sbin/upsmon localhost - ${nut_prefix}/bin/upslog -s ${nut_upslogmail} -l ${nut_upslog} -i ${nut_upsloginterval} -} - -nut_stop() { - /usr/bin/killall upslog upsmon upsd - ${nut_prefix}/libexec/nut/upsdrvctl stop -} - -load_rc_config $name -run_rc_command "$1" diff --git a/sysutils/nut22/files/nut_upslog.sh.in b/sysutils/nut22/files/nut_upslog.sh.in new file mode 100644 index 000000000000..908451b9c331 --- /dev/null +++ b/sysutils/nut22/files/nut_upslog.sh.in @@ -0,0 +1,36 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: nut_upslog +# REQUIRE: NETWORKING nut +# BEFORE: LOGIN +# KEYWORD: shutdown + +# Define these nut_upslog* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/nut_upslog +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +nut_upslog_enable=${nut_upslog_enable-"NO"} +nut_upslog_prefix=${nut_upslog_prefix-"%%PREFIX%%"} +nut_upslog_logfile=${nut_upslog_logfile-"/var/log/ups.log"} +nut_upslog_interval=${nut_upslog_interval-"300"} +nut_upslog_ups=${nut_upslog_ups-"myups@localhost"} + +. %%RC_SUBR%% + +name="nut_upslog" +rcvar=`set_rcvar` + +load_rc_config $name + +required_dirs="%%STATEDIR%%" +command="${nut_upslog_prefix}/bin/upslog" +pidfile="%%STATEDIR%%/upslog.pid" +nut_upslog_flags=${nut_upslog_flags-"-s ${nut_upslog_ups} -l ${nut_upslog_logfile} -i ${nut_upslog_interval}"} + +run_rc_command "$1" diff --git a/sysutils/nut22/files/nut_upsmon.sh.in b/sysutils/nut22/files/nut_upsmon.sh.in new file mode 100644 index 000000000000..5d5449dc3204 --- /dev/null +++ b/sysutils/nut22/files/nut_upsmon.sh.in @@ -0,0 +1,34 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: nut_upsmon +# REQUIRE: NETWORKING nut +# BEFORE: LOGIN +# KEYWORD: shutdown + +# Define these nut_upsmon* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/nut_upsmon +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +nut_upsmon_enable=${nut_upsmon_enable-"NO"} +nut_upsmon_prefix=${nut_upsmon_prefix-"%%PREFIX%%"} + +. %%RC_SUBR%% + +name="nut_upsmon" +rcvar=`set_rcvar` + +load_rc_config $name + +required_dirs="%%STATEDIR%%" +required_files="${nut_upsmon_prefix}/etc/nut/upsmon.conf" +command="${nut_upsmon_prefix}/sbin/upsmon" +pidfile="%%STATEDIR%%/upsmon.pid" +nut_upsmon_flags=${nut_upsmon_flags-"localhost"} + +run_rc_command "$1" diff --git a/sysutils/nut22/files/patch-Makefile.in b/sysutils/nut22/files/patch-Makefile.in index 313109b69c9c..72832e15e229 100644 --- a/sysutils/nut22/files/patch-Makefile.in +++ b/sysutils/nut22/files/patch-Makefile.in @@ -1,5 +1,5 @@ ---- Makefile.in.orig Thu Jan 27 15:33:15 2005 -+++ Makefile.in Fri Jul 8 21:45:32 2005 +--- Makefile.in.orig Mon Oct 10 04:12:51 2005 ++++ Makefile.in Thu Feb 23 19:44:12 2006 @@ -90,6 +90,12 @@ install-cgi-conf: @cd conf; $(MAKE) install-cgi-conf; cd ..; @@ -13,19 +13,15 @@ install-lib: @cd clients; $(MAKE) install-lib; cd ..; @cd man; $(MAKE) install-lib-man; cd ..; -@@ -98,9 +104,8 @@ +@@ -98,6 +104,7 @@ usb: build-usb build-usb: -- @cd drivers; $(MAKE) hidups; cd ..; -- @cd drivers; $(MAKE) newhidups; cd ..; -- @cd drivers; $(MAKE) energizerups; cd ..; + @cd common ; $(MAKE) || exit 1; cd ..; -+ @cd drivers; $(MAKE) newhidups || exit 1; cd ..; + @cd drivers; $(MAKE) build-usb; cd ..; install-usb: - @cd drivers; $(MAKE) install-usb; cd ..; -@@ -109,7 +114,8 @@ +@@ -107,7 +114,8 @@ snmp: build-snmp build-snmp: diff --git a/sysutils/nut22/files/patch-drivers_Makefile.in b/sysutils/nut22/files/patch-drivers_Makefile.in new file mode 100644 index 000000000000..5ef287b7ee51 --- /dev/null +++ b/sysutils/nut22/files/patch-drivers_Makefile.in @@ -0,0 +1,11 @@ +--- drivers/Makefile.in.orig Thu Feb 23 19:38:14 2006 ++++ drivers/Makefile.in Thu Feb 23 19:38:43 2006 +@@ -8,7 +8,7 @@ + + # other definitions + CC = @CC@ +-CFLAGS = -I../include @CFLAGS@ ++CFLAGS = -I../include @CFLAGS@ @LIBUSB_CFLAGS@ + PROGS = bestups fentonups apcsmart everups belkin masterguard powercom \ + cyberpower tripplite victronups genericups mge-utalk bestuferrups \ + isbmex etapro liebert sms esupssmart tripplitesu blazer safenet \ diff --git a/sysutils/nut22/pkg-plist b/sysutils/nut22/pkg-plist index 9a13cce0a3c8..61f1dcd07d66 100644 --- a/sysutils/nut22/pkg-plist +++ b/sysutils/nut22/pkg-plist @@ -1,4 +1,9 @@ +@unexec %D/etc/rc.d/nut_upslog.sh forcestop 2>/dev/null || true +@unexec %D/etc/rc.d/nut_upsmon.sh forcestop 2>/dev/null || true @unexec %D/etc/rc.d/nut.sh forcestop 2>/dev/null || true +@unexec %D/etc/rc.d/nut_upslog forcestop 2>/dev/null || true +@unexec %D/etc/rc.d/nut_upsmon forcestop 2>/dev/null || true +@unexec %D/etc/rc.d/nut forcestop 2>/dev/null || true bin/upsc bin/upscmd bin/upslog @@ -10,8 +15,6 @@ etc/nut/upsd.conf.sample etc/nut/upsd.users.sample etc/nut/upsmon.conf.sample etc/nut/upssched.conf.sample -@dirrmtry etc/nut -etc/rc.d/nut.sh libexec/nut/apcsmart libexec/nut/bcmxcp libexec/nut/belkin @@ -26,6 +29,7 @@ libexec/nut/esupssmart libexec/nut/etapro libexec/nut/everups libexec/nut/fentonups +libexec/nut/gamatronic libexec/nut/genericups libexec/nut/ippon libexec/nut/isbmex @@ -84,6 +88,7 @@ sbin/upssched %%PORTDOCS%%%%DOCSDIR%%/design.txt %%PORTDOCS%%%%DOCSDIR%%/developers.txt %%PORTDOCS%%%%DOCSDIR%%/ideas.txt +%%PORTDOCS%%%%DOCSDIR%%/hid-subdrivers.txt %%PORTDOCS%%%%DOCSDIR%%/new-drivers.txt %%PORTDOCS%%%%DOCSDIR%%/new-names.txt %%PORTDOCS%%%%DOCSDIR%%/osd-notify.txt @@ -96,8 +101,8 @@ sbin/upssched %%PORTDOCS%%%%DOCSDIR%%/ssl.txt %%PORTDOCS%%%%DOCSDIR%%/upssched.txt %%PORTDOCS%%@dirrm %%DOCSDIR%%/cables -%%PORTDOCS%%@dirrm %%DOCSDIR%%/drivers %%PORTDOCS%%@dirrm %%DOCSDIR%% +@dirrmtry etc/nut @dirrmtry libexec/nut -@unexec rmdir /var/db/nut 2>/dev/null || true +@dirrmtry %%STATEDIR%% %%CGIDIRRM%% -- cgit