2018-02-22 04:15:49 +00:00
|
|
|
#!/bin/bash
|
2018-04-12 18:07:33 +00:00
|
|
|
# Description: Feature-rich interactive shell with plugins
|
2018-02-27 05:15:14 +00:00
|
|
|
set -e
|
2018-02-22 04:15:49 +00:00
|
|
|
|
2018-02-23 21:37:02 +00:00
|
|
|
case $_PLATFORM in
|
|
|
|
darwin)
|
|
|
|
_recipe brew
|
|
|
|
_brew zsh
|
|
|
|
;;
|
2021-02-05 00:05:51 +00:00
|
|
|
arch)
|
|
|
|
_recipe _arch
|
|
|
|
_pacman zsh
|
|
|
|
;;
|
|
|
|
debian)
|
2018-02-23 21:37:02 +00:00
|
|
|
_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}
|
2018-02-27 05:21:29 +00:00
|
|
|
export SHELL=$__zsh_bin
|
|
|
|
RESTART_SHELL=1
|
2018-02-22 04:15:49 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! [ -f ${HOME}/.zshrc ]; then
|
|
|
|
_run "Install .zshrc" ln -s ${HOME}/dotfiles/.zshrc ${HOME}/.zshrc
|
2018-02-27 05:21:29 +00:00
|
|
|
RESTART_SHELL=1
|
2018-02-22 04:15:49 +00:00
|
|
|
fi
|