fixed package managers

This commit is contained in:
Maksymilian Potok 2021-01-25 17:50:34 +01:00
parent ea730a575a
commit 1dc0d180e4
1 changed files with 15 additions and 2 deletions

View File

@ -14,11 +14,24 @@ function package_installed() {
if [ "$pkginstalled" -eq 0 ];then if [ "$pkginstalled" -eq 0 ];then
show_message "package\033[1;36m $1\e[0m is installed..." show_message "package\033[1;36m $1\e[0m is installed..."
else else
warning "package\033[1;33m $1\e[0m is not installed.\nplease make sure it's already installed" warning "package\033[1;33m $1\e[0m is not installed."
ask_question "would you continue?" "N" ask_question "would you like to install it now?" "N"
if [ "$question_result" == "no" ];then if [ "$question_result" == "no" ];then
echo "exit..." echo "exit..."
exit 5 exit 5
else
declare -A osInfo;
osInfo[/etc/redhat-release]=yum upgrade && yum install
osInfo[/etc/arch-release]=pacman -Syu && pacman -S
osInfo[/etc/SuSE-release]=zypper update && zypper install
osInfo[/etc/debian_version]=apt-get update && apt-get install
for f in ${!osInfo[@]}
do
if [[ -f $f ]];then
sudo ${osInfo[$f]} $1
fi
done
fi fi
fi fi
fi fi