diff --git a/install.sh b/install.sh index d827d24..62c17cd 100755 --- a/install.sh +++ b/install.sh @@ -28,6 +28,11 @@ success() { echo "${GREEN}$1${RESET}" } +### Run as a normal user +if [ $EUID -eq 0 ]; then + die "This script shouldn't be run as root." +fi + ### Verify cloned repo if [ ! -e "$HOME/raspberry-noaa" ]; then die "Is https://github.com/reynico/raspberry-noaa cloned in your home directory?" @@ -245,11 +250,6 @@ echo " set +e -### Fix permissions on audio/meteor/images folder -sudo chmod -R 775 /var/www/wx/audio/ -sudo chmod -R 775 /var/www/wx/images/ -sudo chmod -R 775 /var/www/wx/meteor/ - ### Running WXTOIMG to have the user accept the licensing agreement wxtoimg diff --git a/migrate_data.sh b/migrate_data.sh index d7f3b08..7d985df 100644 --- a/migrate_data.sh +++ b/migrate_data.sh @@ -1,5 +1,11 @@ #!/bin/bash +### Run as a normal user +if [ $EUID -eq 0 ]; then + echo "This script shouldn't be run as root." + exit 1 +fi + ## import common lib . "$HOME/.noaa.conf" . "$HOME/.tweepy.conf" diff --git a/receive.sh b/receive.sh index cb4e481..b6c4fd4 100755 --- a/receive.sh +++ b/receive.sh @@ -1,5 +1,10 @@ #!/bin/bash +### Run as a normal user +if [ $EUID -eq 0 ]; then + echo "This script shouldn't be run as root." + exit 1 +fi ## import common lib . "$HOME/.noaa.conf" diff --git a/receive_meteor.sh b/receive_meteor.sh index 70bfac3..38b4371 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -1,11 +1,16 @@ #!/bin/bash +### Run as a normal user +if [ $EUID -eq 0 ]; then + echo "This script shouldn't be run as root." + exit 1 +fi + ## import common lib . "$HOME/.noaa.conf" . "$HOME/.tweepy.conf" . "$NOAA_HOME/common.sh" - SYSTEM_MEMORY=$(free -m | awk '/^Mem:/{print $2}') if [ "$SYSTEM_MEMORY" -lt 2000 ]; then log "The system doesn't have enough space to store a Meteor pass on RAM" "INFO" diff --git a/schedule.sh b/schedule.sh index 6496142..ed957fe 100755 --- a/schedule.sh +++ b/schedule.sh @@ -1,9 +1,20 @@ #!/bin/bash +### Run as a normal user +if [ $EUID -eq 0 ]; then + echo "This script shouldn't be run as root." + exit 1 +fi + ## import common lib . "$HOME/.noaa.conf" . "$NOAA_HOME/common.sh" +### Run as a normal user +if [ $EUID -eq 0 ]; then + die "This script shouldn't be run as root." +fi + wget -qr http://www.celestrak.com/NORAD/elements/weather.txt -O "${NOAA_HOME}"/predict/weather.txt wget -qr http://www.celestrak.com/NORAD/elements/amateur.txt -O "${NOAA_HOME}"/predict/amateur.txt grep "NOAA 15" "${NOAA_HOME}"/predict/weather.txt -A 2 > "${NOAA_HOME}"/predict/weather.tle diff --git a/schedule_iss.sh b/schedule_iss.sh index 6660d0c..9e7bb16 100755 --- a/schedule_iss.sh +++ b/schedule_iss.sh @@ -1,7 +1,10 @@ #!/bin/bash -## debug -# set -x +### Run as a normal user +if [ $EUID -eq 0 ]; then + echo "This script shouldn't be run as root." + exit 1 +fi ## import common lib . "$HOME/.noaa.conf" diff --git a/schedule_meteor.sh b/schedule_meteor.sh index 20ca9d4..04f98c3 100755 --- a/schedule_meteor.sh +++ b/schedule_meteor.sh @@ -1,5 +1,11 @@ #!/bin/bash +### Run as a normal user +if [ $EUID -eq 0 ]; then + echo "This script shouldn't be run as root." + exit 1 +fi + ## import common lib . "$HOME/.noaa.conf" . "$NOAA_HOME/common.sh" diff --git a/schedule_sat.sh b/schedule_sat.sh index a5ef0b8..f7e2fc7 100755 --- a/schedule_sat.sh +++ b/schedule_sat.sh @@ -1,5 +1,11 @@ #!/bin/bash +### Run as a normal user +if [ $EUID -eq 0 ]; then + echo "This script shouldn't be run as root." + exit 1 +fi + ## import common lib . "$HOME/.noaa.conf" . "$NOAA_HOME/common.sh" diff --git a/test_reception.sh b/test_reception.sh index 3dba947..fbd59f2 100755 --- a/test_reception.sh +++ b/test_reception.sh @@ -1,5 +1,11 @@ #!/bin/bash +### Run as a normal user +if [ $EUID -eq 0 ]; then + echo "This script shouldn't be run as root." + exit 1 +fi + ## import common lib . "$HOME/.noaa.conf" . "$NOAA_HOME/common.sh"