fix: skip install packages in Git Bash on Windows
All checks were successful
All checks were successful
Prevents package manager errors when running install script in Git Bash by detecting Windows environment and only checking for essential tools.
This commit is contained in:
40
install.sh
40
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")
|
||||
|
||||
Reference in New Issue
Block a user