Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/main/resources/linux/startup.sh.vtl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#set ($vmArgs = $StringUtils.join($info.vmArgs, " "))
#set ($appArgs = $StringUtils.join($info.appArgs, " "))
#!/usr/bin/env bash
# GNU/Linux startup script generated by JavaPackager plugin

Expand All @@ -12,7 +10,7 @@ function showMessage() {
if type -p notify-send; then
notify-send -u critical "${info.name}" "$1"
else
echo $1
echo "$1"
fi
}
if type -p java > /dev/null; then
Expand Down Expand Up @@ -46,8 +44,7 @@ function compareVersions() {
return 0
}
JAVA_VERSION=$("$JAVA" -version 2>&1 | awk -F '"' '/version/ {print $2}')
compareVersions "$JAVA_VERSION" "${info.jreMinVersion}"
if [[ $? != 0 ]]; then
if ! compareVersions "$JAVA_VERSION" "${info.jreMinVersion}"; then
showMessage "The application requires a Java Runtime Environment ${info.jreMinVersion} or higher."
exit 1
fi
Expand All @@ -64,19 +61,26 @@ BINARY="$SCRIPTPATH/${info.jarFile.name}"
export PATH=${info.envPath}
#end

JVMDefaultOptions="${vmArgs}"
JVMDefaultOptions=()
#foreach ($vmArg in $info.vmArgs)
JVMDefaultOptions+=("$vmArg")
#end

JVMOptionsFile="$SCRIPTPATH/${info.name}.l4j.ini"
[ -f "${JVMOptionsFile}" ] && while read -r option; do JVMDefaultOptions+=" $option"; done <<< $(sed "/^#.*$/d" "${JVMOptionsFile}")
[ -f "${JVMOptionsFile}" ] && while read -r -a option; do JVMDefaultOptions+=("${option[@]}"); done <<< "$(sed -e "/^#.*$/d" -e "/^[[:space:]]*$/d" "${JVMOptionsFile}")"

JVMClassPath="$BINARY"
#foreach ($classpath in $info.classpaths)
JVMClassPath+=":${classpath}"
#end

AppArguments="${appArgs}"
AppArguments=()
#foreach ($appArg in $info.appArgs)
AppArguments+=("appArg")
#end

#if ($info.useResourcesAsWorkingDir)
cd "$SCRIPTPATH"
cd "$SCRIPTPATH" || exit 1
#end

#if ($info.scripts.bootstrap)
Expand All @@ -85,8 +89,8 @@ Bootstrap="$SCRIPTPATH/scripts/${info.bootstrapFile.name}" && [ -x "$Bootstrap"
#end

#if ($info.administratorRequired)
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY GDKBACKEND=x11 "${JAVA}" ${JVMDefaultOptions} -jar "${JVMClassPath}" ${AppArguments} $@
pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" GDKBACKEND=x11 "${JAVA}" "${JVMDefaultOptions[@]}" -jar "${JVMClassPath}" "${AppArguments[@]}" "$@"
#else
"${JAVA}" ${JVMDefaultOptions} -jar "${JVMClassPath}" ${AppArguments} $@
"${JAVA}" "${JVMDefaultOptions[@]}" -jar "${JVMClassPath}" "${AppArguments[@]}" "$@"
#end
exit 0
Binary file removed src/main/resources/mac/universalJavaApplicationStub
Binary file not shown.
Binary file not shown.
Binary file not shown.