summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2016-09-21 15:22:06 +0000
committerMark Felder <feld@FreeBSD.org>2016-09-21 15:22:06 +0000
commitdb92fe7dd2b2cb861dda3f18126e3df14871556c (patch)
treeb4ed401a475f8d2e883d6c5561b2f7ada47c33b2
parent- Unbreak fetch, switch to github, simplify port (diff)
net-mgmt/unifi4: Simplify rc script
Notes
Notes: svn path=/head/; revision=422566
-rw-r--r--net-mgmt/unifi4/Makefile5
-rw-r--r--net-mgmt/unifi4/files/unifi.in42
2 files changed, 7 insertions, 40 deletions
diff --git a/net-mgmt/unifi4/Makefile b/net-mgmt/unifi4/Makefile
index cf123065b55a..9a41ffc68545 100644
--- a/net-mgmt/unifi4/Makefile
+++ b/net-mgmt/unifi4/Makefile
@@ -3,7 +3,7 @@
PORTNAME= unifi4
PORTVERSION= 4.8.20
-PORTREVISION= 0
+PORTREVISION= 1
CATEGORIES= net-mgmt java
MASTER_SITES= https://www.ubnt.com/downloads/unifi/${PORTVERSION}/ \
LOCAL/feld/${PORTNAME}-${PORTVERSION}/
@@ -18,7 +18,8 @@ RUN_DEPENDS= mongodb>0:databases/mongodb \
BUILD= 8422
-SUB_LIST+= USERS=${USERS} GROUPS=${GROUPS} JAVASHAREDIR=${JAVASHAREDIR}
+SUB_LIST+= USERS=${USERS} GROUPS=${GROUPS} JAVASHAREDIR=${JAVASHAREDIR} \
+ JAVA=${JAVA}
PLIST_SUB+= BUILDVERSION="${PORTVERSION:S/./_/g}_${BUILD}"
USES= cpe zip
diff --git a/net-mgmt/unifi4/files/unifi.in b/net-mgmt/unifi4/files/unifi.in
index 8a479cf1f68c..ce22923e0c39 100644
--- a/net-mgmt/unifi4/files/unifi.in
+++ b/net-mgmt/unifi4/files/unifi.in
@@ -25,16 +25,11 @@ load_rc_config ${name}
: ${unifi_chdir=%%JAVASHAREDIR%%/unifi}
: ${unifi_javaflags:="-Djava.awt.headless=true -Xmx1024M"}
-command_interpreter=.
-command="%%PREFIX%%/bin/java"
-command_args="${unifi_javaflags} -jar lib/ace.jar"
-start_cmd=start_cmd
+pidfile="/var/run/unifi/${name}.pid"
+procname=%%JAVA%%
+command="/usr/sbin/daemon"
+command_args="-f -p ${pidfile} %%JAVA%% ${unifi_javaflags} -jar lib/ace.jar start"
start_precmd=start_precmd
-stop_cmd=stop_cmd
-status_cmd=status_cmd
-pidfile="/var/run/${name}.pid"
-
-procname=$(JAVAVM_DRYRUN=yes ${command} | fgrep JAVAVM_COMMAND)
start_precmd()
{
@@ -43,33 +38,4 @@ start_precmd()
fi
}
-start_cmd()
-{
- check_startmsgs && echo "Starting ${name}."
- cd ${unifi_chdir}
- daemon -u %%USERS%% -f -p ${pidfile} ${command} ${command_args} start
-}
-
-stop_cmd()
-{
- check_startmsgs && echo "Stopping ${name}."
- rc_pid=$(check_pidfile $pidfile $procname)
- cd ${unifi_chdir}
- ${command} ${command_args} stop
- wait_for_pids $rc_pid
-}
-
-status_cmd()
-{
- if [ -e ${pidfile} ] && $(pgrep -F ${pidfile} > /dev/null) ; then
- mypid=$(cat ${pidfile})
- fi
-
- if [ ! ${mypid} = '' ]; then
- echo "${name} is running with PID ${mypid}.";
- else
- echo "${name} not running?";
- fi
-}
-
run_rc_command "$1"