mirror of
https://github.com/correl/dotfiles.git
synced 2024-11-27 11:09:52 +00:00
40 lines
892 B
Bash
40 lines
892 B
Bash
#!/bin/bash
|
|
# Description: Feature-rich interactive shell with plugins
|
|
set -e
|
|
|
|
case $_PLATFORM in
|
|
darwin)
|
|
_recipe brew
|
|
_brew zsh
|
|
;;
|
|
*)
|
|
_recipe _apt
|
|
_apt zsh
|
|
;;
|
|
esac
|
|
|
|
__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
|
|
case $_PLATFORM in
|
|
darwin)
|
|
__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}
|
|
export SHELL=$__zsh_bin
|
|
RESTART_SHELL=1
|
|
fi
|
|
|
|
if ! [ -f ${HOME}/.zshrc ]; then
|
|
_run "Install .zshrc" ln -s ${HOME}/dotfiles/.zshrc ${HOME}/.zshrc
|
|
RESTART_SHELL=1
|
|
fi
|