Browse Source

check_submodules.sh handle CI forced update only if directory exists

sbg
Daniel Agar 7 years ago
parent
commit
868ff42f47
  1. 21
      Tools/check_submodules.sh

21
Tools/check_submodules.sh

@ -3,8 +3,17 @@ @@ -3,8 +3,17 @@
function check_git_submodule {
# The .git exists in a submodule if init and update have been done.
if [ "$CI" != "true" ] && [[ -f $1"/.git" || -d $1"/.git" ]];
if [[ -f $1"/.git" || -d $1"/.git" ]];
then
if [ "$CI" == "true" ];
then
git submodule sync --recursive -- $1
git submodule update --init --recursive --force -- $1 || true
git submodule update --init --recursive --force -- $1
exit 0
fi
SUBMODULE_STATUS=$(git submodule summary "$1")
STATUSRETVAL=$(echo $SUBMODULE_STATUS | grep -A20 -i "$1")
if ! [[ -z "$STATUSRETVAL" ]];
@ -35,8 +44,8 @@ then @@ -35,8 +44,8 @@ then
elif [ "$user_cmd" == "u" ]
then
git submodule sync --recursive -- $1
git submodule update --init --recursive --force --quiet -- $1 || true
git submodule update --init --recursive -- $1
git submodule update --init --recursive -- $1 || true
git submodule update --init --recursive --force -- $1
echo "Submodule fixed, continuing build.."
else
echo "Build aborted."
@ -44,9 +53,9 @@ then @@ -44,9 +53,9 @@ then
fi
fi
else
git submodule sync --recursive -- $1
git submodule update --init --recursive --force -- $1 || true
git submodule update --init --recursive --force -- $1
git submodule sync --recursive --quiet -- $1
git submodule update --init --recursive -- $1 || true
git submodule update --init --recursive -- $1
fi
}

Loading…
Cancel
Save