From 2d7d197878ea019734c48110808532d05769a64d Mon Sep 17 00:00:00 2001 From: ronivay Date: Wed, 18 Aug 2021 10:08:01 +0300 Subject: [PATCH] fix git checkout from wrong working directory when other than master branch used --- sample.xo-install.cfg | 2 +- xo-install.sh | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sample.xo-install.cfg b/sample.xo-install.cfg index be804f3..b6b6e12 100644 --- a/sample.xo-install.cfg +++ b/sample.xo-install.cfg @@ -15,7 +15,7 @@ CONFIGUPDATE=true # Location of Xen Orchestra repository where source code is fetched REPOSITORY="https://github.com/vatesfr/xen-orchestra" -# Git branch or tag (append tags/ before the tag name) where xen-orchestra sources are fetched. +# Git branch, tag (append tags/ before the tag name) or individual commit where xen-orchestra sources are fetched. # Also, you can set this to "release" to use the latest tagged branch. BRANCH="master" diff --git a/xo-install.sh b/xo-install.sh index 1ae189c..047ca2e 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -490,15 +490,14 @@ function InstallXO { echo printinfo "Checking out latest tagged release '$TAG'" - runcmd "git checkout $TAG" + runcmd "cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME && git checkout $TAG" runcmd "cd $(dirname "$0")" # we don't need to do much magic if specific branch set so just checkout elif [[ "$BRANCH" != "master" ]]; then echo - printinfo "Checking out source code from branch '$BRANCH'" + printinfo "Checking out source code from branch/commit '$BRANCH'" - runcmd "cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME" - runcmd "git checkout $BRANCH" + runcmd "cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME && git checkout $BRANCH" runcmd "cd $(dirname "$0")" fi