aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/devmon
diff options
context:
space:
mode:
authorSteve Wills <swills@FreeBSD.org>2013-05-27 02:29:49 +0000
committerSteve Wills <swills@FreeBSD.org>2013-05-27 02:29:49 +0000
commita4f007326e30cb5c625717ae75a93d4466805ad3 (patch)
treefd486945e64037b330cbdb90ed58f9a63d127bfc /net-mgmt/devmon
parent2819269940c4b2cbab079eb4135bae5172fc0d67 (diff)
downloadports-a4f007326e30cb5c625717ae75a93d4466805ad3.tar.gz
ports-a4f007326e30cb5c625717ae75a93d4466805ad3.zip
Notes
Diffstat (limited to 'net-mgmt/devmon')
-rw-r--r--net-mgmt/devmon/Makefile8
-rw-r--r--net-mgmt/devmon/files/devmon.in100
-rw-r--r--net-mgmt/devmon/pkg-plist3
3 files changed, 76 insertions, 35 deletions
diff --git a/net-mgmt/devmon/Makefile b/net-mgmt/devmon/Makefile
index 8108f938f7af..bb53fec6aa76 100644
--- a/net-mgmt/devmon/Makefile
+++ b/net-mgmt/devmon/Makefile
@@ -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 @@ USE_PERL5= yes
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 @@ post-install:
${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 --git a/net-mgmt/devmon/files/devmon.in b/net-mgmt/devmon/files/devmon.in
index fae4d0af6a40..a39ab64dda4b 100644
--- a/net-mgmt/devmon/files/devmon.in
+++ b/net-mgmt/devmon/files/devmon.in
@@ -1,56 +1,88 @@
#!/bin/sh
# $FreeBSD$
-
# 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"}
-
-. /etc/rc.subr
+: ${devmon_pid="/var/run/devmon/devmon.pid"}
+: ${devmon_user="%%USERS%%"}
+: ${devmon_group="%%GROUPS%%"}
-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_statuscmd()
+devmon_startprecmd()
{
-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 ${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()
+{
+ 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 --git a/net-mgmt/devmon/pkg-plist b/net-mgmt/devmon/pkg-plist
index 51c6cb82f30a..f26ce6ddde9a 100644
--- a/net-mgmt/devmon/pkg-plist
+++ b/net-mgmt/devmon/pkg-plist
@@ -24,7 +24,8 @@ devmon/devmon
%%PORTDOCS%%%%DOCSDIR%%/COPYING
%%PORTDOCS%%%%DOCSDIR%%/CHANGELOG
@dirrm devmon/modules
-@dirrm devmon
+@dirrmtry devmon
+@unexec rmdir /var/run/devmon
%%PORTDOCS%%@dirrm %%DOCSDIR%%/extras
%%PORTDOCS%%@dirrm %%DOCSDIR%%/docs
%%PORTDOCS%%@dirrm %%DOCSDIR%%