From e7e193d41b7d05452be7a071e5bd033dc2e1772b Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 2 Mar 2025 17:50:23 +0000 Subject: [PATCH] minor fix --- bootstrap/linux/main.bash | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/bootstrap/linux/main.bash b/bootstrap/linux/main.bash index 98c09ee..7ba4699 100644 --- a/bootstrap/linux/main.bash +++ b/bootstrap/linux/main.bash @@ -27,11 +27,24 @@ IS_WSL=0 WINDOWS_USER="" PACKAGE_MANAGER="" +# WSL detection # NOTE: This is NOT a POSIX-compliant way, for POSIX-compliant way, use case/esac -if [[ "$(uname -r)" = *Microsoft* ]]; then - echo "[INFO] Running on WSL1 Skipping GUI setup" - IS_WSL=1 +if [[ "$(uname -r)" = *icrosoft* ]]; then + echo "[INFO] Running on WSL" WINDOWS_USER="$(cmd.exe /c "echo %USERNAME%" | tr -d '\r')" + IS_WSL=1 +fi + +if [ "$IS_WSL" -eq 1 ]; then + if [[ "$(uname -r)" = *Microsoft* ]]; then + IS_WSL=1 + elif [[ "$(uname -r)" = *microsoft* ]]; then + IS_WSL=2 + fi +fi + +if [ "$IS_WSL" -eq 1 ]; then + echo "[INFO] Running on WSL1 Skipping GUI setup" else read -p "[ACTION] Do you want to setup Linux GUI? (y/N) " -r choice case "$choice" in @@ -60,7 +73,16 @@ if [ "$WHEEL" -eq 1 ]; then PACKAGE_MANAGER="pacman" else echo "[ERROR] Unsupported package manager" - exit 1 + read -p "[ACTION] Do you still want to continue? (y/N) " -r choice + case "$choice" in + y | Y) + : + ;; + *) + echo "[ERROR] Exiting" + exit 1 + ;; + esac fi fi @@ -135,7 +157,6 @@ echo "[INFO] Installing Doom Emacs" source "$DOTFILES"/bootstrap/components/emacs.sh -# TODO: Untestest if [ "$IS_WSL" -eq 1 ]; then ln -sf "/mnt/c/Users/$WINDOWS_USER" "$HOME/winhome" ln -sf "/mnt/c/Users/$WINDOWS_USER/Downloads" "$HOME/Downloads" @@ -159,7 +180,6 @@ source "$DOTFILES"/bootstrap/linux/chromium-flags.bash source "$DOTFILES"/bootstrap/components/rime.sh -# TODO: Rewrite the script(mocha_port.fish) in bash/zsh or POSIX-compliant shell echo "[INFO] Installing Color Scheme (Catppuccin Mocha)" # fish $DOTFILES/bootstrap/temp/mocha_port.fish