installer: add ability to install from forked & branched repos
This facilitates testing of changes to the core installation code: you'll be
able to do a roundtrip test of install and uninstall using the working code on
your branch.
Controlled by passing $REPO and $BRANCH environment variables to install.sh.
Diff
1diff --git a/tools/install.sh b/tools/install.sh
2index f91e0295409827fe96de1906bdde30ef45850cbe..0d5ad263370a72bb5bf19d0a3f8aeec81e0636db 100755
3--- a/tools/install.sh
4+++ b/tools/install.sh
5@@ -5,13 +5,21 @@
6 # or wget:
7 # sh -c "$(wget -qO- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
8 #
9-# As an alternative, you can download the install script separately and
10-# run it afterwards with `sh install.sh'
11+# As an alternative, you can first download the install script and run it afterwards:
12+# wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
13+# sh install.sh
14+#
15+# Respects these environment variables for tweaking the installation process:
16+# REPO - name of the GitHub repo to install from (default: robbyrussell/oh-my-zsh)
17+# BRANCH - branch to check out immediately after install
18 #
19 set -e
2021-# Default location
22+# Default settings
23 ZSH=${ZSH:-~/.oh-my-zsh}
24+REPO=${REPO:-robbyrussell/oh-my-zsh}
25+BRANCH=${BRANCH:-master}
26+
2728 command_exists() {
29 command -v "$@" >/dev/null 2>&1
30@@ -68,7 +76,7 @@ setup_ohmyzsh() {
31 exit 1
32 fi
3334- git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$ZSH" || {
35+ git clone --depth=1 --branch "$BRANCH" "https://github.com/$REPO.git" "$ZSH" || {
36 error "git clone of oh-my-zsh repo failed"
37 exit 1
38 }