You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
933 B

  1. #!/bin/bash
  2. set -e
  3. RED=$(tput setaf 1)
  4. GREEN=$(tput setaf 2)
  5. YELLOW=$(tput setaf 3)
  6. BLUE=$(tput setaf 4)
  7. BOLD=$(tput bold)
  8. RESET=$(tput sgr0)
  9. . "$HOME/.noaa.conf"
  10. die() {
  11. >&2 echo "${RED}error: $1${RESET}" && exit 1
  12. }
  13. log_running() {
  14. echo " ${YELLOW}*${RESET} $1"
  15. }
  16. log_done() {
  17. echo " ${GREEN}✓${RESET} $1"
  18. }
  19. log_error() {
  20. echo " ${RED}error: $1${RESET}"
  21. }
  22. success() {
  23. echo "${GREEN}$1${RESET}"
  24. }
  25. ### Run as a normal user
  26. if [ $EUID -eq 0 ]; then
  27. die "This script shouldn't be run as root."
  28. fi
  29. # check to ensure TZ_OFFSET is added to noaa.conf
  30. # which is needed since updating sun.py to be generic
  31. # and use bash environment vars
  32. log_running "Checking for TZ_OFFSET env var..."
  33. if [[ -v TZ_OFFSET ]]; then
  34. log_done "TZ_OFFSET in place - all set"
  35. else
  36. log_error "TZ_OFFSET is missing from /home/pi/.noaa.conf - please add."
  37. fi
  38. echo "All checks complete - please see above for details!"