diff --git a/install.sh b/install.sh index 2d810ae..c8d6c70 100755 --- a/install.sh +++ b/install.sh @@ -452,16 +452,29 @@ if [ "$1" == "remove" ]; then exit; fi; # else run install -if [ ! -f /etc/wsl.conf ]; then - $SUDO_CMD touch /etc/wsl.conf; -fi - -SYSTEM_SETTINGS="$(grep -Pzow '\[boot\]\nsystemd\=true' /etc/wsl.conf > /dev/null)"; -if [ "$SYSTEM_SETTINGS" == "" ]; then - echo "[boot] +# running on WSL +if [ -n "$WSL_DISTRO_NAME" ]; then + if [ ! -f /etc/wsl.conf ]; then + $SUDO_CMD touch /etc/wsl.conf; + fi + + SYSTEM_SETTINGS="$(grep -Pzow '\[boot\]\nsystemd\=true' /etc/wsl.conf > /dev/null)"; + if [ "$SYSTEM_SETTINGS" == "" ]; then + echo "[boot] systemd=true" | $SUDO_CMD tee /etc/wsl.conf; - echo "Not corresponding wsl configuration found, modified and need a WSL system restart from Windows terminal"; -fi + echo "Not a corresponding wsl configuration has found, conf was modified and need a WSL system restart from Windows terminal"; + + echo "Do you want to restart the $WSL_DISTRO_NAME system now? (Y/n)"; + read -r ANSWER; + if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ] ; then + echo "Exiting. Please join again using wsl command." + $SUDO_CMD poweroff -f; + else + echo "Bye."; + exit; + fi; + fi +fi; echo "Would you like to install/update docker? (y/N)"; read -r ANSWER;