addet more checks

This commit is contained in:
pika 2025-05-09 13:42:21 +02:00
parent 0a7250a420
commit 0055f21f0a

View file

@ -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
}