Skip to content

Commit

Permalink
upgrade to latest OH release if cannot determine
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Storm <markus.storm@gmx.net>
  • Loading branch information
mstormi committed Aug 12, 2023
1 parent 5791dbd commit 1de3a5f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion functions/openhab.bash
Expand Up @@ -49,6 +49,7 @@ openhab_setup() {
local introText
local keyName="openhab"
local openhabVersion
local installVersion
local repo
local successText

Expand Down Expand Up @@ -92,7 +93,10 @@ openhab_setup() {
if ! apt-get clean --yes -o DPkg::Lock::Timeout="$APTTIMEOUT"; then echo "FAILED (apt cache clean)"; return 1; fi
if ! cond_redirect apt-get update; then echo "FAILED (update apt lists)"; return 1; fi
openhabVersion="${3:-$(apt-cache madison ${ohPkgName} | head -n 1 | cut -d'|' -f2 | xargs)}"
if cond_redirect apt-get install --allow-downgrades --yes -o DPkg::Lock::Timeout="$APTTIMEOUT" --option Dpkg::Options::="--force-confnew" "${ohPkgName}=${openhabVersion}" "${ohPkgName}-addons=${openhabVersion}"; then echo "OK"; else echo "FAILED"; return 1; fi
if [[ -n $openhabVersion ]]; then
installVersion="${ohPkgName}=${openhabVersion}" "${ohPkgName}-addons=${openhabVersion}"
fi
if cond_redirect apt-get install --allow-downgrades --yes -o DPkg::Lock::Timeout="$APTTIMEOUT" --option Dpkg::Options::="--force-confnew" "$installVersion"; then echo "OK"; else echo "FAILED"; return 1; fi
else
echo -n "$(timestamp) [openHABian] Installing cached openHAB version... "
if cond_redirect apt-get install --yes -o DPkg::Lock::Timeout="$APTTIMEOUT" --option Dpkg::Options::="--force-confnew" ${ohPkgName} ${ohPkgName}-addons; then echo "OK"; else echo "FAILED"; return 1; fi
Expand Down

0 comments on commit 1de3a5f

Please sign in to comment.