-
Notifications
You must be signed in to change notification settings - Fork 50
Refactor: Detect package manager instead of distro in installer #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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 \ | ||||||
|
||||||
| python3 python3-devel python3-pip \ | |
| python3 python3-devel python3-pip python3-venv \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of
python3-venvfrom yum-based installations could break functionality if virtual environments are required elsewhere in the installation process. Verify that virtual environment creation is not needed, or restorepython3-venvto maintain consistency with the original implementation.