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 ## git-get-and-build-repo.sh
bring down current git repository and run mockbuild 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) * \<repository\> repository (package) to be built (e.g. smeserver-yum)
* \<organisation\> can be any organisation or user on the remote GITEA instance * \<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 # Not here, look at system default
if [ ! -e /etc/smegit.ini ] ; then if [ ! -e /etc/smegit.ini ] ; then
echo "No ini file found $inifiename or /etc/smegit.ini" 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 exit 1
else else
initfilename="/etc/smegit.ini" initfilename="/etc/smegit.ini"
@ -39,10 +39,14 @@ GITEAHOST=${remote_GITEAHOST}
ACCESSTOKEN=${remote_GITEAACCESSTOKEN} ACCESSTOKEN=${remote_GITEAACCESSTOKEN}
ORG_NAME="$2" ORG_NAME="$2"
REPO_NAME="$1" REPO_NAME="$1"
BRANCH=
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
for param in $3 $4 $5 $6; do for param in $3 $4 $5 $6; do
if [ $param ] ; then if [ $param ] ; then
case $param in case $param in
branch=* )
BRANCH="--${param}"
;;
local ) local )
GITEAHOST=${local_GITEAHOST} GITEAHOST=${local_GITEAHOST}
ACCESSTOKEN=${local_GITEAACCESSTOKEN} ACCESSTOKEN=${local_GITEAACCESSTOKEN}
@ -141,8 +145,8 @@ if [[ -d $REPO_NAME ]] ; then
if [ $DEBUG ] ; then echo "Deleting all files in $GITFiles/$REPO_NAME" ; fi if [ $DEBUG ] ; then echo "Deleting all files in $GITFiles/$REPO_NAME" ; fi
rm -rf "$GITFiles/$REPO_NAME" rm -rf "$GITFiles/$REPO_NAME"
fi fi
if [ $DEBUG ] ; then echo "cloning $REPOURL" ; fi if [ $DEBUG ] ; then echo "cloning $REPOURL $BRANCH" ; fi
git clone "$REPOURL" $QUIET git clone "$REPOURL" $BRANCH $QUIET
cd $GITFiles cd $GITFiles
if [[ ! -d $GITFiles/$REPO_NAME ]] ; then if [[ ! -d $GITFiles/$REPO_NAME ]] ; then