From 0e57142729656bd0bd81a39704328330f9db4557 Mon Sep 17 00:00:00 2001 From: Jonathan Chang <31893406+cccntu@users.noreply.github.com> Date: Tue, 25 Feb 2020 03:39:10 +0800 Subject: installer: remove redundant cp command (#8668) --- tools/install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/install.sh b/tools/install.sh index ae248be89..bdf9f18e9 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -129,10 +129,9 @@ setup_zshrc() { echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}" - cp "$ZSH/templates/zshrc.zsh-template" ~/.zshrc sed "/^export ZSH=/ c\\ export ZSH=\"$ZSH\" -" ~/.zshrc > ~/.zshrc-omztemp +" "$ZSH/templates/zshrc.zsh-template" > ~/.zshrc-omztemp mv -f ~/.zshrc-omztemp ~/.zshrc echo -- cgit v1.2.3-70-g09d2 From 1a880fdb9b88c0c98a23d7b2ed2ddb42caef6662 Mon Sep 17 00:00:00 2001 From: Michael Dorst Date: Tue, 25 Feb 2020 13:42:39 -0800 Subject: installer: add option to install without replacing .zshrc (#8209) * Add option to install OMZ without replacing .zshrc tools/install.sh respects REPLACE_RC environment variable --noreplace-rc flag sets REPLACE_RC='no' * Change REPLACE_RC=no to KEEP_ZSHRC=yes Change --noreplace-rc to --keep-zshrc --- tools/install.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/install.sh b/tools/install.sh index bdf9f18e9..08f3db1e3 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -20,12 +20,14 @@ # BRANCH - branch to check out immediately after install (default: master) # # Other options: -# CHSH - 'no' means the installer will not change the default shell (default: yes) -# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes) +# CHSH - 'no' means the installer will not change the default shell (default: yes) +# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes) +# KEEP_ZSHRC - 'yes' means the installer will not replace an existing .zshrc (default: no) # # You can also pass some arguments to the install script to set some these options: # --skip-chsh: has the same behavior as setting CHSH to 'no' # --unattended: sets both CHSH and RUNZSH to 'no' +# --keep-zshrc: sets KEEP_ZSHRC to 'yes' # For example: # sh install.sh --unattended # @@ -40,6 +42,7 @@ BRANCH=${BRANCH:-master} # Other options CHSH=${CHSH:-yes} RUNZSH=${RUNZSH:-yes} +KEEP_ZSHRC=${KEEP_ZSHRC:-no} command_exists() { @@ -111,6 +114,11 @@ setup_zshrc() { # Must use this exact name so uninstall.sh can find it OLD_ZSHRC=~/.zshrc.pre-oh-my-zsh if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then + # Skip this if the user doesn't want to replace an existing .zshrc + if [ $KEEP_ZSHRC = yes ]; then + echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Keeping...${RESET}" + return + fi if [ -e "$OLD_ZSHRC" ]; then OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)" if [ -e "$OLD_OLD_ZSHRC" ]; then @@ -227,6 +235,7 @@ main() { case $1 in --unattended) RUNZSH=no; CHSH=no ;; --skip-chsh) CHSH=no ;; + --keep-zshrc) KEEP_ZSHRC=yes ;; esac shift done -- cgit v1.2.3-70-g09d2 From bccfe1389c97379388a148b3a48a63d7272ec017 Mon Sep 17 00:00:00 2001 From: Mauricio Wolff Date: Fri, 28 Feb 2020 03:06:20 +1100 Subject: updater: add --autostash to git pull (#7172) If I have custom configs (like theme customizations) I have to stash my changes and get them back after the update. By adding the --autostash on upgrade.sh, if I have any changes not commited they'll be reapplied after the upgrade, allowing me to have temporary customizations without any harm to the upgrade process. --- tools/upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 3005e6542..0dc84e214 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -38,7 +38,7 @@ if [ -n "$remote" ]; then fi printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh" -if git pull --rebase --stat origin master +if git pull --rebase --autostash --stat origin master then printf '%s' "$GREEN" printf '%s\n' ' __ __ ' -- cgit v1.2.3-70-g09d2