add version details to selfupgrade and fix earlier lint error

This commit is contained in:
Roni Väyrynen
2021-09-11 16:52:06 +03:00
parent ca424d0b63
commit 2187e86e43

View File

@@ -98,8 +98,10 @@ function SelfUpgrade {
local REMOTE="$(runcmd_stdout "cd $SCRIPT_DIR && git config --get remote.origin.url")" local REMOTE="$(runcmd_stdout "cd $SCRIPT_DIR && git config --get remote.origin.url")"
if [[ "$REMOTE" == *"ronivay/XenOrchestraInstallerUpdater"* ]]; then if [[ "$REMOTE" == *"ronivay/XenOrchestraInstallerUpdater"* ]]; then
runcmd "cd $SCRIPT_DIR && git fetch" runcmd "cd $SCRIPT_DIR && git fetch"
local OLD_SCRIPT_VERSION="$(runcmd_stdout "cd $SCRIPT_DIR && git rev-parse --short HEAD")"
local NEW_SCRIPT_VERSION="$(runcmd_stdout "cd $SCRIPT_DIR && git rev-parse --short FETCH_HEAD")"
if [[ $(runcmd_stdout "cd $SCRIPT_DIR && git diff --name-only @{upstream}| grep xo-install.sh") ]]; then if [[ $(runcmd_stdout "cd $SCRIPT_DIR && git diff --name-only @{upstream}| grep xo-install.sh") ]]; then
printinfo "Newer version of script available, attempting to self upgrade" printinfo "Newer version of script available, attempting to self upgrade from '$OLD_SCRIPT_VERSION' to '$NEW_SCRIPT_VERSION'"
runcmd "cd $SCRIPT_DIR && git pull --ff-only" && runcmd "cd $SCRIPT_DIR && git pull --ff-only" &&
{ {
printok "Self upgrade done" printok "Self upgrade done"