From 0055f21f0a337ca77f50f16ff6a72d3243a5a307 Mon Sep 17 00:00:00 2001 From: pika Date: Fri, 9 May 2025 13:42:21 +0200 Subject: [PATCH] addet more checks --- distros.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/distros.sh b/distros.sh index 02bf734..18af6b8 100755 --- a/distros.sh +++ b/distros.sh @@ -92,13 +92,13 @@ get_packager() { _install() { if command_exists paru; then echo_info "Using paru" - paru -S --noconfirm "$@" + paru -S --color always --noconfirm --needed "$@" elif command_exists yay; then echo_info "Using yay" - yay -S --noconfirm "$@" + yay -S --color always --noconfirm --needed "$@" else echo_warning "Using pacman" - $_sudo pacman -S --noconfirm "$@" + $_sudo pacman -S --color always --noconfirm --needed "$@" fi } ;; @@ -135,8 +135,49 @@ get_packager() { ;; esac else - echo_error "Unable to detect distribution. /etc/os-release not found." - exit 1 + echo_warning "Unable to detect distribution /etc/os-release not found." + echo_note "Trying other methods.." + + # ─────────────────────────────────────< get packager >───────────────────────────────────── + pkger="" + for pkg in apt-get dnf pacman apk zypper; do + if command_exists $pkg; then + printf "Using ${RED}${pkg}${NC} method.." + pkger="$pkg" + + # break + return 0 + fi + done + + case "$pkger" in + apt-get) + debian="true" + ubuntu="true" + distro="debian" + ;; + dnf) + fedora="true" + distro="fedora" + ;; + pacman) + arch="true" + distro="arch" + ;; + alpine) + alpine="true" + distro="alpine" + ;; + opensuse*) + opensuse="true" + distro="opensuse" + ;; + *) + echo_error "Can not detect distribution correctly!" + echo_error "DEBUG:: $pkger ::" + return 69 + ;; + esac fi }