added check_prerequisites

This commit is contained in:
Jonas Forsberg 2020-08-06 11:51:15 +02:00
parent 5b3b3eaf89
commit 351a23ce0d
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9

View File

@ -155,6 +155,27 @@ function suse_install_codecs(){
sudo "$HOME/bin/install_codecs"
}
function check_prerequisites(){
local answer
if !type git > /dev/null 2>&1;then
printf "git is not installed, do your want to install it [y/N]?"
read -r -n 1 -s answer;
printf "\n"
if [[ $answer == [yY] ]];then
sudo zypper install --non-interactive git
fi
fi
if type !salt-call > /dev/null 2>&1;then
printf "salt-minion is not installed, do your want to install it [y/N]?"
read -r -n 1 -s answer;
printf "\n"
if [[ $answer == [yY] ]];then
sudo zypper install --non-interactive salt-minion
fi
fi
}
#initialize all options
ALL=true
CODECS=false
@ -211,6 +232,8 @@ while :; do
shift
done
check_prerequisites
[[ $ALL == true ]] || [[ $DOTFILES == true ]] && setup_dotfiles
[[ $ALL == true ]] || [[ $SALT == true ]] && do_salt_call
[[ $ALL == true ]] || [[ $FIREFOX == true ]] && firefox_config