From d62d9b66f220b22b69f1d5fd4b842e96490eccb8 Mon Sep 17 00:00:00 2001 From: pika Date: Fri, 16 May 2025 16:09:24 +0200 Subject: [PATCH] fixed some settings --- distros.sh | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/distros.sh b/distros.sh index a57a610..575ce38 100755 --- a/distros.sh +++ b/distros.sh @@ -52,16 +52,27 @@ run() { } checkAndInstall() { - echo "DEBUG:: GOT ARRAY :: ${@}" - for deps in "${@}"; do - echo_info "Installing $deps" - if ! command_exists $deps; then - echo_note "$deps is not installed. Installing it now.." - run _install "$deps" + # echo "DEBUG:: GOT ARRAY :: ${@}" + # ─< if it's not a list, then just check and install the package.. >────────────────────── + if [ -z "$2" ]; then + if ! command_exists "$1"; then + echo_note "$1 is not installed. Installing it now.." + run _install "$1" else - echo_note "skipping $deps - as it's already installed.." + echo_note "skipping $1 - as it's already installed.." fi - done + else + # ─< else go though the list of items and do the same >─────────────────────────────────── + for deps in "${@}"; do + echo_info "Installing $deps" + if ! command_exists $deps; then + echo_note "$deps is not installed. Installing it now.." + run _install "$deps" + else + echo_note "skipping $deps - as it's already installed.." + fi + done + fi } # ─< Check if the user is root and set sudo variable if necessary >─────────────────────── @@ -231,7 +242,7 @@ get_packager() { ;; *) echo_error "Can not detect distribution correctly!" - echo_error "DEBUG:: $pkger ::" + # echo_error "DEBUG:: $pkger ::" return 69 ;; esac @@ -246,19 +257,19 @@ get_packager() { update_package_list() { echo_note "Refreshing repositories.." case "$distro" in - ubuntu | debian) silentexec $_sudo apt-get update ;; - fedora) silentexec $_sudo dnf update ;; + ubuntu | debian) run $_sudo apt-get update ;; + fedora) run $_sudo dnf update ;; arch) if command_exists paru; then - silentexec paru -Sy + run paru -Sy elif command_exists yay; then - silentexec yay -Sy + run yay -Sy else - silentexec $_sudo pacman -Sy + run $_sudo pacman -Sy fi ;; - opensuse) silentexec $_sudo zypper ref ;; - alpine) silentexec $_sudo apk update ;; + opensuse) run $_sudo zypper ref ;; + alpine) run $_sudo apk update ;; *) echo_error "Unsupported distribution: $distro" ;; esac }