1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-23 07:18:07 +00:00

replace HOSTNAME tokens in 01-pihole.conf

This commit is contained in:
Adam Warner 2016-10-25 15:06:37 +01:00
parent 18005ceee8
commit 86349527e7

View File

@ -536,6 +536,18 @@ version_check_dnsmasq() {
else else
sed -i '/^server=@DNS2@/d' ${dnsmasq_pihole_01_location} sed -i '/^server=@DNS2@/d' ${dnsmasq_pihole_01_location}
fi fi
if [[ -f /etc/hostname ]]; then
hostname=$(</etc/hostname)
sed -i "s/@HOSTNAME@/$hostname/" ${dnsmasq_pihole_01_location}
elif [ -x "$(command -v hostname)" ]; then
hostname=$(hostname -f)
sed -i "s/@HOSTNAME@/$hostname/" ${dnsmasq_pihole_01_location}
else
sed -i '/^address=/@HOSTNAME@/@IPv4@/d' ${dnsmasq_pihole_01_location}
sed -i '/^address=/@HOSTNAME@/@IPv6@/d' ${dnsmasq_pihole_01_location}
fi
#Replace IPv4 and IPv6 tokens in 01-pihole.conf for pi.hole resolution. #Replace IPv4 and IPv6 tokens in 01-pihole.conf for pi.hole resolution.
tmp = ${IPv4_address%/*} tmp = ${IPv4_address%/*}
sed -i "s/@IPv4@/$tmp/" ${dnsmasq_pihole_01_location} sed -i "s/@IPv4@/$tmp/" ${dnsmasq_pihole_01_location}