Bug 177632 - [MAINTAINER] net-mgmt/netdisco: rc script corrections
Summary: [MAINTAINER] net-mgmt/netdisco: rc script corrections
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Lars Engels
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-04 15:00 UTC by geoffroy desvernay
Modified: 2013-05-10 20:20 UTC (History)
0 users

See Also:


Attachments
netdisco-1.1.patch (2.50 KB, patch)
2013-04-04 15:00 UTC, geoffroy desvernay
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description geoffroy desvernay 2013-04-04 15:00:00 UTC
- 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)

Fix: attached.

Feature safe: yes
Comment 1 Lars Engels freebsd_committer freebsd_triage 2013-05-10 19:48:06 UTC
Responsible Changed
From-To: freebsd-ports-bugs->lme

I'll take it.
Comment 2 dfilter service freebsd_committer freebsd_triage 2013-05-10 20:11:20 UTC
Author: lme
Date: Fri May 10 19:11:11 2013
New Revision: 317835
URL: http://svnweb.freebsd.org/changeset/ports/317835

Log:
  - Change rc script, so netdisco is not run as root
  - Fix group replacement in rc script
  - Trim Makefile header
  
  PR:		ports/177632
  Submitted by:	maintainer

Modified:
  head/net-mgmt/netdisco/Makefile   (contents, props changed)
  head/net-mgmt/netdisco/files/netdisco.in   (contents, props changed)

Modified: head/net-mgmt/netdisco/Makefile
==============================================================================
--- head/net-mgmt/netdisco/Makefile	Fri May 10 18:28:35 2013	(r317834)
+++ head/net-mgmt/netdisco/Makefile	Fri May 10 19:11:11 2013	(r317835)
@@ -1,9 +1,5 @@
-# New ports collection makefile for:	netdisco
-# Date created:				2006-04-08
-# Whom:					Shaun Amott <shaun@inerd.com>
-#
+# Created by: Shaun Amott <shaun@inerd.com>
 # $FreeBSD$
-#
 
 PORTNAME=	netdisco
 PORTVERSION=	1.1

Modified: head/net-mgmt/netdisco/files/netdisco.in
==============================================================================
--- head/net-mgmt/netdisco/files/netdisco.in	Fri May 10 18:28:35 2013	(r317834)
+++ head/net-mgmt/netdisco/files/netdisco.in	Fri May 10 19:11:11 2013	(r317835)
@@ -18,36 +18,34 @@ load_rc_config $name
 : ${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"
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Lars Engels freebsd_committer freebsd_triage 2013-05-10 20:11:31 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!