install.sh 555 B

1234567891011121314151617
  1. #!/bin/bash -e
  2. if [ "$UID" -ne 0 ]; then
  3. echo "Insufficient privileges!. Installing OpenWeb requires root." >&2
  4. exit 1
  5. fi
  6. read -r -p "Enter URL to OpenWeb file \(e.g. https://www.example.com/some-sites.ow\): " owpath
  7. echo "Setting up OpenWeb..."
  8. mv /etc/hosts /etc/hosts.orig
  9. echo "installing update script..."
  10. cp sync-openweb.template /usr/local/bin/sync-openweb
  11. sed -i "s/INSERT_URL_HERE/${owpath}/g" /usr/local/bin/sync-openweb
  12. chmod +x /usr/local/bin/sync-openweb
  13. echo "Syncing OpenWeb..."
  14. sync-openweb
  15. echo "OpenWeb successfully installed!"
  16. exit 0