diff --git a/advanced/01-pihole.conf b/advanced/01-pihole.conf index f4707ef4..0ddf1caa 100644 --- a/advanced/01-pihole.conf +++ b/advanced/01-pihole.conf @@ -20,13 +20,8 @@ # OR IN /etc/dnsmasq.conf # ############################################################################### -address=/pi.hole/@IPv4@ -address=/pi.hole/@IPv6@ - -address=/@HOSTNAME@/@IPv4@ -address=/@HOSTNAME@/@IPv6@ - addn-hosts=/etc/pihole/gravity.list +addn-hosts=/etc/pihole/local.list domain-needed diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index afa44701..9464d03b 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -612,36 +612,6 @@ version_check_dnsmasq() { sed -i '/^server=@DNS2@/d' ${dnsmasq_pihole_01_location} fi - #sed -i "s/@HOSTNAME@/$hostname/" ${dnsmasq_pihole_01_location} - - if [[ -f /etc/hostname ]]; then - hostname=$(> ${piholeDir}/${accretionDisc} + if [[ -f /etc/hostname ]]; then + hostname=$( ${localList} + # Both IPv4 and IPv6 + cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPV4_ADDRESS" -v ipv6addr="$IPV6_ADDRESS" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} - # Only IPv4 - cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPV4_ADDRESS" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc} + elif [[ -n "${IPV4_ADDRESS}" && -z "${IPV6_ADDRESS}" ]];then - elif [[ -z "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]];then + echo -e "${IPV4_ADDRESS} ${hostname}\n${IPV4_ADDRESS} pi.hole" > ${localList} + # Only IPv4 + cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPV4_ADDRESS" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc} - # Only IPv6 - cat ${piholeDir}/${eventHorizon} | awk -v ipv6addr="$IPV6_ADDRESS" '{sub(/\r$/,""); print ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} + elif [[ -z "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]];then - elif [[ -z "${IPV4_ADDRESS}" && -z "${IPV6_ADDRESS}" ]];then - echo "::: No IP Values found! Please run 'pihole -r' and choose reconfigure to restore values" - exit 1 - fi + echo -e "${IPV6_ADDRESS} ${hostname}\n${IPV6_ADDRESS} pi.hole" > ${localList} + # Only IPv6 + cat ${piholeDir}/${eventHorizon} | awk -v ipv6addr="$IPV6_ADDRESS" '{sub(/\r$/,""); print ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} + + elif [[ -z "${IPV4_ADDRESS}" && -z "${IPV6_ADDRESS}" ]];then + echo "::: No IP Values found! Please run 'pihole -r' and choose reconfigure to restore values" + exit 1 + fi # Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it cp ${piholeDir}/${accretionDisc} ${adList} diff --git a/pihole b/pihole index 6d5f8c9d..5509df47 100755 --- a/pihole +++ b/pihole @@ -135,7 +135,7 @@ restartDNS() { piholeEnable() { if [[ "${1}" == "0" ]] ; then #Disable Pihole - sed -i 's/^addn-hosts/#addn-hosts/' /etc/dnsmasq.d/01-pihole.conf + sed -i 's/^addn-hosts=\/etc\/pihole\/gravity.list/#addn-hosts=\/etc\/pihole\/gravity.list/' /etc/dnsmasq.d/01-pihole.conf echo "::: Blocking has been disabled!" if [[ $# > 1 ]] ; then if [[ ${2} == *"s"* ]] ; then