From 1fc611fe6f1a1a3b1a22594575810d53e1d7dcbb Mon Sep 17 00:00:00 2001 From: Tobias von der Krone Date: Mon, 29 Jul 2013 09:25:51 +0200 Subject: [PATCH] replace test ([ expression ]) with bash internal [[ expression ]] --- maven_post_build_debian_wrapper.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/maven_post_build_debian_wrapper.sh b/maven_post_build_debian_wrapper.sh index 62bab2e..9c2f296 100755 --- a/maven_post_build_debian_wrapper.sh +++ b/maven_post_build_debian_wrapper.sh @@ -27,16 +27,16 @@ function validateSettings { exit 1 fi - if [ "$GIT_BRANCH_NAME" = "integration" ] || [ ${GIT_BRANCH_NAME:0:8} = "feature/" ] || [ ${GIT_BRANCH_NAME:0:3} = "poc/" ] || [ ${GIT_BRANCH_NAME:0:7} = "bugfix/" ]; then + if [[ "$GIT_BRANCH_NAME" = "integration" ]] || [[ ${GIT_BRANCH_NAME:0:8} = "feature/" ]] || [[ ${GIT_BRANCH_NAME:0:3} = "poc/" ]] || [[ ${GIT_BRANCH_NAME:0:7} = "bugfix/" ]]; then APPEND_TO_VERSION="experimental" REPO="dev-${SUITE}" - if [ "$GIT_BRANCH_NAME" = "integration" ]; then + if [[ "$GIT_BRANCH_NAME" = "integration" ]]; then DISTRIBUTION="dev-integration" else # set proper DISTRIBUTION for feature branches DISTRIBUTION=$(echo "dev-${GIT_BRANCH_NAME}" | tr '/' '-') fi - elif [ "$GIT_BRANCH_NAME" = "master" ] || [ ${GIT_BRANCH_NAME:0:7} = "hotfix/" ]; then + elif [[ "$GIT_BRANCH_NAME" = "master" ]] || [[ ${GIT_BRANCH_NAME:0:7} = "hotfix/" ]]; then APPEND_TO_VERSION="" DISTRIBUTION="production-proposed-updates" else @@ -44,7 +44,7 @@ function validateSettings { APPEND_TO_VERSION="develop" fi - if [ ! -z "$APPEND_TO_VERSION" ]; then + if [[ ! -z "$APPEND_TO_VERSION" ]]; then # remove -SNAPSHOT VERSION=$(echo $VERSION | sed -s "s#-SNAPSHOT##g") BUILD_START=$(date +%Y%m%d%H%M%S) @@ -74,7 +74,7 @@ set -e # fail on error set -x # echo commands executed # write correct debian/changelog -if [ "$GIT_BRANCH_NAME" = "master" ] || [ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]; then +if [[ "$GIT_BRANCH_NAME" = "master" ]] || [[ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]]; then # generate debian/changelog entries since the last upload git-dch -a --ignore-branch --no-full --no-meta --id-length=7 -N $VERSION # make sure distribution in changelog is set correctly @@ -93,7 +93,7 @@ else fi # check that we replaced things correctly... D=$(dpkg-parsechangelog 2>/dev/null|grep ^Distribution:|cut -d " " -f2) -if [ "$D" != "$DISTRIBUTION" ]; then +if [[ "$D" != "$DISTRIBUTION" ]]; then figlet "Wrong distribution!" dpkg-parsechangelog exit 1 @@ -115,7 +115,7 @@ dcmd rm $CHANGES_FILE cd $WORKSPACE # push back to git repo if build from master or hotfix/ -if [ "$GIT_BRANCH_NAME" = "master" ] || [ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]; then +if [[ "$GIT_BRANCH_NAME" = "master" ]] || [[ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]]; then git add debian/changelog git commit -m "Automatic commit by jenkins after build of $BUILD_NUMBER" # ~ and : are not valid in git tags, replace them: @@ -133,8 +133,8 @@ dpkg-parsechangelog cleanup # push back integration branch if we merged a feature branch -if [ ${GIT_BRANCH_NAME:0:8} = "feature/" ] || [ ${GIT_BRANCH_NAME:0:7} = "bugfix/" ]; then - if [[ "$BUILD_TRIGGERS" == *"merge"* ]]; then +if [[ ${GIT_BRANCH_NAME:0:8} = "feature/" ]] || [[ ${GIT_BRANCH_NAME:0:7} = "bugfix/" ]]; then + if [[ "$BUILD_TRIGGERS" = *"merge"* ]]; then git push origin integration figlet "Pushed to integration." git checkout origin/$GIT_BRANCH_NAME -b $GIT_BRANCH_NAME -- 2.39.5