diff --git a/advanced/01-pihole.conf b/advanced/01-pihole.conf index fd8e27f2..7ec37e3f 100644 --- a/advanced/01-pihole.conf +++ b/advanced/01-pihole.conf @@ -20,6 +20,12 @@ # 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 domain-needed diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 89191fed..5f050f06 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -540,6 +540,37 @@ version_check_dnsmasq() { else 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} cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPv4_address" -v ipv6addr="$IPv6_address" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} elif [[ -n "${IPv4_address}" && -z "${IPv6_address}" ]];then # Only IPv4 - echo -e "$IPv4_address $hostname\n$IPv4_address pi.hole" > ${piholeDir}/${accretionDisc} cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPv4_address" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc} elif [[ -z "${IPv4_address}" && -n "${IPv6_address}" ]];then # Only IPv6 - echo -e "$IPv6_address $hostname\n$IPv6_address pi.hole" > ${piholeDir}/${accretionDisc} cat ${piholeDir}/${eventHorizon} | awk -v ipv6addr="$IPv6_address" '{sub(/\r$/,""); print ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} elif [[ -z "${IPv4_address}" && -z "${IPv6_address}" ]];then