From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Dec 4 14:50:04 2005 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7A24916A41F for ; Sun, 4 Dec 2005 14:50:04 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF9A143D53 for ; Sun, 4 Dec 2005 14:50:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id jB4Eo2iJ044815 for ; Sun, 4 Dec 2005 14:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id jB4Eo295044814; Sun, 4 Dec 2005 14:50:02 GMT (envelope-from gnats) Resent-Date: Sun, 4 Dec 2005 14:50:02 GMT Resent-Message-Id: <200512041450.jB4Eo295044814@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Martin Matuska Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0F88B16A41F for ; Sun, 4 Dec 2005 14:41:44 +0000 (GMT) (envelope-from rebum@mail.vx.sk) Received: from mail.vx.sk (de.vx.sk [217.20.112.111]) by mx1.FreeBSD.org (Postfix) with ESMTP id 413A943D46 for ; Sun, 4 Dec 2005 14:41:39 +0000 (GMT) (envelope-from rebum@mail.vx.sk) Received: from localhost (localhost [127.0.0.1]) by mail.vx.sk (Postfix) with ESMTP id 2FF7B22A1B for ; Sun, 4 Dec 2005 15:41:38 +0100 (CET) Received: from mail.vx.sk ([127.0.0.1]) by localhost (mail.vx.sk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 04521-04 for ; Sun, 4 Dec 2005 15:41:37 +0100 (CET) Received: by mail.vx.sk (Postfix, from userid 1001) id 42FD422A19; Sun, 4 Dec 2005 15:41:37 +0100 (CET) Message-Id: <20051204144137.42FD422A19@mail.vx.sk> Date: Sun, 4 Dec 2005 15:41:37 +0100 (CET) From: Martin Matuska To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/89940: [PATCH] Client-only support for sysutils/nut X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Martin Matuska List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2005 14:50:04 -0000 >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: