diff options
| -rwxr-xr-x | bootstrap/run_salt.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bootstrap/run_salt.sh b/bootstrap/run_salt.sh index 59fd402..3977e9c 100755 --- a/bootstrap/run_salt.sh +++ b/bootstrap/run_salt.sh @@ -3,13 +3,27 @@ working_dir="${1}" build_basedir="${2}" local_build="${3}" -python=$(which python3 || false) salt_running_p() { ps -ef | grep -F "salt-call" | grep -v "grep" return ${?} } +python3_supported=$(python <<EOF +try: + from salt.scripts import salt_call + print("success") +except ImportError: + print("fail") +EOF +) + +if [ "${python3_supported}" == "success" ]; then + python=$(which python) +else + python=$(which python2) +fi + while salt_running_p; do sleep 5 done |
