more rubust check in prerequisites

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

View File

@ -156,8 +156,11 @@ function suse_install_codecs(){
}
function check_prerequisites(){
set +e
local answer
if !type git > /dev/null 2>&1;then
type git > /dev/null 2>&1
RESULT=$?
if [[ $RESULT != 0 ]];then
printf "git is not installed, do your want to install it [y/N]?"
read -r -n 1 -s answer;
printf "\n"
@ -166,7 +169,9 @@ function check_prerequisites(){
fi
fi
if type !salt-call > /dev/null 2>&1;then
type salt-call > /dev/null 2>&1
RESULT=$?
if [[ $RESULT != 0 ]];then
printf "salt-minion is not installed, do your want to install it [y/N]?"
read -r -n 1 -s answer;
printf "\n"
@ -174,6 +179,7 @@ function check_prerequisites(){
sudo zypper install --non-interactive salt-minion
fi
fi
set -e
}
#initialize all options