aboutsummaryrefslogtreecommitdiffstats
path: root/www/glassfish/files
diff options
context:
space:
mode:
authorpi <pi@FreeBSD.org>2014-10-16 01:25:25 +0800
committerpi <pi@FreeBSD.org>2014-10-16 01:25:25 +0800
commitd74bd8bdcef548e3bf3fbdd8a9f05e140c825bcf (patch)
tree7deb1cbee85b7fc2446627c36d28a34fdce50516 /www/glassfish/files
parent5f8cbe0685bd2406bd3f7bcc922169c678569307 (diff)
downloadfreebsd-ports-gnome-d74bd8bdcef548e3bf3fbdd8a9f05e140c825bcf.tar.gz
freebsd-ports-gnome-d74bd8bdcef548e3bf3fbdd8a9f05e140c825bcf.tar.zst
freebsd-ports-gnome-d74bd8bdcef548e3bf3fbdd8a9f05e140c825bcf.zip
www/glassfish: 3.1.2.2 -> 4.1
Changes since 3.1.2.2: https://glassfish.java.net/docs/4.0/release-notes.pdf https://glassfish.java.net/docs/4.1/release-notes.pdf PR: 194097 Submitted by: Enrico M. Crisostomo <enrico.m.crisostomo@gmail.com> Approved by: cjr@cruwe.de (maintainer)
Diffstat (limited to 'www/glassfish/files')
-rw-r--r--www/glassfish/files/glassfish.in61
1 files changed, 56 insertions, 5 deletions
diff --git a/www/glassfish/files/glassfish.in b/www/glassfish/files/glassfish.in
index dc318515e547..e8e4afc883e9 100644
--- a/www/glassfish/files/glassfish.in
+++ b/www/glassfish/files/glassfish.in
@@ -9,8 +9,18 @@
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
-# glassfish_enable (bool): Set to NO by default.
-# Set it to YES to enable doormand.
+# glassfish_enable (bool):
+# Set to NO by default.
+# Set it to YES to enable glassfish.
+#
+# glassfish_java_home (string):
+# Used to set JAVA_HOME (optional).
+#
+# glassfish_java_opts (string):
+# Used to set JAVA_OPTS (optional).
+#
+# glassfish_domain_name (string):
+# Set the name of the Glassfish domain to start (default: domain1).
. /etc/rc.subr
@@ -20,10 +30,51 @@ rcvar=glassfish_enable
load_rc_config $name
: ${glassfish_enable:=NO}
+: ${glassfish_java_home=""}
+: ${glassfish_java_opts=""}
+: ${glassfish_domain_name="domain1"}
+: ${glassfish_home="%%DATADIR%%/glassfish"}
+
+procname="${glassfish_java_home}/bin/java"
+
+# Since we receive the JAVA_HOME variable by default from the Java package
+# we depend on, we override JAVA_HOME only if the user overrid it.
+if [ ! -z ${glassfish_java_home} ] ; then
+ export JAVA_HOME=${glassfish_java_home}
+else
+ export JAVA_HOME=%%JAVA_HOME%%
+fi
+
+export PATH=${JAVA_HOME}/bin:${PATH}
+export JAVA_OPTS=${glassfish_java_opts}
+
+start_precmd="glassfish_prestart"
+start_cmd="${glassfish_home}/bin/asadmin start-domain ${glassfish_domain_name}"
+stop_cmd="${glassfish_home}/bin/asadmin stop-domain ${glassfish_domain_name}"
+status_cmd="glassfish_status"
-export PATH=${PATH}:%%LOCALBASE%%/bin
+glassfish_prestart()
+{
+ if [ -z ${glassfish_domain_name} ] ; then
+ warn "Glassfish domain name cannot be empty, Glassfish will NOT start."
+ return 1
+ fi
+}
-start_cmd="%%PREFIX%%/glassfish-%%GLASSFISHVERSION%%/bin/asadmin start-domain"
-stop_cmd="%%PREFIX%%/glassfish-%%GLASSFISHVERSION%%/bin/asadmin stop-domain"
+glassfish_status()
+{
+ # The output of list-domains -l in glassfish 4.1 is the following:
+ #
+ # DOMAIN ADMIN_HOST ADMIN_PORT RUNNING RESTART_REQUIRED
+ # domain1 localhost 4848 true false
+ IS_DOMAIN_RUNNING=$(${glassfish_home}/bin/asadmin list-domains -l | grep "^${glassfish_domain_name}" | awk '{ print $4; }')
+ if checkyesno IS_DOMAIN_RUNNING ; then
+ echo Glassfish is running.
+ return 0
+ else
+ echo Glassfish is not running.
+ return 1
+ fi
+}
run_rc_command "$1"