Last active
December 30, 2017 21:57
-
-
Save psyke83/68d41bd9112b462a4d348156dc2f038b to your computer and use it in GitHub Desktop.
github .tar.gz fallback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/scriptmodules/helpers.sh b/scriptmodules/helpers.sh | |
index e916b771..e1e4311c 100644 | |
--- a/scriptmodules/helpers.sh | |
+++ b/scriptmodules/helpers.sh | |
@@ -351,6 +351,27 @@ function gitPullOrClone() { | |
[[ "$branch" != "master" ]] && git+=" --branch $branch" | |
echo "$git \"$repo\" \"$dir\"" | |
runCmd $git "$repo" "$dir" | |
+ if [[ "$?" -eq 128 && "$repo" == *github* ]]; then | |
+ echo "Pull/clone failed - attempting .tar.gz fallback..." | |
+ unset md_ret_errors | |
+ mkdir -p "$dir" | |
+ runCmd downloadAndExtract "${repo/\.git/}/archive/$branch.tar.gz" "$dir" 1 | |
+ if [[ -f "$dir/.gitmodules" ]]; then | |
+ local sub_path_key | |
+ local sub_path | |
+ pushd "$dir" >/dev/null | |
+ git init . | |
+ git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | | |
+ while read sub_path_key sub_path | |
+ do | |
+ [[ ! -d "$sub_path/.git" ]] && rm -rf "$sub_path" | |
+ runCmd git submodule add "$(git config -f .gitmodules --get "${sub_path_key//\.path/.url}")" "$path" | |
+ done | |
+ runCmd git submodule update --init --recursive | |
+ rm -rf .git | |
+ popd >/dev/null | |
+ fi | |
+ fi | |
fi | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment