From c45eec93af153ab642f349a75963d8eb92bc55df Mon Sep 17 00:00:00 2001 From: DatRatVS Date: Wed, 4 Mar 2026 11:23:25 -0300 Subject: [PATCH] improve distro detection in install script with `/etc/os-release` --- install.sh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index d5d84de9..db9a92dd 100755 --- a/install.sh +++ b/install.sh @@ -25,11 +25,27 @@ has_font() { fc-list 2>/dev/null | grep -qi "$1"; } # === Distro Detection === detect_distro() { - [[ -f /etc/NIXOS ]] && echo "nixos" && return - has_cmd pacman && echo "arch" && return - has_cmd dnf && echo "fedora" && return - has_cmd apt && echo "debian" && return - echo "unknown" + if [[ -f /etc/os-release ]]; then + local id + id=$(. /etc/os-release && echo "${ID,,}") + case "$id" in + nixos) echo "nixos" ;; + arch | manjaro | endeavouros) echo "arch" ;; + fedora | rhel | centos | rocky | almalinux | alma) echo "fedora" ;; + debian | ubuntu | mint | pop) echo "debian" ;; + *) echo "$id" ;; + esac + return 0 + else + # + # Fallbacks to original Ambxst detection method + # + [[ -f /etc/NIXOS ]] && echo "nixos" && return + has_cmd pacman && echo "arch" && return + has_cmd dnf && echo "fedora" && return + has_cmd apt && echo "debian" && return + echo "unknown" + fi } DISTRO=$(detect_distro)