diff options
author | Marc Cornellà <hello@mcornella.com> | 2021-09-09 12:57:59 +0200 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2021-09-22 09:27:43 +0200 |
commit | 098bcda6910aa2f734fb0ad59ac089157a239c87 (patch) | |
tree | 198fbf01f92909fbb79aceae6ce1ce4ed02a03a3 /tools/install.sh | |
parent | 7ded6752fd34c513b0110b236c2ebd4fbbcd1a6f (diff) | |
download | zsh-098bcda6910aa2f734fb0ad59ac089157a239c87.tar.gz zsh-098bcda6910aa2f734fb0ad59ac089157a239c87.tar.bz2 zsh-098bcda6910aa2f734fb0ad59ac089157a239c87.zip |
feat(update): allow updating from branch set up on install
Closes #8788
Co-authored-by: Nikolas Garofil <nikolas@garofil.be>
Diffstat (limited to 'tools/install.sh')
-rwxr-xr-x | tools/install.sh | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/tools/install.sh b/tools/install.sh index cfc2808fe..510f83ce8 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -53,7 +53,7 @@ KEEP_ZSHRC=${KEEP_ZSHRC:-no} command_exists() { - command -v "$@" >/dev/null 2>&1 + command -v "$@" >/dev/null 2>&1 } fmt_error() { @@ -65,27 +65,27 @@ fmt_underline() { } fmt_code() { - # shellcheck disable=SC2016 # backtic in single-quote + # shellcheck disable=SC2016 # backtick in single-quote printf '`\033[38;5;247m%s%s`\n' "$*" "$RESET" } setup_color() { - # Only use colors if connected to a terminal - if [ -t 1 ]; then - RED=$(printf '\033[31m') - GREEN=$(printf '\033[32m') - YELLOW=$(printf '\033[33m') - BLUE=$(printf '\033[34m') - BOLD=$(printf '\033[1m') - RESET=$(printf '\033[m') - else - RED="" - GREEN="" - YELLOW="" - BLUE="" - BOLD="" - RESET="" - fi + # Only use colors if connected to a terminal + if [ -t 1 ]; then + RED=$(printf '\033[31m') + GREEN=$(printf '\033[32m') + YELLOW=$(printf '\033[33m') + BLUE=$(printf '\033[34m') + BOLD=$(printf '\033[1m') + RESET=$(printf '\033[m') + else + RED="" + GREEN="" + YELLOW="" + BLUE="" + BOLD="" + RESET="" + fi } setup_ohmyzsh() { @@ -114,6 +114,8 @@ setup_ohmyzsh() { -c fsck.zeroPaddedFilemode=ignore \ -c fetch.fsck.zeroPaddedFilemode=ignore \ -c receive.fsck.zeroPaddedFilemode=ignore \ + -c oh-my-zsh.remote=origin \ + -c oh-my-zsh.branch="$BRANCH" \ --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || { fmt_error "git clone of oh-my-zsh repo failed" exit 1 @@ -157,9 +159,9 @@ setup_zshrc() { sed "/^export ZSH=/ c\\ export ZSH=\"$ZSH\" " "$ZSH/templates/zshrc.zsh-template" > ~/.zshrc-omztemp - mv -f ~/.zshrc-omztemp ~/.zshrc + mv -f ~/.zshrc-omztemp ~/.zshrc - echo + echo } setup_shell() { |