e-pullhosts 320 B

1234567891011
  1. #!/bin/bash
  2. ((EUID == 0 )) || { echo "Need root"; exit 1; }
  3. set -euo pipefail
  4. tmp=$(mktemp)
  5. trap "/bin/rm -f ${tmp}" EXIT SIGHUP SIGINT SIGTERM
  6. curl -sSfo ${tmp} http://someonewhocares.org/hosts/zero/hosts
  7. sed -i '0,/#<\/localhost>/d' ${tmp}
  8. grep -E '^[0#]+' ${tmp} > /etc/hosts.ban
  9. systemctl reload dnsmasq.service