diff --git a/app/oracle-server/src/universal/oracle-server-extra-startup-script.sh b/app/oracle-server/src/universal/oracle-server-extra-startup-script.sh index 3c1ee1fc8f..471c0d0997 100644 --- a/app/oracle-server/src/universal/oracle-server-extra-startup-script.sh +++ b/app/oracle-server/src/universal/oracle-server-extra-startup-script.sh @@ -15,6 +15,26 @@ if [[ "$OS" == "OSX" ]]; then fi chmod +x jre/bin/java #make sure java is executable +get_java_no_jlink() { + if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then + echo "$JAVA_HOME/bin/java" + else + echo "java" + fi +} + +if [[ -n "$DISABLE_JLINK" ]]; then + echo "jlink disabled by the DISABLE_JLINK environment variable, defaulting to JAVA_HOME for java" + # java_cmd is overrode in process_args when -java-home is used + declare java_cmd=$(get_java_no_jlink) + + # 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 "$@" +fi + + chip=$(uname -m) if [[ $chip == "arm64" || $chip == "aarch64" ]]; then @@ -29,13 +49,7 @@ if [[ $chip == "arm64" || $chip == "aarch64" ]]; then # arm64 / aarch64 will need to provide their own jre # see https://github.com/bitcoin-s/bitcoin-s/issues/4369! echo "Removing ARM jre as its not linked correctly, see https://github.com/bitcoin-s/bitcoin-s/issues/4369!" - get_java_no_jlink() { - if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then - echo "$JAVA_HOME/bin/java" - else - echo "java" - fi - } + # java_cmd is overrode in process_args when -java-home is used declare java_cmd=$(get_java_no_jlink) diff --git a/app/server/src/universal/wallet-server-extra-startup-script.sh b/app/server/src/universal/wallet-server-extra-startup-script.sh index b85ab1b1e6..03f198483b 100644 --- a/app/server/src/universal/wallet-server-extra-startup-script.sh +++ b/app/server/src/universal/wallet-server-extra-startup-script.sh @@ -1,13 +1,33 @@ - if [[ "$OS" == "OSX" ]]; then #mac doesn't allow random binaries to be executable #remove the quarantine attribute so java is executable on mac xattr -d com.apple.quarantine jre/bin/java fi + chmod +x jre/bin/java #make sure java is executable chip=$(uname -m) + +get_java_no_jlink() { + if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then + echo "$JAVA_HOME/bin/java" + else + echo "java" + fi +} + +if [[ -n "$DISABLE_JLINK" ]]; then + echo "jlink disabled by the DISABLE_JLINK environment variable, defaulting to JAVA_HOME for java" + # java_cmd is overrode in process_args when -java-home is used + declare java_cmd=$(get_java_no_jlink) + + # 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 "$@" +fi + if [[ $chip == "arm64" || $chip == "aarch64" ]]; then # This is needed as a hack for now # This replaces overrides how sbt native packager finds java @@ -18,14 +38,7 @@ if [[ $chip == "arm64" || $chip == "aarch64" ]]; then # check to see if there is a bundled_jvm built by jlink if the detected # computer arch is arm64 or aarch64. This means a user if they are running # arm64 / aarch64 will need to provide their own jre - echo "Removing ARM jre as its not linked correctly, see https://github.com/bitcoin-s/bitcoin-s/issues/4369!" - get_java_no_jlink() { - if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then - echo "$JAVA_HOME/bin/java" - else - echo "java" - fi - } + echo "Removing jre as its not linked correctly on ARM machines, see https://github.com/bitcoin-s/bitcoin-s/issues/4369!" # java_cmd is overrode in process_args when -java-home is used declare java_cmd=$(get_java_no_jlink)