sync-openweb.template 440 B

123456789101112131415
  1. #!/bin/bash -e
  2. if [ "$UID" -ne 0 ]; then
  3. echo "Insufficient privileges! Please run this script as root." >&2
  4. exit 1
  5. fi
  6. echo "Syncing OpenWeb from INSERT_URL_HERE..."
  7. wget "INSERT_URL_HERE" -O /tmp/synced.ow
  8. if [ "$?" -ne 0 ]; then
  9. echo "Failure syncing OpenWeb file! Please re-install OpenWeb with a new URL." >&2
  10. exit 1
  11. fi
  12. cat /etc/hosts.orig /tmp/synced.ow > /etc/hosts
  13. rm /tmp/synced.ow
  14. echo "Successfully synced!"
  15. exit 0