Commit 4f87835bac074648b5f5108fd499ee67cd04b26f
1 parent
ed37aae5b4
Exists in
master
and in
2 other branches
Squashed 'repos/robbyrussell/oh-my-zsh/' changes from 8c84342..e44aa50
e44aa50 Merge pull request #4535 from robbyrussell/mcornella-patch-1 e9de366 Update custom location command and fix code format ba20b98 Merge pull request #4016 from coopermaruyama/master 9264d75 Fix typo. 405ee83 Merge pull request #4500 from sachin21/modify_a_condition d06f4d0 Fix backwards logic in uninstaller once and for all a1755e6 Refactor for method in plugins/rake-fast/rake-fast.plugin.zsh 4e42e1f Fix conditional in uninstall prompt b2010a0 Fix syntax error in confirmation prompt of uninstall.sh ca5632b Fix syntax error in #4515 on certain shells 78dc858 Revert "Make install script safer" git-subtree-dir: repos/robbyrussell/oh-my-zsh git-subtree-split: e44aa50301cbdb9c713193263e6c0c5a9a5798c0
Showing 5 changed files with 117 additions and 123 deletions Side-by-side Diff
README.markdown
... | ... | @@ -25,11 +25,15 @@ Oh My Zsh is installed by running one of the following commands in your terminal |
25 | 25 | |
26 | 26 | #### via curl |
27 | 27 | |
28 | -`sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"` | |
28 | +```shell | |
29 | +sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
30 | +``` | |
29 | 31 | |
30 | 32 | #### via wget |
31 | 33 | |
32 | -`sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"` | |
34 | +```shell | |
35 | +sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" | |
36 | +``` | |
33 | 37 | |
34 | 38 | ## Using Oh My Zsh |
35 | 39 | |
... | ... | @@ -100,7 +104,7 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory) |
100 | 104 | If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this: |
101 | 105 | |
102 | 106 | ```shell |
103 | -curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh | |
107 | +export ZSH="~/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
104 | 108 | ``` |
105 | 109 | |
106 | 110 | #### Manual Installation |
plugins/coffee/coffee.plugin.zsh
plugins/rake-fast/rake-fast.plugin.zsh
... | ... | @@ -8,17 +8,7 @@ _rake_refresh () { |
8 | 8 | } |
9 | 9 | |
10 | 10 | _rake_does_task_list_need_generating () { |
11 | - if [ ! -f .rake_tasks ]; then return 0; | |
12 | - else | |
13 | - if [[ "$OSTYPE" = darwin* ]]; then | |
14 | - accurate=$(stat -f%m .rake_tasks) | |
15 | - changed=$(stat -f%m Rakefile) | |
16 | - else | |
17 | - accurate=$(stat -c%Y .rake_tasks) | |
18 | - changed=$(stat -c%Y Rakefile) | |
19 | - fi | |
20 | - return $(expr $accurate '>=' $changed) | |
21 | - fi | |
11 | + [[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]] | |
22 | 12 | } |
23 | 13 | |
24 | 14 | _rake_generate () { |
tools/install.sh
1 | -function main() { | |
2 | -# Use colors, but only if connected to a terminal, and that terminal | |
3 | -# supports them. | |
4 | -if which tput >/dev/null 2>&1; then | |
5 | - ncolors=$(tput colors) | |
6 | -fi | |
7 | -if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then | |
8 | - RED="$(tput setaf 1)" | |
9 | - GREEN="$(tput setaf 2)" | |
10 | - YELLOW="$(tput setaf 3)" | |
11 | - BLUE="$(tput setaf 4)" | |
12 | - BOLD="$(tput bold)" | |
13 | - NORMAL="$(tput sgr0)" | |
14 | -else | |
15 | - RED="" | |
16 | - GREEN="" | |
17 | - YELLOW="" | |
18 | - BLUE="" | |
19 | - BOLD="" | |
20 | - NORMAL="" | |
21 | -fi | |
1 | +main() { | |
2 | + # Use colors, but only if connected to a terminal, and that terminal | |
3 | + # supports them. | |
4 | + if which tput >/dev/null 2>&1; then | |
5 | + ncolors=$(tput colors) | |
6 | + fi | |
7 | + if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then | |
8 | + RED="$(tput setaf 1)" | |
9 | + GREEN="$(tput setaf 2)" | |
10 | + YELLOW="$(tput setaf 3)" | |
11 | + BLUE="$(tput setaf 4)" | |
12 | + BOLD="$(tput bold)" | |
13 | + NORMAL="$(tput sgr0)" | |
14 | + else | |
15 | + RED="" | |
16 | + GREEN="" | |
17 | + YELLOW="" | |
18 | + BLUE="" | |
19 | + BOLD="" | |
20 | + NORMAL="" | |
21 | + fi | |
22 | 22 | |
23 | -# Only enable exit-on-error after the non-critical colorization stuff, | |
24 | -# which may fail on systems lacking tput or terminfo | |
25 | -set -e | |
23 | + # Only enable exit-on-error after the non-critical colorization stuff, | |
24 | + # which may fail on systems lacking tput or terminfo | |
25 | + set -e | |
26 | 26 | |
27 | -CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) | |
28 | -if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then | |
29 | - printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" | |
30 | - exit | |
31 | -fi | |
32 | -unset CHECK_ZSH_INSTALLED | |
27 | + CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) | |
28 | + if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then | |
29 | + printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" | |
30 | + exit | |
31 | + fi | |
32 | + unset CHECK_ZSH_INSTALLED | |
33 | 33 | |
34 | -if [ ! -n "$ZSH" ]; then | |
35 | - ZSH=~/.oh-my-zsh | |
36 | -fi | |
34 | + if [ ! -n "$ZSH" ]; then | |
35 | + ZSH=~/.oh-my-zsh | |
36 | + fi | |
37 | 37 | |
38 | -if [ -d "$ZSH" ]; then | |
39 | - printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n" | |
40 | - printf "You'll need to remove $ZSH if you want to re-install.\n" | |
41 | - exit | |
42 | -fi | |
38 | + if [ -d "$ZSH" ]; then | |
39 | + printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n" | |
40 | + printf "You'll need to remove $ZSH if you want to re-install.\n" | |
41 | + exit | |
42 | + fi | |
43 | 43 | |
44 | -# Prevent the cloned repository from having insecure permissions. Failing to do | |
45 | -# so causes compinit() calls to fail with "command not found: compdef" errors | |
46 | -# for users with insecure umasks (e.g., "002", allowing group writability). Note | |
47 | -# that this will be ignored under Cygwin by default, as Windows ACLs take | |
48 | -# precedence over umasks except for filesystems mounted with option "noacl". | |
49 | -umask g-w,o-w | |
44 | + # Prevent the cloned repository from having insecure permissions. Failing to do | |
45 | + # so causes compinit() calls to fail with "command not found: compdef" errors | |
46 | + # for users with insecure umasks (e.g., "002", allowing group writability). Note | |
47 | + # that this will be ignored under Cygwin by default, as Windows ACLs take | |
48 | + # precedence over umasks except for filesystems mounted with option "noacl". | |
49 | + umask g-w,o-w | |
50 | 50 | |
51 | -printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" | |
52 | -hash git >/dev/null 2>&1 || { | |
53 | - echo "Error: git is not installed" | |
54 | - exit 1 | |
55 | -} | |
56 | -env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { | |
57 | - printf "Error: git clone of oh-my-zsh repo failed\n" | |
58 | - exit 1 | |
59 | -} | |
60 | - | |
61 | -# The Windows (MSYS) Git is not compatible with normal use on cygwin | |
62 | -if [ "$OSTYPE" = cygwin ]; then | |
63 | - if git --version | grep msysgit > /dev/null; then | |
64 | - echo "Error: Windows/MSYS Git is not supported on Cygwin" | |
65 | - echo "Error: Make sure the Cygwin git package is installed and is first on the path" | |
51 | + printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" | |
52 | + hash git >/dev/null 2>&1 || { | |
53 | + echo "Error: git is not installed" | |
54 | + exit 1 | |
55 | + } | |
56 | + env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { | |
57 | + printf "Error: git clone of oh-my-zsh repo failed\n" | |
66 | 58 | exit 1 |
59 | + } | |
60 | + | |
61 | + # The Windows (MSYS) Git is not compatible with normal use on cygwin | |
62 | + if [ "$OSTYPE" = cygwin ]; then | |
63 | + if git --version | grep msysgit > /dev/null; then | |
64 | + echo "Error: Windows/MSYS Git is not supported on Cygwin" | |
65 | + echo "Error: Make sure the Cygwin git package is installed and is first on the path" | |
66 | + exit 1 | |
67 | + fi | |
67 | 68 | fi |
68 | -fi | |
69 | 69 | |
70 | -printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n" | |
71 | -if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then | |
72 | - printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n"; | |
73 | - mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh; | |
74 | -fi | |
70 | + printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n" | |
71 | + if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then | |
72 | + printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n"; | |
73 | + mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh; | |
74 | + fi | |
75 | 75 | |
76 | -printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n" | |
77 | -cp $ZSH/templates/zshrc.zsh-template ~/.zshrc | |
78 | -sed "/^export ZSH=/ c\\ | |
79 | -export ZSH=$ZSH | |
80 | -" ~/.zshrc > ~/.zshrc-omztemp | |
81 | -mv -f ~/.zshrc-omztemp ~/.zshrc | |
76 | + printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n" | |
77 | + cp $ZSH/templates/zshrc.zsh-template ~/.zshrc | |
78 | + sed "/^export ZSH=/ c\\ | |
79 | + export ZSH=$ZSH | |
80 | + " ~/.zshrc > ~/.zshrc-omztemp | |
81 | + mv -f ~/.zshrc-omztemp ~/.zshrc | |
82 | 82 | |
83 | -printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n" | |
84 | -sed "/export PATH=/ c\\ | |
85 | -export PATH=\"$PATH\" | |
86 | -" ~/.zshrc > ~/.zshrc-omztemp | |
87 | -mv -f ~/.zshrc-omztemp ~/.zshrc | |
83 | + printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n" | |
84 | + sed "/export PATH=/ c\\ | |
85 | + export PATH=\"$PATH\" | |
86 | + " ~/.zshrc > ~/.zshrc-omztemp | |
87 | + mv -f ~/.zshrc-omztemp ~/.zshrc | |
88 | 88 | |
89 | -# If this user's login shell is not already "zsh", attempt to switch. | |
90 | -TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') | |
91 | -if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then | |
92 | - # If this platform provides a "chsh" command (not Cygwin), do it, man! | |
93 | - if hash chsh >/dev/null 2>&1; then | |
94 | - printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n" | |
95 | - chsh -s $(grep /zsh$ /etc/shells | tail -1) | |
96 | - # Else, suggest the user do so manually. | |
97 | - else | |
98 | - printf "I can't change your shell automatically because this system does not have chsh.\n" | |
99 | - printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n" | |
89 | + # If this user's login shell is not already "zsh", attempt to switch. | |
90 | + TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') | |
91 | + if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then | |
92 | + # If this platform provides a "chsh" command (not Cygwin), do it, man! | |
93 | + if hash chsh >/dev/null 2>&1; then | |
94 | + printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n" | |
95 | + chsh -s $(grep /zsh$ /etc/shells | tail -1) | |
96 | + # Else, suggest the user do so manually. | |
97 | + else | |
98 | + printf "I can't change your shell automatically because this system does not have chsh.\n" | |
99 | + printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n" | |
100 | + fi | |
100 | 101 | fi |
101 | -fi | |
102 | 102 | |
103 | -printf "${GREEN}" | |
104 | -echo ' __ __ ' | |
105 | -echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' | |
106 | -echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' | |
107 | -echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' | |
108 | -echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' | |
109 | -echo ' /____/ ....is now installed!' | |
110 | -echo '' | |
111 | -echo '' | |
112 | -echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.' | |
113 | -echo '' | |
114 | -echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' | |
115 | -echo '' | |
116 | -echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.' | |
117 | -echo '' | |
118 | -printf "${NORMAL}" | |
119 | -env zsh | |
103 | + printf "${GREEN}" | |
104 | + echo ' __ __ ' | |
105 | + echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' | |
106 | + echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' | |
107 | + echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' | |
108 | + echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' | |
109 | + echo ' /____/ ....is now installed!' | |
110 | + echo '' | |
111 | + echo '' | |
112 | + echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.' | |
113 | + echo '' | |
114 | + echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' | |
115 | + echo '' | |
116 | + echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.' | |
117 | + echo '' | |
118 | + printf "${NORMAL}" | |
119 | + env zsh | |
120 | 120 | } |
121 | 121 | |
122 | 122 | main |
tools/uninstall.sh
1 | 1 | read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation |
2 | -if ! [[ $confirmation =~ ^[yY]$ ]] | |
2 | +if [ "$confirmation" != y ] && [ "$confirmation" != Y ] | |
3 | 3 | then |
4 | - echo "Uninstall cancelled" | |
5 | - exit | |
4 | + echo "Uninstall cancelled" | |
5 | + exit | |
6 | 6 | fi |
7 | 7 | |
8 | 8 | echo "Removing ~/.oh-my-zsh" |