[provisioning] Do not restart shell unless necessary or requested

This commit is contained in:
Correl Roush 2018-02-27 00:21:29 -05:00
parent 087cd1ba7b
commit a95309f8e3
2 changed files with 12 additions and 3 deletions

View file

@ -24,6 +24,10 @@ while [[ $# -gt 0 ]]; do
INSTALL=($RECIPES) INSTALL=($RECIPES)
shift shift
;; ;;
-r|--restart)
RESTART_SHELL=1
shift
;;
*) *)
INSTALL+=("$1") INSTALL+=("$1")
shift shift
@ -68,5 +72,8 @@ for recipe in "${INSTALL[@]}"; do
_recipe $recipe _recipe $recipe
done done
echo "Finished, restarting shell." echo "Finished"
exec $SHELL if [ -n "$RESTART_SHELL" ]; then
echo "Restarting shell."
exec $SHELL
fi

View file

@ -29,9 +29,11 @@ esac
if [ "$__shell" != "$__zsh_bin" ]; then if [ "$__shell" != "$__zsh_bin" ]; then
echo "Install $__zsh_bin as default shell (currently $__shell)" echo "Install $__zsh_bin as default shell (currently $__shell)"
sudo chsh -s $__zsh_bin ${USER} sudo chsh -s $__zsh_bin ${USER}
export SHELL=$__zsh_bin
RESTART_SHELL=1
fi fi
export SHELL=$__zsh_bin
if ! [ -f ${HOME}/.zshrc ]; then if ! [ -f ${HOME}/.zshrc ]; then
_run "Install .zshrc" ln -s ${HOME}/dotfiles/.zshrc ${HOME}/.zshrc _run "Install .zshrc" ln -s ${HOME}/dotfiles/.zshrc ${HOME}/.zshrc
RESTART_SHELL=1
fi fi