mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 01:40:55 +01:00
Implement DISABLE_JLINK env variable to disable jlink jre's usage at runtime (#4426)
This commit is contained in:
parent
828d03c727
commit
aed92c35af
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user