@@ -50,11 +50,9 @@ adoptium_install_apt() {
5050 if ! dpkg -s " temurin-${1} -jre" & > /dev/null; then # Check if already is installed
5151 adoptium_fetch_apt " $1 "
5252 echo -n " $( timestamp) [openHABian] Installing Adoptium Eclipse Temurin JDK... "
53- cond_redirect java_alternatives_reset
5453 if cond_redirect apt-get install --yes -o DPkg::Lock::Timeout=" $APTTIMEOUT " " temurin-${1} -jre" ; then echo " OK" ; else echo " FAILED" ; return 1; fi
5554 else
5655 echo -n " $( timestamp) [openHABian] Reconfiguring Adoptium Eclipse Temurin JDK... "
57- cond_redirect java_alternatives_reset
5856 if cond_redirect dpkg-reconfigure " temurin-${1} -jre" ; then echo " OK" ; else echo " FAILED" ; return 1; fi
5957 if is_aarch64; then
6058 update-alternatives --set java /usr/lib/jvm/temurin-" ${1} " -jre-arm64/bin/java
@@ -95,15 +93,13 @@ openjdk_install_apt() {
9593 if ! dpkg -s " openjdk-${1} -jre-headless" & > /dev/null; then # Check if already is installed
9694 openjdk_fetch_apt " $1 "
9795 echo -n " $( timestamp) [openHABian] Installing OpenJDK ${1} ... "
98- cond_redirect java_alternatives_reset
9996 if [[ $1 == " 21" ]]; then
10097 if cond_redirect apt-get install --yes -o DPkg::Lock::Timeout=" $APTTIMEOUT " -t unstable " openjdk-${1} -jre-headless" ; then echo " OK" ; else echo " FAILED" ; return 1; fi
10198 else
10299 if cond_redirect apt-get install --yes -o DPkg::Lock::Timeout=" $APTTIMEOUT " " openjdk-${1} -jre-headless" ; then echo " OK" ; else echo " FAILED" ; return 1; fi
103100 fi
104101 else
105102 echo -n " $( timestamp) [openHABian] Reconfiguring OpenJDK ${1} ... "
106- cond_redirect java_alternatives_reset
107103 if cond_redirect dpkg-reconfigure " openjdk-${1} -jre-headless" ; then echo " OK" ; else echo " FAILED" ; return 1; fi
108104 if is_aarch64; then
109105 update-alternatives --set java /usr/lib/jvm/java-" ${1} " -openjdk-arm64/bin/java
@@ -121,6 +117,9 @@ java_alternatives_reset() {
121117 local jdkBin
122118
123119 jdkBin=" $( find /opt/jdk/* /bin ... -print -quit) "
120+ if [[ -z " $jdkBin " ]]; then
121+ return 0
122+ fi
124123
125124 # shellcheck disable=SC2016
126125 cond_redirect find " $jdkBin " -maxdepth 1 -perm -111 -type f -exec bash -c ' update-alternatives --quiet --remove-all $(basename {})' \;
0 commit comments