This commit is contained in:
hjelev
2022-03-20 20:44:01 +02:00
parent fce5aa6a76
commit 8c3c1a550e

View File

@@ -7,6 +7,15 @@ printm(){
printf -- '-%.0s' $(seq $length); echo "" printf -- '-%.0s' $(seq $length); echo ""
} }
find_python(){
if $(python --version); then
python=$(which python)
else
python=$(which python3)
fi
echo "$python"
}
print_green(){ print_green(){
tput setaf 2; echo "$1" tput setaf 2; echo "$1"
tput sgr 0 tput sgr 0
@@ -19,8 +28,8 @@ print_yellow(){
check_and_install_pip(){ check_and_install_pip(){
cwd=$(pwd) cwd=$(pwd)
python=$(which python) #python=$(which python)
pip=$(python -m pip --version 2>&1); pip=$(${python} -m pip --version 2>&1);
if [[ "$pip" == *"No"* ]]; then if [[ "$pip" == *"No"* ]]; then
echo "- Pip is not installed, installing it." echo "- Pip is not installed, installing it."
sudo apt install python-pip sudo apt install python-pip
@@ -90,6 +99,7 @@ set_cron(){
main(){ main(){
printm "Raspberry Pi MQTT monitor installer" printm "Raspberry Pi MQTT monitor installer"
find_python
check_and_install_pip check_and_install_pip
install_requirements install_requirements
update_config update_config