Skip to content

Commit

Permalink
Merge pull request #491 from sbt/revert-473-fix_EtcDefaultAsShell
Browse files Browse the repository at this point in the history
Revert "[fix #472] /etc/default/<package-name> should be shell script se...
  • Loading branch information
muuki88 committed Feb 13, 2015
2 parents 3bd5e93 + 138510c commit 5b41248
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ run() {
exit $exit_code
}

# Loads a configuration file full of default command line options for this script.
loadConfigFile() {
cat "$1" | sed '/^\#/d'
}

# Now check to see if it's a good enough version
# TODO - Check to see if we have a configured default java version, otherwise use 1.6
java_version_check() {
Expand Down Expand Up @@ -361,8 +366,7 @@ ${{template_declares}}
# java_cmd is overrode in process_args when -java-home is used
declare java_cmd=$(get_java_cmd)


# use JAVA_OPTS to prepend its contents to $@
set -- "$JAVA_OPTS" "$@"
# if configuration files exist, prepend their contents to $@ so it can be processed by this runner
[[ -f "$script_conf_file" ]] && set -- $(loadConfigFile "$script_conf_file") "$@"

run "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# ${{daemon_user}} daemon user
# -------------------------------------------------

# Using $JAVA_OPTS envars
# Setting -Xmx and -Xms in Megabyte
# -mem 1024

Expand All @@ -32,8 +31,4 @@
# -jvm-debug <port>

# Don't run the java version check
# -no-version-check

# Example
# JAVA_OPTS=" -Dpidfile.path=/var/run/${{app_name}}/play.pid $JAVA_OPTS"
# JAVA_OPTS=" -mem 1024 -Dkey=val -jvm-debug $JAVA_OPTS"
# -no-version-check
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
source /lib/init/vars.sh
source /lib/lsb/init-functions

# if configuration files exist, source it and use JAVA_OPTS to prepend their contents to $@
[[ -f /etc/default/${{app_name}} ]] && . /etc/default/${{app_name}}
# $JAVA_OPTS used in $RUN_CMD wrapper
export JAVA_OPTS

PIDFILE=/var/run/${{app_name}}/running.pid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
# Source function library.
. /etc/rc.d/init.d/functions

# if configuration files exist, source it and use JAVA_OPTS to prepend their contents to $@
[[ -f /etc/default/${{app_name}} ]] && . /etc/default/${{app_name}}
# $JAVA_OPTS used in $RUN_CMD wrapper
export JAVA_OPTS

prog="${{exec}}"

# FIXME The pid file should be handled by the executed script
Expand Down
8 changes: 0 additions & 8 deletions src/sphinx/archetypes/java_server/customize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Create ``src/templates/etc-default`` with the following template
# ${{daemon_user}} daemon user
# -------------------------------------------------
# Using $JAVA_OPTS envars
# Setting -Xmx and -Xms in Megabyte
# -mem 1024
Expand All @@ -59,16 +58,9 @@ Create ``src/templates/etc-default`` with the following template
# using a reserved parameter. See #184
# -d -- -d
# Example:
# JAVA_OPTS=" -Dpidfile.path=/var/run/${{app_name}}/play.pid $JAVA_OPTS"
# JAVA_OPTS=" -mem 1024 -Dkey=val -jvm-debug $JAVA_OPTS"
The file will be installed to ``/etc/default/<normalizedName>`` and read from there
by the startscript.

*Warning: the format changed, from java option list only, to a shell script setting environment variables.
A project using previous version should adapts its configuration file.*

Environment variables
~~~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 5b41248

Please sign in to comment.