Date: Wed, 22 May 2013 10:32:51 -0500 (CDT) From: Mark Felder <feld@feld.me> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/178834: [PATCH] net-mgmt/devmon: polish port Message-ID: <3046546331.enqueue@mwi1.coffeenet.org> Resent-Message-ID: <201305221540.r4MFe15P023997@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 178834 >Category: ports >Synopsis: [PATCH] net-mgmt/devmon: polish port >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: Wed May 22 15:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: feld >Release: FreeBSD 9.1-RELEASE amd64 >Organization: >Environment: System: FreeBSD mwi1.coffeenet.org 9.1-RELEASE FreeBSD 9.1-RELEASE #6 r243808: Mon Dec 3 07:51:34 >Description: Port polishing to fix some issues -rc script passes rclint -daemon runs as its own user UIDs devmon:*:283:283::0:0:devmon monitor:/nonexistent:/usr/sbin/nologin GIDs devmon:*:283: Generated with FreeBSD Port Tools 0.99_7 (mode: change, diff: ports) >How-To-Repeat: >Fix: --- devmon-0.3.1.b1_1.patch begins here --- diff -ruN /usr/ports/net-mgmt/devmon/Makefile ./Makefile --- /usr/ports/net-mgmt/devmon/Makefile 2013-03-02 14:20:12.000000000 -0600 +++ ./Makefile 2013-05-22 10:25:57.339578498 -0500 @@ -3,6 +3,7 @@ PORTNAME= devmon DISTVERSION= 0.3.1-beta1 +PORTREVISION= 1 CATEGORIES= net-mgmt MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${DISTVERSION} @@ -17,6 +18,12 @@ NO_BUILD= yes USE_RC_SUBR= devmon +USERS= devmon +GROUPS= devmon + +SUB_LIST= USERS=${USERS} \ + GROUPS=${GROUPS} + OPTIONS_DEFINE= MYSQL .include <bsd.port.options.mk> @@ -43,6 +50,7 @@ ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}/ ${INSTALL} -d ${DOCSDIR}/docs ${INSTALL} -d ${DOCSDIR}/extras + ${INSTALL} -d -o ${USERS} -g ${GROUPS} /var/run/devmon (cd ${WRKSRC}/docs && ${COPYTREE_SHARE} \* ${DOCSDIR}/docs/) (cd ${WRKSRC}/extras && ${COPYTREE_SHARE} \* ${DOCSDIR}/extras/) .endif diff -ruN /usr/ports/net-mgmt/devmon/files/devmon.in ./files/devmon.in --- /usr/ports/net-mgmt/devmon/files/devmon.in 2013-03-02 14:20:12.000000000 -0600 +++ ./files/devmon.in 2013-05-22 10:22:57.939621835 -0500 @@ -1,56 +1,88 @@ #!/bin/sh # $FreeBSD: net-mgmt/devmon/files/devmon.in 313295 2013-03-02 20:20:12Z swills $ - # PROVIDE: devmon # REQUIRE: LOGIN # KEYWORD: shutdown -: ${devmon_enable="NO"} +. /etc/rc.subr + +name=devmon +rcvar=devmon_enable +load_rc_config ${name} + +: ${devmon_enable:=NO} : ${devmon_config="%%PREFIX%%/devmon/devmon.cfg"} : ${devmon_db="%%PREFIX%%/devmon/hosts.db"} -: ${devmon_pid="/var/run/devmon.pid"} +: ${devmon_pid="/var/run/devmon/devmon.pid"} +: ${devmon_user="%%USERS%%"} +: ${devmon_group="%%GROUPS%%"} -. /etc/rc.subr - -name="devmon" -rcvar="devmon_enable" -load_rc_config $name command="%%PREFIX%%/devmon/devmon" command_args="-c ${devmon_config} -d ${devmon_db}" -command_interpreter="/usr/bin/perl" +command_interpreter=/usr/bin/perl pidfile=${devmon_pid} -stop_cmd="devmon_stopcmd" -status_cmd="devmon_statuscmd" +start_precmd=devmon_startprecmd +status_cmd=devmon_statuscmd +stop_cmd=devmon_stopcmd + +devmon_startprecmd() +{ + if [ ! -e ${devmon_config} ]; + then + echo "Error: ${devmon_config} does not exist." + exit 1; + fi + + TEMPLATESDIR=%%PREFIX%%/devmon/templates + if [ ! -e ${TEMPLATESDIR} ] + then + echo "" + echo " ERROR: no templates exist. Please install device templates" + echo " to: ${TEMPLATESDIR}" + echo " They are available on the devmon SourceForge page via SVN." + echo " Note, the older template tarballs do not work reliably." + echo "" + echo " # svn co svn://svn.code.sf.net/p/devmon/code/trunk/templates ${TEMPLATESDIR}" + echo "" + exit 1; + fi + + DEVMONLOG=$(grep "^LOGFILE=" ${devmon_config} | awk -F '=' '{print $2}') + if [ ! -e ${DEVMONLOG} ]; + then + install -o devmon -g devmon /dev/null ${DEVMONLOG} + fi +} -devmon_statuscmd() +devmon_statuscmd() { -if [ ! -e $pidfile ]; - then - echo "pidfile does not exist. $name is not running?"; - exit 1; -fi - -if pgrep -F $pidfile >/dev/null; - then - echo "$name is running."; - else - echo "$name is not running."; - exit 1; -fi + if [ ! -e ${pidfile} ]; + then + echo "pidfile does not exist. ${name} is not running?"; + exit 1; + fi + + if pgrep -F ${pidfile} >/dev/null; + then + echo "${name} is running."; + else + echo "${name} is not running."; + exit 1; + fi } devmon_stopcmd() { -if pgrep -F $pidfile >/dev/null; - then - mypid=`cat $pidfile`; - kill $sig_stop $mypid; - wait_for_pids $mypid; - else - echo "$name is not running."; - exit 1; -fi + if pgrep -F ${pidfile} >/dev/null; + then + mypid=`cat ${pidfile}`; + kill ${sig_stop} ${mypid}; + wait_for_pids ${mypid}; + else + echo "${name} is not running."; + exit 1; + fi } run_rc_command "$1" diff -ruN /usr/ports/net-mgmt/devmon/pkg-plist ./pkg-plist --- /usr/ports/net-mgmt/devmon/pkg-plist 2013-03-02 14:20:12.000000000 -0600 +++ ./pkg-plist 2013-05-22 10:28:32.667682107 -0500 @@ -24,7 +24,8 @@ %%PORTDOCS%%%%DOCSDIR%%/COPYING %%PORTDOCS%%%%DOCSDIR%%/CHANGELOG @dirrm devmon/modules -@dirrm devmon +@dirrmtry devmon +@dirrmtry /var/run/devmon %%PORTDOCS%%@dirrm %%DOCSDIR%%/extras %%PORTDOCS%%@dirrm %%DOCSDIR%%/docs %%PORTDOCS%%@dirrm %%DOCSDIR%% --- devmon-0.3.1.b1_1.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3046546331.enqueue>