diff options
| author | Robby Russell <robby@planetargon.com> | 2015-09-19 08:40:34 -0700 | 
|---|---|---|
| committer | Robby Russell <robby@planetargon.com> | 2015-09-19 08:40:34 -0700 | 
| commit | 56cdec75348cc7c33f54c5441884238c25a6597b (patch) | |
| tree | 2a47f31206b0c92e3fd6b5e2ed09dac712139ee3 /tools | |
| parent | 9c08641d7c2aae0c82fa5ad91f94c67b70115ba5 (diff) | |
| parent | e8caf22beb8cde69f097382a75f6d1a247625030 (diff) | |
| download | zsh-56cdec75348cc7c33f54c5441884238c25a6597b.tar.gz zsh-56cdec75348cc7c33f54c5441884238c25a6597b.tar.bz2 zsh-56cdec75348cc7c33f54c5441884238c25a6597b.zip | |
Merge pull request #3889 from leycec/compaudit
Repair `zsh` Path Permissions on `oh-my-zsh` Startup under Cygwin
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/install.sh | 18 | 
1 files changed, 15 insertions, 3 deletions
| diff --git a/tools/install.sh b/tools/install.sh index 1586cdee5..aebd28371 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -16,6 +16,13 @@ if [ -d "$ZSH" ]; then    exit  fi +# Prevent the cloned repository from having insecure permissions. Failing to do +# so causes compinit() calls to fail with "command not found: compdef" errors +# for users with insecure umasks (e.g., "002", allowing group writability). Note +# that this will be ignored under Cygwin by default, as Windows ACLs take +# precedence over umasks except for filesystems mounted with option "noacl". +umask g-w,o-w +  echo "\033[0;34mCloning Oh My Zsh...\033[0m"  hash git >/dev/null 2>&1 && env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {    echo "git not installed" @@ -41,12 +48,17 @@ export PATH=\"$PATH\"  " ~/.zshrc > ~/.zshrc-omztemp  mv -f ~/.zshrc-omztemp ~/.zshrc -TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') -if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then +# If this user's login shell is not already "zsh", attempt to switch. +if [ "$(expr "$SHELL" : '.*/\(.*\)')" != "zsh" ]; then +  # If this platform provides a "chsh" command (not Cygwin), do it, man! +  if hash chsh >/dev/null 2>&1; then      echo "\033[0;34mTime to change your default shell to zsh!\033[0m"      chsh -s $(grep /zsh$ /etc/shells | tail -1) +  # Else, suggest the user do so manually. +  else +    echo "\033[0;34mPlease manually change your default shell to zsh!\033[0m" +  fi  fi -unset TEST_CURRENT_SHELL  echo "\033[0;32m"'         __                                     __   '"\033[0m"  echo "\033[0;32m"'  ____  / /_     ____ ___  __  __   ____  _____/ /_  '"\033[0m" | 
