diff --git a/distros.sh b/distros.sh index bd809d7..eb19b7d 100755 --- a/distros.sh +++ b/distros.sh @@ -105,13 +105,6 @@ get_packager() { $_sudo pacman -S --noconfirm "$@" fi } - if command_exists paru; then - silentexec paru -Sy - elif command_exists yay; then - silentexec yay -Sy - else - silentexec $_sudo pacman -Sy - fi ;; opensuse*) opensuse="true" @@ -157,20 +150,27 @@ get_packager() { fi } +update_package_list() { + case "$distro" in + ubuntu | debian) $_sudo apt-get update ;; + fedora) $_sudo dnf update ;; + arch) + if command_exists paru; then + silentexec paru -Sy + elif command_exists yay; then + silentexec yay -Sy + else + silentexec $_sudo pacman -Sy + fi + ;; + opensuse) $_sudo zypper ref ;; + alpine) $_sudo apk update ;; + *) echo_error "Unsupported distribution: $distro" ;; + esac +} + if check_root; then get_packager && - if $arch; then - echo "Arch it is.." - elif $debian; then - echo "Debian it is.." - elif $ubuntu; then - echo "Ubuntu it is.." - elif $fedora; then - echo "Fedora it is.." - elif $opensuse; then - echo "OpenSuse it is.." - elif $alpine; then - echo "Alpine it is.." - fi + update_package_list fi