ports/177632: [MAINTAINER] net-mgmt/netdisco: rc script corrections
Geoffroy Desvernay
dgeo at centrale-marseille.fr
Thu Apr 4 14:00:01 UTC 2013
>Number: 177632
>Category: ports
>Synopsis: [MAINTAINER] net-mgmt/netdisco: rc script corrections
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: maintainer-update
>Submitter-Id: current-users
>Arrival-Date: Thu Apr 04 14:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Geoffroy Desvernay
>Release: FreeBSD 9.1-RELEASE amd64
>Organization:
Ecole Centrale de Marseille
>Environment:
System: FreeBSD dgeo.sysadm.ec-m.fr 9.1-RELEASE FreeBSD 9.1-RELEASE #0: Tue Dec 18 11:55:35 CET 2012
>Description:
- didn't start as $netdisco_user but as root
- NETDISCO_GROUP wasn't replaced in the script
Generated with FreeBSD Port Tools 0.99_7 (mode: change, diff: SVN)
>How-To-Repeat:
>Fix:
attached.
Feature safe: yes
--- netdisco-1.1.patch begins here ---
Index: Makefile
===================================================================
--- Makefile (revision 315717)
+++ Makefile (working copy)
@@ -1,7 +1,4 @@
-# New ports collection makefile for: netdisco
-# Date created: 2006-04-08
-# Whom: Shaun Amott <shaun at inerd.com>
-#
+# Created by: Shaun Amott <shaun at inerd.com>
# $FreeBSD$
#
@@ -16,7 +13,7 @@
OPTIONS_DEFINE= GRAPHVIZ OUIDL MIBS
OPTIONS_DEFAULT=GRAPHVIZ MIBS
MIBS_DESC= Depend on net-mgmt/netdisco-mibs
-OUIDL_DESC= Download oui.txt file
+OUIDL_DESC= Download oui.txt
GRAPHVIZ_DESC= Install GraphViz for network map support
RUN_DEPENDS+= ${APACHE_PKGNAMEPREFIX}mod_perl2>=0:${PORTSDIR}/www/mod_perl2 \
@@ -48,7 +45,7 @@
NETDISCO_DBDIR= /var/db/netdisco
SUB_FILES= pkg-message
-SUB_LIST= NETDISCO_DBDIR=${NETDISCO_DBDIR} NETDISCO_RUNDIR=${NETDISCO_RUNDIR} NETDISCO_USER=${USERS}
+SUB_LIST= NETDISCO_DBDIR=${NETDISCO_DBDIR} NETDISCO_RUNDIR=${NETDISCO_RUNDIR} NETDISCO_USER=${USERS} NETDISCO_GROUP=${GROUPS}
PLIST_SUB= NETDISCO_DBDIR=${NETDISCO_DBDIR} NETDISCO_RUNDIR=${NETDISCO_RUNDIR}
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
Index: files/netdisco.in
===================================================================
--- files/netdisco.in (revision 315717)
+++ files/netdisco.in (working copy)
@@ -18,36 +18,34 @@
: ${netdisco_group="%%NETDISCO_GROUP%%"}
start_precmd=${name}_prestart
-start_cmd=${name}_start
stop_cmd=${name}_stop
restart_cmd=${name}_restart
status_cmd=${name}_status
command="%%PREFIX%%/bin/netdisco"
command_interpreter="/usr/bin/perl"
-pidfile=%%NETDISCO_RUNDIR%%/netdisco_daemon.pid
+netdisco_config="%%ETCDIR%%/netdisco.conf"
+pidfile=$(grep ^daemon_pid $netdisco_config | sed -E 's/.*=\s+//')
+flags="-p start"
-required_files="%%ETCDIR%%/netdisco.conf"
+required_files="$netdisco_config"
netdisco_prestart() {
- test -d %%NETDISCO_RUNDIR%% || install -d -m 0700 -o $netdisco_user -g $netdisco_group %%NETDISCO_RUNDIR%%
+ test -d ${pidfile%/*} || install -d -m 0700 -o $netdisco_user -g $netdisco_group ${pidfile%/*}
+ touch $pidfile && chown $netdisco_user $pidfile
test -d %%NETDISCO_DBDIR%% || install -d -m 0700 -o $netdisco_user -g $netdisco_group %%NETDISCO_DBDIR%%
}
-netdisco_start() {
- $command -p start
-}
-
netdisco_stop() {
- $command -p stop
+ su -m "$netdisco_user" -c "$command -p stop"
}
netdisco_restart() {
- $command -p restart
+ su -m "$netdisco_user" -c "$command -p restart"
}
netdisco_status() {
- $command -p status
+ su -m "$netdisco_user" -c "$command -p status"
}
run_rc_command "$1"
--- netdisco-1.1.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list