From a8d41e3af70309fb9c8df150ef162685bae41ee4 Mon Sep 17 00:00:00 2001 From: Sirushti Murugesan Date: Wed, 25 Sep 2013 11:30:31 +0530 Subject: [PATCH] Normalise RECLONE flag to True Or False. RECLONE flag now uses function trueorfalse for flag handling. Added more flag cases to normalisation function trueorfalse. Fixes bug #1200382 Change-Id: I0738537c87634281c6a92fa93b7f84a6b0dad497 --- functions | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/functions b/functions index 4c4487f9cb..6cdee78db6 100644 --- a/functions +++ b/functions @@ -551,6 +551,7 @@ function git_clone { GIT_REMOTE=$1 GIT_DEST=$2 GIT_REF=$3 + RECLONE=$(trueorfalse False $RECLONE) if [[ "$OFFLINE" = "True" ]]; then echo "Running in offline mode, clones already exist" @@ -576,7 +577,7 @@ function git_clone { cd $GIT_DEST # This checkout syntax works for both branches and tags git checkout $GIT_REF - elif [[ "$RECLONE" == "yes" ]]; then + elif [[ "$RECLONE" = "True" ]]; then # if it does exist then simulate what clone does if asked to RECLONE cd $GIT_DEST # set the url to pull from and fetch @@ -1260,16 +1261,16 @@ function stop_service() { # Normalize config values to True or False -# Accepts as False: 0 no false False FALSE -# Accepts as True: 1 yes true True TRUE +# Accepts as False: 0 no No NO false False FALSE +# Accepts as True: 1 yes Yes YES true True TRUE # VAR=$(trueorfalse default-value test-value) function trueorfalse() { local default=$1 local testval=$2 [[ -z "$testval" ]] && { echo "$default"; return; } - [[ "0 no false False FALSE" =~ "$testval" ]] && { echo "False"; return; } - [[ "1 yes true True TRUE" =~ "$testval" ]] && { echo "True"; return; } + [[ "0 no No NO false False FALSE" =~ "$testval" ]] && { echo "False"; return; } + [[ "1 yes Yes YES true True TRUE" =~ "$testval" ]] && { echo "True"; return; } echo "$default" }