Date: Sun, 4 Dec 2005 15:41:37 +0100 (CET) From: Martin Matuska <martin@matuska.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/89940: [PATCH] Client-only support for sysutils/nut Message-ID: <20051204144137.42FD422A19@mail.vx.sk> Resent-Message-ID: <200512041450.jB4Eo295044814@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 89940 >Category: ports >Synopsis: [PATCH] Client-only support for sysutils/nut >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Dec 04 14:50:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Martin Matuska >Release: FreeBSD 6.0-RELEASE >Organization: >Environment: FreeBSD 6.0-RELEASE i386 amd64 >Description: Added optional NUTUSER variable NUT is a client-server app so it is desirable to support client-only mode. A user may not wish to run upsmon on the system with UPS installed and/or have systems dependent on the UPS that require upsmon only for monitoring. Removed upsmon from: nut.sh Client-only script: nut_upsmon.sh >How-To-Repeat: >Fix: diff -Nbur sysutils/nut.orig/Makefile sysutils/nut/Makefile --- sysutils/nut.orig/Makefile Sun Dec 4 14:13:07 2005 +++ sysutils/nut/Makefile Sun Dec 4 14:48:26 2005 @@ -22,6 +22,8 @@ PKGNAMESUFFIX= -${SUBSYS} .endif +NUTUSER?= uucp + GNU_CONFIGURE= yes CONFIGURE_ARGS= --sysconfdir=${PREFIX}/etc/nut \ --localstatedir=${STATEDIR} \ @@ -30,7 +32,8 @@ --with-statepath=${STATEDIR} \ --with-altpidpath=${STATEDIR} \ --with-pidpath=${STATEDIR} \ - --with-linux-hiddev=no + --with-linux-hiddev=no \ + --with-user=${NUTUSER} USE_RC_SUBR= yes STATEDIR= ${DESTDIR}/var/db/nut @@ -112,23 +115,25 @@ .endif @${MKDIR} ${PREFIX}/libexec/nut @${MKDIR} ${STATEDIR} - @${CHOWN} uucp:wheel ${STATEDIR} + @${CHOWN} ${NUTUSER}:wheel ${STATEDIR} @${CHMOD} 0750 ${STATEDIR} post-install: +.for FILE in nut.sh nut_upsmon.sh @${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 + <${FILESDIR}/${FILE}.sample >${WRKSRC}/${FILE} + ${INSTALL_SCRIPT} ${WRKSRC}/${FILE} ${PREFIX}/etc/rc.d/${FILE} +.endfor .if !defined(NOPORTDOCS) @${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} -.for file in CHANGES CREDITS INSTALL NEWS README UPGRADING - ${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR} +.for FILE in CHANGES CREDITS INSTALL NEWS README UPGRADING + ${INSTALL_DATA} ${WRKSRC}/${FILE} ${DOCSDIR} .endfor .endif diff -Nbur sysutils/nut.orig/files/nut.sh.sample sysutils/nut/files/nut.sh.sample --- sysutils/nut.orig/files/nut.sh.sample Sun Dec 4 14:13:07 2005 +++ sysutils/nut/files/nut.sh.sample Sun Dec 4 14:38:09 2005 @@ -28,7 +28,7 @@ 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" +required_files="${nut_prefix}/etc/nut/ups.conf ${nut_prefix}/etc/nut/upsd.conf ${nut_prefix}/etc/nut/upsd.users" start_postcmd="nut_start" stop_cmd="nut_stop" @@ -36,12 +36,11 @@ 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 + /usr/bin/killall upslog upsd ${nut_prefix}/libexec/nut/upsdrvctl stop } diff -Nbur sysutils/nut.orig/files/nut_upsmon.sh.sample sysutils/nut/files/nut_upsmon.sh.sample --- sysutils/nut.orig/files/nut_upsmon.sh.sample Thu Jan 1 01:00:00 1970 +++ sysutils/nut/files/nut_upsmon.sh.sample Sun Dec 4 14:46:09 2005 @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $FreeBSD: ports/sysutils/nut/files/nut.sh.sample,v 1.5 2005/07/14 08:21:12 sem Exp $ +# + +# PROVIDE: nutmon +# 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_upsmon_enable=${nut_upsmon_enable-"NO"} +nut_prefix=${nut_prefix-"%%PREFIX%%"} + +. %%RC_SUBR%% + +name="nut_upsmon" +rcvar=`set_rcvar` + +command="${nut_prefix}/sbin/upsmon" +required_files="${nut_prefix}/etc/nut/upsmon.conf" + +load_rc_config $name +run_rc_command "$1" diff -Nbur sysutils/nut.orig/pkg-plist sysutils/nut/pkg-plist --- sysutils/nut.orig/pkg-plist Sun Dec 4 14:13:07 2005 +++ sysutils/nut/pkg-plist Sun Dec 4 14:37:40 2005 @@ -12,6 +12,7 @@ etc/nut/upssched.conf.sample @unexec rmdir %D/etc/nut 2>/dev/null || true etc/rc.d/nut.sh +etc/rc.d/nut_upsmon.sh libexec/nut/apcsmart libexec/nut/bcmxcp libexec/nut/belkin >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051204144137.42FD422A19>