diff --git a/provision.sh b/provision.sh index b8e4e80..4d1bc04 100755 --- a/provision.sh +++ b/provision.sh @@ -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." -exec $SHELL +echo "Finished" +if [ -n "$RESTART_SHELL" ]; then + echo "Restarting shell." + exec $SHELL +fi diff --git a/recipes/zsh b/recipes/zsh index d723a4d..e539bea 100644 --- a/recipes/zsh +++ b/recipes/zsh @@ -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} + export SHELL=$__zsh_bin + RESTART_SHELL=1 fi -export SHELL=$__zsh_bin if ! [ -f ${HOME}/.zshrc ]; then _run "Install .zshrc" ln -s ${HOME}/dotfiles/.zshrc ${HOME}/.zshrc + RESTART_SHELL=1 fi