From 0d88c91fc2aa7b53bb49b5022dc02bb1c7cafc5d Mon Sep 17 00:00:00 2001 From: Astounds Date: Wed, 5 Nov 2025 20:49:57 -0500 Subject: fix: skip install packages in Git Bash on Windows Prevents package manager errors when running install script in Git Bash by detecting Windows environment and only checking for essential tools. --- install.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'install.sh') diff --git a/install.sh b/install.sh index f2cd43e..d5f447d 100644 --- a/install.sh +++ b/install.sh @@ -36,6 +36,21 @@ function get_os_id() { grep "^id=" | head -n1 | cut -d= -f2 | tr -d '"' } +# ------------------------- +# Detect Git Bash/Windows +# ------------------------- +function is_git_bash_windows() { + # Check if running in Git Bash on Windows + if [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]] || [[ -n "$MSYSTEM" ]]; then + return 0 # true + fi + # Additional check for Windows environment + if [[ -n "$WINDIR" ]] || [[ -n "$SYSTEMROOT" ]]; then + return 0 # true + fi + return 1 # false +} + # ------------------------- # Map programs to packages # ------------------------- @@ -108,6 +123,31 @@ function install_package() { # Check and install programs # --------------------------- function check_and_install_programs() { + # Skip package installation if running in Git Bash on Windows + if is_git_bash_windows; then + msg "Detectado Git Bash en Windows - omitiendo instalación de paquetes del sistema" \ + "Detected Git Bash on Windows - skipping system package installation" + + # Check if essential programs are available + local missing_programs=() + local programs=("curl" "unzip") + + for prog in "${programs[@]}"; do + if ! command -v "$prog" &>/dev/null; then + missing_programs+=("$prog") + fi + done + + if [[ ${#missing_programs[@]} -gt 0 ]]; then + msg_err "Programas requeridos no encontrados: ${missing_programs[*]}" \ + "Required programs not found: ${missing_programs[*]}" + msg_err "Por favor instala Git for Windows completo que incluye estos programas." \ + "Please install complete Git for Windows which includes these programs." + exit 1 + fi + return 0 + fi + local os_id os_id=$(get_os_id) local programs=("curl" "less" "ls" "iproute2" "unzip") -- cgit v1.2.3