mirror of
https://github.com/correl/dotfiles.git
synced 2024-11-16 11:09:29 +00:00
37 lines
789 B
Bash
37 lines
789 B
Bash
#!/bin/bash
|
|
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}
|
|
fi
|
|
export SHELL=$__zsh_bin
|
|
|
|
if ! [ -f ${HOME}/.zshrc ]; then
|
|
_run "Install .zshrc" ln -s ${HOME}/dotfiles/.zshrc ${HOME}/.zshrc
|
|
fi
|