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
This commit is contained in:
parent
23033e0399
commit
a8d41e3af7
11
functions
11
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"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user