From ec208ba22a6486a5aa3323c91c504c9179460fbf Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Thu, 6 Aug 2020 12:01:11 +0200 Subject: [PATCH] more rubust check in prerequisites --- bin/initDesktop | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/initDesktop b/bin/initDesktop index 3549edb..436d924 100755 --- a/bin/initDesktop +++ b/bin/initDesktop @@ -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