From 57788663a8ce89de1cd42c9691474422b855ebf8 Mon Sep 17 00:00:00 2001 From: Robert Habermann Date: Sat, 11 Jan 2020 00:06:08 +0000 Subject: [PATCH] add check and install for python2 --- home.admin/config.scripts/bonus.nodejs.sh | 7 +++---- home.admin/config.scripts/bonus.rtl.sh | 14 +++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/home.admin/config.scripts/bonus.nodejs.sh b/home.admin/config.scripts/bonus.nodejs.sh index 8af18583b..538d2e960 100644 --- a/home.admin/config.scripts/bonus.nodejs.sh +++ b/home.admin/config.scripts/bonus.nodejs.sh @@ -16,8 +16,9 @@ fi # check if nodeJS was installed nodeJSInstalled=$(node -v 2>/dev/null | grep -c "v1.") -if [ ${nodeJSInstalled} -eq 0 ]; then - +if ! [ ${nodeJSInstalled} -eq 0 ]; then + echo "nodeJS is already installed" +else # determine nodeJS VERSION and DISTRO echo "Detect CPU architecture ..." isARM=$(uname -m | grep -c 'arm') @@ -89,8 +90,6 @@ if [ ${nodeJSInstalled} -eq 0 ]; then echo "ABORT - nodeJs install" exit 1 fi -else - echo "nodeJS is already installed" fi # setting value in raspi blitz config diff --git a/home.admin/config.scripts/bonus.rtl.sh b/home.admin/config.scripts/bonus.rtl.sh index 8585303cd..d19115d19 100755 --- a/home.admin/config.scripts/bonus.rtl.sh +++ b/home.admin/config.scripts/bonus.rtl.sh @@ -30,11 +30,21 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then echo "*** INSTALL RTL ***" isInstalled=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service') - if [ ${isInstalled} -eq 0 ]; then + if ! [ ${isInstalled} -eq 0 ]; then + echo "RTL already installed." + else # check and install NodeJS /home/admin/config.scripts/bonus.nodejs.sh + # check for Python2 (install if missing) + # TODO remove Python2 ASAP! + /usr/bin/which python2 &>/dev/null + if [ $? -eq 0 ]; then + sudo apt-get update + sudo apt-get install -y python2 + fi + # download source code and set to tag release echo "*** Get the RTL Source Code ***" rm -r /home/admin/RTL 2>/dev/null @@ -91,8 +101,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then sudo systemctl enable RTL echo "OK - the RTL service is now enabled" - else - echo "RTL already installed." fi # setting value in raspi blitz config