diff --git a/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java index 0a18899e0106..ee2593aa7fc6 100644 --- a/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java +++ b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java @@ -59,6 +59,7 @@ * Integration tests for Spring Boot's launch script on OSs that use SysVinit. * * @author Andy Wilkinson + * @author Ali Shahbour */ @RunWith(Parameterized.class) public class SysVinitLaunchScriptIT { @@ -194,6 +195,12 @@ public void launchWithSingleJavaOpt() throws Exception { doLaunch("launch-with-single-java-opt.sh"); } + @Test + public void launchWithDoubleLinkSingleJavaOpt() throws Exception { + doLaunch("launch-with-double-link-single-java-opt.sh"); + } + + @Test public void launchWithMultipleJavaOpts() throws Exception { doLaunch("launch-with-multiple-java-opts.sh"); diff --git a/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/launch-with-double-link-single-java-opt.sh b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/launch-with-double-link-single-java-opt.sh new file mode 100755 index 000000000000..9f1f5c404d06 --- /dev/null +++ b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/launch-with-double-link-single-java-opt.sh @@ -0,0 +1,6 @@ +source ./test-functions.sh +install_double_link_service +echo 'JAVA_OPTS=-Dserver.port=8081' > /test-service/spring-boot-app.conf +start_service +await_app http://127.0.0.1:8081/ +curl -s http://127.0.0.1:8081/ \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/test-functions.sh b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/test-functions.sh index c1734c757bb3..549031b229c5 100644 --- a/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/test-functions.sh +++ b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/test-functions.sh @@ -5,6 +5,14 @@ install_service() { ln -s /test-service/spring-boot-app.jar /etc/init.d/spring-boot-app } +install_double_link_service() { + mkdir /test-service + mv /spring-boot-launch-script-tests-*.jar /test-service/ + chmod +x /test-service/spring-boot-launch-script-tests-*.jar + ln -s /test-service/spring-boot-launch-script-tests-*.jar /test-service/spring-boot-app.jar + ln -s /test-service/spring-boot-app.jar /etc/init.d/spring-boot-app +} + start_service() { service spring-boot-app start $@ } diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script b/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script index 25facc1ede11..5bc1ec1a1a88 100755 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script @@ -32,7 +32,13 @@ WORKING_DIR="$(pwd)" cd "$(dirname "$0")" || exit 1 [[ -z "$jarfile" ]] && jarfile=$(pwd)/$(basename "$0") while [[ -L "$jarfile" ]]; do - [[ "$jarfile" =~ init\.d ]] && init_script=$(basename "$jarfile") + if [[ "$jarfile" =~ init\.d ]]; then + init_script=$(basename "$jarfile") + else + # while looping check if their is any configuration file + configfile="${jarfile%.*}.conf" + [[ -r ${configfile} ]] && source "${configfile}" + fi jarfile=$(readlink "$jarfile") cd "$(dirname "$jarfile")" || exit 1 jarfile=$(pwd)/$(basename "$jarfile") @@ -45,7 +51,6 @@ configfile="$(basename "${jarfile%.*}.conf")" # Initialize CONF_FOLDER location defaulting to jarfolder [[ -z "$CONF_FOLDER" ]] && CONF_FOLDER="{{confFolder:${jarfolder}}}" - # shellcheck source=/dev/null [[ -r "${CONF_FOLDER}/${configfile}" ]] && source "${CONF_FOLDER}/${configfile}"