summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authormax.bra2016-11-01 20:26:49 +0100
committermax.bra2016-11-01 20:26:49 +0100
commit1fe01c06fa177daee2cf2e39358402ea191ddd8c (patch)
tree82de412aa56d4a6ac92dcfab6f802c09eced8fed
parent190b433c95467c491120e2f0cb3e17fdc91cba4c (diff)
downloadaur-1fe01c06fa177daee2cf2e39358402ea191ddd8c.tar.gz
dnsmasq address support
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rw-r--r--dnsmasq.include7
-rw-r--r--pi-hole-server.install36
4 files changed, 47 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a3aab4241e4e..170c29b5b344 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = pi-hole-server
pkgdesc = The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server.
pkgver = 2.9.5
- pkgrel = 3
+ pkgrel = 4
url = https://github.com/pi-hole/pi-hole
install = pi-hole-server.install
arch = any
@@ -32,7 +32,7 @@ pkgbase = pi-hole-server
md5sums = b383a2741e556a3680b3ae312a18cfba
md5sums = fe8c5814aa6570085825bc055f8e85b9
md5sums = 6e6ab264586c16350ad2a5a800ab03e7
- md5sums = cba1675593bb43c94a35aabe8a210efa
+ md5sums = 8b2d15c5e7d152e9207bd82db3ca144d
md5sums = e3b364719011b00d44a9c6bd4c387bcb
md5sums = 82ce6717056c7a680fd2dd09bf6f6ff4
md5sums = 990b8abd0bfbba23a7ce82c59f2e3d64
diff --git a/PKGBUILD b/PKGBUILD
index f3b97c31dd20..3eeefd04cdad 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=pi-hole-server
_pkgname=pi-hole
pkgver=2.9.5
-pkgrel=3
+pkgrel=4
_wwwpkgname=AdminLTE
_wwwpkgver=1.4.4.2
pkgdesc='The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server.'
@@ -33,7 +33,7 @@ source=(https://github.com/$_pkgname/$_pkgname/archive/v$pkgver.tar.gz
md5sums=('b383a2741e556a3680b3ae312a18cfba'
'fe8c5814aa6570085825bc055f8e85b9'
'6e6ab264586c16350ad2a5a800ab03e7'
- 'cba1675593bb43c94a35aabe8a210efa'
+ '8b2d15c5e7d152e9207bd82db3ca144d'
'e3b364719011b00d44a9c6bd4c387bcb'
'82ce6717056c7a680fd2dd09bf6f6ff4'
'990b8abd0bfbba23a7ce82c59f2e3d64'
diff --git a/dnsmasq.include b/dnsmasq.include
index 8f26600b8141..79f2db62ff6f 100644
--- a/dnsmasq.include
+++ b/dnsmasq.include
@@ -1,4 +1,11 @@
+address=/pi.hole/@IPv4@
+address=/pi.hole/@IPv6@
+
+address=/@HOSTNAME@/@IPv4@
+address=/@HOSTNAME@/@IPv6@
+
addn-hosts=/etc/pihole/gravity.list
+
cache-size=10000
log-queries
log-facility=/run/log/pihole/pihole.log
diff --git a/pi-hole-server.install b/pi-hole-server.install
index a1c7ee81eb7b..0926046441db 100644
--- a/pi-hole-server.install
+++ b/pi-hole-server.install
@@ -1,6 +1,7 @@
post_install() {
echo -e "\e[1;33m==>\e[0m Please read configuration instructions at /usr/share/doc/pihole/configuration"
echo -e "\e[1;33m==>\e[0m \e[1;31mVer. 2.9.5-1\e[0m: dnsmasq and lighttpd conf files are changed"
+ echo -e "\e[1;33m==>\e[0m \e[1;31mVer. 2.9.5-4\e[0m: dnsmasq.include conf file is changed again"
echo -e "\e[1;33m==>\e[0m \e[1;31mAttention\e[0m: dnsmasq config files used are now two and both mandatory."
echo -e "\e[1;33m==>\e[0m Pay attention to the name of the destination dnsmasq include config file"
echo -e "\e[1;33m==>\e[0m Please follow configuration upgrade steps"
@@ -9,6 +10,9 @@ post_install() {
chown -R http.http /srv/http/pihole
systemd-tmpfiles --create pi-hole.conf
/opt/pihole/mimic_setupVars.conf.sh
+
+ _dnsmasq_address_setup
+
/usr/bin/pihole updateGravity > /dev/null
systemctl daemon-reload > /dev/null
systemctl is-active pi-hole-logtruncate.timer 2>&1 >/dev/null || systemctl start pi-hole-logtruncate.timer
@@ -26,3 +30,35 @@ post_remove() {
rm /run/log/pihole.log
}
+_dnsmasq_address_setup() { # official code here
+ . /etc/pihole/setupVars.conf
+ dnsmasq_pihole_01_location=/etc/pihole/configs/dnsmasq.include
+
+ if [[ -f /etc/hostname ]]; then
+ hostname=$(</etc/hostname)
+ elif [ -x "$(command -v hostname)" ]; then
+ hostname=$(hostname -f)
+ fi
+
+ #Replace IPv4 and IPv6 tokens in 01-pihole.conf for pi.hole resolution.
+ if [[ "${IPv4_address}" != "" ]]; then
+ tmp=${IPv4_address%/*}
+ sed -i "s/@IPv4@/$tmp/" ${dnsmasq_pihole_01_location}
+ else
+ sed -i '/^address=\/pi.hole\/@IPv4@/d' ${dnsmasq_pihole_01_location}
+ sed -i '/^address=\/@HOSTNAME@\/@IPv4@/d' ${dnsmasq_pihole_01_location}
+ fi
+
+ if [[ "${IPv6_address}" != "" ]]; then
+ sed -i "s/@IPv6@/$IPv6_address/" ${dnsmasq_pihole_01_location}
+ else
+ sed -i '/^address=\/pi.hole\/@IPv6@/d' ${dnsmasq_pihole_01_location}
+ sed -i '/^address=\/@HOSTNAME@\/@IPv6@/d' ${dnsmasq_pihole_01_location}
+ fi
+
+ if [[ "${hostname}" != "" ]]; then
+ sed -i "s/@HOSTNAME@/$hostname/" ${dnsmasq_pihole_01_location}
+ else
+ sed -i '/^address=\/@HOSTNAME@*/d' ${dnsmasq_pihole_01_location}
+ fi
+}