From d8afacabf98f7c88eea0f094626bfb03166f3c1a Mon Sep 17 00:00:00 2001 From: pika Date: Sun, 11 May 2025 12:59:33 +0200 Subject: [PATCH] wip --- distros.sh | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/distros.sh b/distros.sh index 18af6b8..d8ec417 100755 --- a/distros.sh +++ b/distros.sh @@ -35,7 +35,6 @@ command_exists() { command -v "$@" >/dev/null 2>&1 } silentexec() { - echo_note "Refreshing repositories.." "$@" >/dev/null 2>&1 } @@ -66,17 +65,17 @@ get_packager() { ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]') case "$ID" in - ubuntu | pop) + ubuntu | pop | zorin | kubuntu | linuxmintubuntu) ubuntu="true" distro="ubuntu" _install() { $_sudo apt-get install --assume-yes "$@"; } ;; - debian) + debian | kali | linuxmint | elementary | neon | kdeneon | deepin) debian="true" distro="debian" _install() { $_sudo apt-get install --assume-yes "$@"; } ;; - fedora) + fedora | centos | rhel | rocky | almalinux) fedora="true" distro="fedora" _install() { $_sudo dnf install -y "$@"; } @@ -152,25 +151,41 @@ get_packager() { case "$pkger" in apt-get) - debian="true" ubuntu="true" + debian="true" distro="debian" + _install() { $_sudo apt-get install --assume-yes "$@"; } ;; dnf) fedora="true" distro="fedora" + _install() { $_sudo dnf install -y "$@"; } + ;; + apk) + alpine="true" + distro="alpine" + _install() { $_sudo apk add "$@"; } ;; pacman) arch="true" distro="arch" + _install() { + if command_exists paru; then + echo_info "Using paru" + paru -S --color always --noconfirm --needed "$@" + elif command_exists yay; then + echo_info "Using yay" + yay -S --color always --noconfirm --needed "$@" + else + echo_warning "Using pacman" + $_sudo pacman -S --color always --noconfirm --needed "$@" + fi + } ;; - alpine) - alpine="true" - distro="alpine" - ;; - opensuse*) + zypper) opensuse="true" distro="opensuse" + _install() { $_sudo zypper in "$@"; } ;; *) echo_error "Can not detect distribution correctly!" @@ -182,6 +197,7 @@ get_packager() { } update_package_list() { + echo_note "Refreshing repositories.." case "$distro" in ubuntu | debian) silentexec $_sudo apt-get update ;; fedora) silentexec $_sudo dnf update ;;