From 294a38670fafa9823f380aad5c8f95ed5334c8c8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 13 Sep 2019 11:14:03 +0100 Subject: [PATCH] updated update_my_repos.sh --- update_my_repos.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/update_my_repos.sh b/update_my_repos.sh index cf3705cf..9bf5fe97 100755 --- a/update_my_repos.sh +++ b/update_my_repos.sh @@ -17,6 +17,8 @@ set -euo pipefail [ -n "${DEBUG:-}" ] && set -x srcdir="$(dirname "$0")" +git_url="${GIT_URL:-https://github.com}" + run(){ local repofile="$1" echo "processing repos from file: $repofile" @@ -24,6 +26,9 @@ run(){ repo_dir="${repo##*:}" repo_dir="${repo_dir##*/}" repo="${repo%%:*}" + if ! echo "$repo" | grep -q "/"; then + repo="HariSekhon/$repo" + fi if [ -d "$repo_dir" ]; then pushd "$repo_dir" # make update does git pull but if that mechanism is broken then this first git pull will allow the repo to self-fix itself @@ -37,7 +42,7 @@ run(){ fi popd else - git clone "https://github.com/harisekhon/$repo" "$repo_dir" + git clone "$git_url/$repo" "$repo_dir" fi done < <(sed 's/#.*//; /^[[:space:]]*$/d' < "$repofile") }