diff --git a/update.sh b/update.sh index 2dd3de6..9a56a36 100755 --- a/update.sh +++ b/update.sh @@ -84,15 +84,21 @@ function revision() { } function getGIT() { # getGIT $REPO $BRANCH $TARGET (directory) + echo "--- start getGIT() ---" if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]]; then echo "getGIT wrong usage, check your script or tell the author!" 1>&2; return 1; fi REPO="$1"; BRANCH="$2"; TARGET="$3"; pushd .; tmp=/tmp/getGIT-tmp.$RANDOM.$RANDOM + echo "--- 2nd getGIT() ---" if cd "$TARGET" &>/dev/null && [[ $(git remote get-url origin) == "$REPO" ]] && git fetch --depth 1 origin "$BRANCH" && git reset --hard FETCH_HEAD; then popd && return 0; fi popd; if ! cd /tmp || ! rm -rf "$TARGET"; then return 1; fi + echo "--- 3rd getGIT() ---" if git clone --depth 1 --single-branch --branch "$2" "$1" "$3"; then return 0; fi + echo "--- 4th getGIT() ---" if wget -O "$tmp" "${REPO%".git"}/archive/$BRANCH.zip" && unzip "$tmp" -d "$tmp.folder"; then if mv -fT "$tmp.folder/$(ls $tmp.folder)" "$TARGET"; then rm -rf "$tmp" "$tmp.folder"; return 0; fi fi + echo "--- 5th getGIT() ---" rm -rf "$tmp" "$tmp.folder"; return 1 + echo "--- end getGIT() ---" } REPO="https://github.com/adsbfi/adsb-fi-scripts.git"