Skip to content

Commit

Permalink
Call upgrade tool automatically from within the update script (openha…
Browse files Browse the repository at this point in the history
…b#1532)

Signed-off-by: Kai Kreuzer <[email protected]>
  • Loading branch information
kaikreuzer authored May 12, 2023
1 parent 25cdad2 commit 092e447
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions distributions/openhab/src/main/resources/bin/update
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ SkipModifier="$3"

##Run the initialisation functions defined above
setup "$SpecifiedVersion" "$SpecifiedDir"

download "$SkipModifier"

transferFile="update.lst"
Expand Down Expand Up @@ -353,6 +354,15 @@ rm -rf "${TempDir:?}"
echo "Restoring previous file ownership ($FileOwner:$FileGroup)"
chown -R "$FileOwner:$FileGroup" "$WorkingDir"

## Start the upgrade tool
echo "Starting JSON database update..."
export OPENHAB_USERDATA="$OPENHAB_USERDATA"
java -jar "$WorkingDir/runtime/bin/upgradetool.jar" || {
echo "Update tool failed, please check the openHAB website (www.openhab.org) for manual update instructions." >&2
exit 1
}
echo "JSON database updated successfully."

echo ""
echo "SUCCESS: openHAB updated from $CurrentVersion to $OHVersion"
echo ""
8 changes: 8 additions & 0 deletions distributions/openhab/src/main/resources/bin/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,14 @@ Function Update-openHAB() {
return PrintAndThrow "Could not replace the $AddonsFile" $_
}

# Now run the upgrade tool to update the JSON database
Write-Host "Starting JSON database update..."
java -jar "$($PSScriptRoot)\runtime\bin\upgradetool.jar"
if ($LASTEXITCODE -ne 0) {
Write-Error "Update tool failed, please check the openHAB website (www.openhab.org) for manual update instructions."
exit 1
}
Write-Host "JSON database updated successfully."

# Hop for joy - we did it!
Write-Host -ForegroundColor Green "openHAB updated to version $OHVersionName!"
Expand Down

0 comments on commit 092e447

Please sign in to comment.