diff --git a/README.md b/README.md index 9d53ff2..fa19697 100644 --- a/README.md +++ b/README.md @@ -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 [ ] + git-get-and-build.sh [branch= ] +* \ will bring back a specific branch, otherwise Master * \ repository (package) to be built (e.g. smeserver-yum) * \ can be any organisation or user on the remote GITEA instance diff --git a/git-get-repo-and-build.sh b/git-get-repo-and-build.sh index 985cbaa..4eb13ae 100755 --- a/git-get-repo-and-build.sh +++ b/git-get-repo-and-build.sh @@ -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 [ ]" + echo "get-repo-and-build.sh [branch= ]" 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