Added branch option

This commit is contained in:
Trevor Batley 2023-07-23 15:17:45 +10:00
parent e2b9906429
commit 98eddc7b64
2 changed files with 9 additions and 4 deletions

View File

@ -26,8 +26,9 @@ optional parameters, can appear in any order
## git-get-and-build-repo.sh
bring down current git repository and run mockbuild
git-get-and-build.sh <repository> <organisation> [<local> <debug>]
git-get-and-build.sh <repository> <organisation> [branch=<branch> <local> <debug>]
* \<branch=<branch\> will bring back a specific branch, otherwise Master
* \<repository\> repository (package) to be built (e.g. smeserver-yum)
* \<organisation\> can be any organisation or user on the remote GITEA instance

View File

@ -8,7 +8,7 @@ if [ ! -e $inifilename ] ; then
# Not here, look at system default
if [ ! -e /etc/smegit.ini ] ; then
echo "No ini file found $inifiename or /etc/smegit.ini"
echo "get-repo-and-build.sh <organisation> <reponame> [<local> <debug>]"
echo "get-repo-and-build.sh <organisation> <reponame> [branch=<branch> <local> <debug>]"
exit 1
else
initfilename="/etc/smegit.ini"
@ -39,10 +39,14 @@ GITEAHOST=${remote_GITEAHOST}
ACCESSTOKEN=${remote_GITEAACCESSTOKEN}
ORG_NAME="$2"
REPO_NAME="$1"
BRANCH=
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
for param in $3 $4 $5 $6; do
if [ $param ] ; then
case $param in
branch=* )
BRANCH="--${param}"
;;
local )
GITEAHOST=${local_GITEAHOST}
ACCESSTOKEN=${local_GITEAACCESSTOKEN}
@ -141,8 +145,8 @@ if [[ -d $REPO_NAME ]] ; then
if [ $DEBUG ] ; then echo "Deleting all files in $GITFiles/$REPO_NAME" ; fi
rm -rf "$GITFiles/$REPO_NAME"
fi
if [ $DEBUG ] ; then echo "cloning $REPOURL" ; fi
git clone "$REPOURL" $QUIET
if [ $DEBUG ] ; then echo "cloning $REPOURL $BRANCH" ; fi
git clone "$REPOURL" $BRANCH $QUIET
cd $GITFiles
if [[ ! -d $GITFiles/$REPO_NAME ]] ; then