Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

37 lines
965B

  1. #!/bin/bash
  2. echo ""
  3. echo "Adding DNS entries to PI-HOLE"
  4. CONF_FILE=custom_dnsmasq.conf
  5. IP_LOOKUP="$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')" # May not work for VPN / tun0
  6. # read variables, for domain and host names
  7. source .env
  8. # global domain with all subdomains
  9. echo address=/.${DOMAIN}/${IP_LOOKUP} > /tmp/${CONF_FILE}
  10. # virtual domains
  11. for domain in ${VIRTUAL_DOMAINS[@]}; do
  12. echo address=/.${domain}/${IP_LOOKUP} >> /tmp/${CONF_FILE}
  13. done;
  14. # ##### Add entries to PiHole ###### #
  15. container=$(docker ps | grep pihole | cut -f1 -d" ")
  16. #echo Container=$container
  17. if [ -z $container ]; then
  18. echo "Qué me estás container?!";
  19. exit 1;
  20. fi
  21. echo Copying user files to Container $container
  22. docker cp /tmp/${CONF_FILE} $container:/etc/dnsmasq.d/99-local-addresses.conf
  23. # restart dns
  24. docker exec ${container} pihole reloaddns
  25. echo Removing copied user files
  26. docker exec ${container} sh -c 'rm -Rf /tmp/${CONF_FILE}'
  27. rm -Rf /tmp/${CONF_FILE}