[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)
shift
;;
-r|--restart)
RESTART_SHELL=1
shift
;;
*)
INSTALL+=("$1")
shift
@ -68,5 +72,8 @@ for recipe in "${INSTALL[@]}"; do
_recipe $recipe
done
echo "Finished, restarting shell."
echo "Finished"
if [ -n "$RESTART_SHELL" ]; then
echo "Restarting shell."
exec $SHELL
fi

View file

@ -29,9 +29,11 @@ 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
RESTART_SHELL=1
fi
if ! [ -f ${HOME}/.zshrc ]; then
_run "Install .zshrc" ln -s ${HOME}/dotfiles/.zshrc ${HOME}/.zshrc
RESTART_SHELL=1
fi