2018-02-22 04:15:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set +e
|
|
|
|
|
2018-02-23 21:37:02 +00:00
|
|
|
case $_PLATFORM in
|
|
|
|
darwin)
|
|
|
|
_recipe brew
|
|
|
|
_brew zsh
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_recipe _apt
|
|
|
|
_apt zsh
|
|
|
|
;;
|
|
|
|
esac
|
2018-02-22 04:15:49 +00:00
|
|
|
|
|
|
|
__zsh_bin="$(which zsh)"
|
|
|
|
__zsh_files=(.zshrc)
|
|
|
|
|
|
|
|
if ! grep "^$__zsh_bin\$" /etc/shells >/dev/null; then
|
|
|
|
sudo sh -c "echo $__zsh_bin >> /etc/shells"
|
|
|
|
fi
|
2018-02-23 21:37:02 +00:00
|
|
|
case $_PLATFORM in
|
|
|
|
darwin)
|
2018-02-22 04:15:49 +00:00
|
|
|
__shell=$(dscl . -read /Users/${USER} UserShell | awk '{print $2}')
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
__shell=$(getent passwd $USER | cut -d: -f7)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if [ "$__shell" != "$__zsh_bin" ]; then
|
|
|
|
echo "Install $__zsh_bin as default shell (currently $__shell)"
|
|
|
|
sudo chsh -s $__zsh_bin ${USER}
|
|
|
|
fi
|
|
|
|
export SHELL=$__zsh_bin
|
|
|
|
|
|
|
|
if ! [ -f ${HOME}/.zshrc ]; then
|
|
|
|
_run "Install .zshrc" ln -s ${HOME}/dotfiles/.zshrc ${HOME}/.zshrc
|
|
|
|
fi
|