installer: allow configuration of remote URL to clone from

This commit is contained in:
Marc Cornellà 2019-05-26 18:57:40 +02:00
parent aa27430e10
commit 220d69b2ce

View file

@ -11,16 +11,17 @@
# #
# Respects these environment variables for tweaking the installation process: # Respects these environment variables for tweaking the installation process:
# REPO - name of the GitHub repo to install from (default: robbyrussell/oh-my-zsh) # REPO - name of the GitHub repo to install from (default: robbyrussell/oh-my-zsh)
# BRANCH - branch to check out immediately after install # REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS)
# BRANCH - branch to check out immediately after install (default: master)
# #
set -e set -e
# Default settings # Default settings
ZSH=${ZSH:-~/.oh-my-zsh} ZSH=${ZSH:-~/.oh-my-zsh}
REPO=${REPO:-robbyrussell/oh-my-zsh} REPO=${REPO:-robbyrussell/oh-my-zsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master} BRANCH=${BRANCH:-master}
command_exists() { command_exists() {
command -v "$@" >/dev/null 2>&1 command -v "$@" >/dev/null 2>&1
} }
@ -76,7 +77,7 @@ setup_ohmyzsh() {
exit 1 exit 1
fi fi
git clone --depth=1 --branch "$BRANCH" "https://github.com/$REPO.git" "$ZSH" || { git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || {
error "git clone of oh-my-zsh repo failed" error "git clone of oh-my-zsh repo failed"
exit 1 exit 1
} }