Browse Source

Exit if scripts are run as root

tags/1.5
Nico Rey 3 years ago
parent
commit
9db5c75b9c
9 changed files with 56 additions and 8 deletions
  1. +5
    -5
      install.sh
  2. +6
    -0
      migrate_data.sh
  3. +5
    -0
      receive.sh
  4. +6
    -1
      receive_meteor.sh
  5. +11
    -0
      schedule.sh
  6. +5
    -2
      schedule_iss.sh
  7. +6
    -0
      schedule_meteor.sh
  8. +6
    -0
      schedule_sat.sh
  9. +6
    -0
      test_reception.sh

+ 5
- 5
install.sh View File

@@ -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



+ 6
- 0
migrate_data.sh View File

@@ -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"


+ 5
- 0
receive.sh View File

@@ -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"


+ 6
- 1
receive_meteor.sh View File

@@ -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"


+ 11
- 0
schedule.sh View File

@@ -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


+ 5
- 2
schedule_iss.sh View File

@@ -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"


+ 6
- 0
schedule_meteor.sh View File

@@ -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"


+ 6
- 0
schedule_sat.sh View File

@@ -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"


+ 6
- 0
test_reception.sh View File

@@ -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"


Loading…
Cancel
Save