From 8c3c1a550e829fc2f1b014b11bfc362a00b466df Mon Sep 17 00:00:00 2001 From: hjelev Date: Sun, 20 Mar 2022 20:44:01 +0200 Subject: [PATCH] update --- install.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index ada7daf..3136b1b 100755 --- a/install.sh +++ b/install.sh @@ -7,6 +7,15 @@ printm(){ printf -- '-%.0s' $(seq $length); echo "" } +find_python(){ +if $(python --version); then + python=$(which python) +else + python=$(which python3) +fi +echo "$python" +} + print_green(){ tput setaf 2; echo "$1" tput sgr 0 @@ -19,8 +28,8 @@ print_yellow(){ check_and_install_pip(){ cwd=$(pwd) - python=$(which python) - pip=$(python -m pip --version 2>&1); + #python=$(which python) + pip=$(${python} -m pip --version 2>&1); if [[ "$pip" == *"No"* ]]; then echo "- Pip is not installed, installing it." sudo apt install python-pip @@ -90,6 +99,7 @@ set_cron(){ main(){ printm "Raspberry Pi MQTT monitor installer" + find_python check_and_install_pip install_requirements update_config