From 3747edfdd40ee39d1e396cf8ea4090ec987f5a05 Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Mon, 12 Jan 2026 10:43:24 -0500 Subject: [PATCH 1/2] Refactor: Detect package manager instead of distro in installer Replace distro-based dependency detection with package manager detection for broader Linux distribution support. This automatically enables support for derivative distros (Linux Mint, Pop!_OS, Rocky Linux, etc.) without needing to enumerate each one. Added support for: - pacman (Arch, Manjaro, EndeavourOS) - zypper (openSUSE, SUSE) - apk (Alpine Linux) MSYS2 detection remains unchanged (via uname -s check before package manager detection). Co-Authored-By: Claude Opus 4.5 --- install.sh | 107 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 38 deletions(-) diff --git a/install.sh b/install.sh index dbd66669..8ec8ece8 100755 --- a/install.sh +++ b/install.sh @@ -143,45 +143,41 @@ echo "Working directory: $(pwd)" install_dependencies() { - # Check for MSYS2 first (before trying to source /etc/os-release) + # Check for MSYS2 first (before trying to detect package manager) if is_msys2; then echo "Platform: MSYS2/Windows" install_deps_msys2 return $? fi - source /etc/os-release - echo "Distro: $ID" - - case "$ID" in - ubuntu|debian) - install_deps_apt "$1" - ;; - centos) - if [[ "$VERSION_ID" == 7* ]]; then - install_deps_yum "$1" - else - install_deps_dnf "$1" - fi - ;; - rhel) - if [[ "$VERSION_ID" == 7* ]]; then - install_deps_yum "$1" - else - install_deps_dnf "$1" - fi - ;; - fedora) - install_deps_dnf "$1" - ;; - *) - echo "Unsupported Linux distro: $ID" >&2 - return 1 - ;; - esac + # Detect package manager instead of distro for broader compatibility + # This automatically supports all distros using these package managers + if command -v apt-get >/dev/null 2>&1; then + echo "Package manager: apt (Debian/Ubuntu/Mint/Pop!_OS/etc.)" + install_deps_apt + elif command -v dnf >/dev/null 2>&1; then + echo "Package manager: dnf (Fedora/RHEL 8+/Rocky/AlmaLinux/etc.)" + install_deps_dnf + elif command -v yum >/dev/null 2>&1; then + echo "Package manager: yum (RHEL 7/CentOS 7)" + install_deps_yum + elif command -v pacman >/dev/null 2>&1; then + echo "Package manager: pacman (Arch/Manjaro/EndeavourOS/etc.)" + install_deps_pacman + elif command -v zypper >/dev/null 2>&1; then + echo "Package manager: zypper (openSUSE/SUSE)" + install_deps_zypper + elif command -v apk >/dev/null 2>&1; then + echo "Package manager: apk (Alpine Linux)" + install_deps_apk + else + echo "ERROR: No supported package manager found" >&2 + echo "Supported package managers: apt, dnf, yum, pacman, zypper, apk" >&2 + return 1 + fi } -# For Ubuntu/Debian +# For apt-based distros (Debian, Ubuntu, Linux Mint, Pop!_OS, elementary OS, Zorin, MX Linux, etc.) install_deps_apt() { apt-get update && \ apt-get install -y --no-install-recommends \ @@ -194,25 +190,60 @@ install_deps_apt() { && rm -rf /var/lib/apt/lists/* } -# For CentOS 7/RHEL 7 (older) +# For yum-based distros (RHEL 7, CentOS 7, Amazon Linux) install_deps_yum() { yum install -y \ gcc gcc-c++ make cmake \ - python3 python3-devel python3-pip python3-venv \ - && yum clean all + python3 python3-devel python3-pip \ + && yum clean all } -# For Fedora/RHEL 8+/CentOS Stream +# For dnf-based distros (Fedora, RHEL 8+, CentOS Stream, Rocky Linux, AlmaLinux, Oracle Linux 8+) install_deps_dnf() { dnf install -y \ gcc gcc-c++ make cmake \ - python3 python3-devel python3-pip python3-venv \ - && dnf clean all + python3 python3-devel python3-pip \ + && dnf clean all +} + +# For pacman-based distros (Arch Linux, Manjaro, EndeavourOS, Garuda, ArcoLinux, etc.) +install_deps_pacman() { + pacman -Sy --noconfirm + pacman -S --noconfirm --needed \ + base-devel \ + gcc \ + make \ + cmake \ + pkgconf \ + python \ + python-pip \ + python-setuptools +} + +# For zypper-based distros (openSUSE, SUSE Linux Enterprise) +install_deps_zypper() { + zypper refresh && \ + zypper install -y \ + gcc gcc-c++ make cmake \ + python3 python3-devel python3-pip \ + pkg-config +} + +# For apk-based distros (Alpine Linux) +install_deps_apk() { + apk update && \ + apk add --no-cache \ + build-base \ + gcc \ + make \ + cmake \ + pkgconf \ + python3 python3-dev py3-pip } # For MSYS2 on Windows install_deps_msys2() { - echo "Installing dependencies via pacman..." + echo "Installing dependencies via pacman (MSYS2)..." # Update package database (but don't do full system upgrade to avoid breaking frozen bundles) pacman -Sy --noconfirm # Install required packages From 365157fa86924d4d1e2587aea1f15b7e677d4d0d Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Mon, 12 Jan 2026 10:50:33 -0500 Subject: [PATCH 2/2] Add python3-venv back to yum/dnf dependencies Restores python3-venv package to ensure venv module is available on minimal/container images where it may not be bundled with python3. Better to fail early with clear package error than later at venv creation. Co-Authored-By: Claude Opus 4.5 --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 8ec8ece8..3a3ad460 100755 --- a/install.sh +++ b/install.sh @@ -194,7 +194,7 @@ install_deps_apt() { install_deps_yum() { yum install -y \ gcc gcc-c++ make cmake \ - python3 python3-devel python3-pip \ + python3 python3-devel python3-pip python3-venv \ && yum clean all } @@ -202,7 +202,7 @@ install_deps_yum() { install_deps_dnf() { dnf install -y \ gcc gcc-c++ make cmake \ - python3 python3-devel python3-pip \ + python3 python3-devel python3-pip python3-venv \ && dnf clean all }