Merge 4491703c9e
into 5f8f0adcdd
This commit is contained in:
commit
35adbc88ef
|
@ -14,12 +14,30 @@ 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?" "Y"
|
||||||
if [ "$question_result" == "no" ];then
|
if [ "$question_result" == "no" ];then
|
||||||
echo "exit..."
|
echo "exit..."
|
||||||
exit 5
|
exit 5
|
||||||
fi
|
else
|
||||||
|
declare -A osInfo;
|
||||||
|
osInfo[/etc/redhat-release]=yum
|
||||||
|
osInfo[/etc/SuSE-release]=zypper
|
||||||
|
osInfo[/etc/debian_version]=apt-get
|
||||||
|
|
||||||
|
for f in ${!osInfo[@]}
|
||||||
|
do
|
||||||
|
if [[ -f $f ]];then
|
||||||
|
sudo ${osInfo[$f]} update
|
||||||
|
sudo ${osInfo[$f]} install $1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# setup for arch-based systems
|
||||||
|
sudo pacman -Syu
|
||||||
|
sudo pacman -S coreutils
|
||||||
|
sudo pacman -S $1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue