summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorgraysky2017-07-04 19:21:22 -0400
committergraysky2017-07-04 19:21:22 -0400
commitbfb18dd7ce4e91259cbc5ffafecbf4e3c9cfc78c (patch)
treeafa805979b19ad5d23a7a2f6eaea852c7184b35b
parent67ede212cb191bbc72c0d03041f5cc235b20b6b3 (diff)
downloadaur-bfb18dd7ce4e91259cbc5ffafecbf4e3c9cfc78c.tar.gz
preserve user edits to dnsmasq.d files on update
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD14
-rw-r--r--pi-hole-server.install32
3 files changed, 31 insertions, 21 deletions
diff --git a/.SRCINFO b/.SRCINFO
index ce8027080efa..f405939c3d60 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,9 +1,9 @@
# Generated by mksrcinfo v8
-# Tue Jul 4 20:56:54 UTC 2017
+# Tue Jul 4 23:21:19 UTC 2017
pkgbase = pi-hole-server
pkgdesc = The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server.
pkgver = 3.1
- pkgrel = 9
+ pkgrel = 10
url = https://github.com/pi-hole/pi-hole
install = pi-hole-server.install
arch = any
@@ -21,6 +21,8 @@ pkgbase = pi-hole-server
conflicts = pi-hole-standalone
backup = etc/pihole/whitelist.txt
backup = etc/pihole/blacklist.txt
+ backup = etc/dnsmasq.d/01-pihole.conf
+ backup = etc/dnsmasq.d/02-pihole.conf
source = pihole-3.1.tar.gz::https://github.com/pi-hole/pi-hole/archive/v3.1.tar.gz
source = admin-3.1.tar.gz::https://github.com/pi-hole/AdminLTE/archive/v3.1.tar.gz
source = configuration
diff --git a/PKGBUILD b/PKGBUILD
index 305ed3db1413..696820bdf65a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@
pkgname=pi-hole-server
_pkgname=pi-hole
pkgver=3.1
-pkgrel=9
+pkgrel=10
_wwwpkgname=AdminLTE
_wwwpkgver=3.1
pkgdesc='The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server.'
@@ -20,7 +20,8 @@ optdepends=(
)
conflicts=('pi-hole-standalone')
install=$pkgname.install
-backup=('etc/pihole/whitelist.txt' 'etc/pihole/blacklist.txt')
+backup=('etc/pihole/whitelist.txt' 'etc/pihole/blacklist.txt'
+'etc/dnsmasq.d/01-pihole.conf' 'etc/dnsmasq.d/02-pihole.conf')
source=(pihole-$pkgver.tar.gz::https://github.com/$_pkgname/$_pkgname/archive/v$pkgver.tar.gz
admin-$_wwwpkgver.tar.gz::https://github.com/$_pkgname/$_wwwpkgname/archive/v$_wwwpkgver.tar.gz
@@ -297,11 +298,16 @@ package() {
install -Dm644 /dev/null "$pkgdir"/etc/pihole/whitelist.txt
install -Dm644 /dev/null "$pkgdir"/etc/pihole/blacklist.txt
- install -Dm644 configuration "$pkgdir"/usr/share//pihole/doc/configuration
+ install -Dm644 configuration "$pkgdir"/usr/share/pihole/doc/configuration
- install -Dm644 dnsmasq.main "$pkgdir"/usr/share/pihole/configs/dnsmasq.main
+ install -Dm644 dnsmasq.main "$pkgdir"/usr/share/pihole/configs/dnsmasq.example.conf
+
+ # note the redundancy is due to sed magic post-install
+ install -Dm644 dnsmasq.include "$pkgdir"/usr/share/pihole/configs/01-pihole.example.conf
install -Dm644 dnsmasq.include "$pkgdir"/etc/dnsmasq.d/01-pihole.conf
+ install -Dm644 dnsmasq.local "$pkgdir"/usr/share/pihole/configs/02-pihole.example.conf
install -Dm644 dnsmasq.local "$pkgdir"/etc/dnsmasq.d/02-pihole.conf
+
install -Dm644 lighttpd.conf "$pkgdir"/usr/share/pihole/configs/lighttpd.example.conf
install -Dm644 nginx.pi-hole.conf "$pkgdir"/usr/share/pihole/configs/nginx.example.conf
diff --git a/pi-hole-server.install b/pi-hole-server.install
index 31b1e3c952b2..5e081008befe 100644
--- a/pi-hole-server.install
+++ b/pi-hole-server.install
@@ -1,18 +1,21 @@
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 or ArchWiki page at \e[1;36mhttps://wiki.archlinux.org/index.php/Pi-hole\e[0m"
- echo -e "\e[1;33m==>\e[0m \e[1;31mVer. 3.1-6\e[0m: dnsmasq conf file is changed"
- echo -e "\e[1;33m==>\e[0m Please follow configuration upgrade steps"
- echo -e "\e[1;33m==>\e[0m Neutrino emissions detected..."
- touch /etc/dnsmasq.d/02-pihole-dhcp.conf
- touch /etc/dnsmasq.d/03-pihole-wildcard.conf
- chown -R http.http /srv/http/pihole
+ echo -e "\e[1;33m==>\e[0m Read setup instructions at \e[1;36mhttps://wiki.archlinux.org/index.php/Pi-hole\e[0m"
+ echo -e "\e[1;33m==>\e[0m Generating initial block list, please wait...\e[0m"
+ chown -R http:http /srv/http/pihole
/opt/pihole/mimic_setupVars.conf.sh
_dnsmasq_address_setup
- /usr/bin/pihole updateGravity > /dev/null
- /usr/bin/pihole -a setdns 8.8.8.8,8.8.4.4 > /dev/null
+ # best solution to managing script-created files I can think of
+ # is to install them to /usr/share/pihole/configs/ using sed magic
+ # and copy them into /etc/dnsmasq.d/ on the first install only
+ # from then on users can edit these and not have them overwritten
+ # by an update
+ install -Dm644 /usr/share/pihole/configs/01-pihole.example.conf /etc/dnsmasq.d/01-pihole.conf
+ install -Dm644 /usr/share/pihole/configs/02-pihole.example.conf /etc/dnsmasq.d/02-pihole.conf
+
+ # update lists on first run
+ pihole -g > /dev/null
}
post_upgrade() {
@@ -20,13 +23,12 @@ post_upgrade() {
[ -e /etc/pihole/hosts ] && rm /etc/pihole/hosts
[ -e /etc/pihole/.useIPv6 ] && rm /etc/pihole/.useIPv6
- post_install $1
+ # if neither file is present, bash throws an non-0 exit
+ return 0
}
post_remove() {
- [ -e /run/log/pihole.log ] && rm /run/log/pihole.log
- [ -e /etc/dnsmasq.d/02-pihole-dhcp.conf ] && rm /etc/dnsmasq.d/02-pihole-dhcp.conf
- [ -e /etc/dnsmasq.d/03-pihole-wildcard.conf ] && rm /etc/dnsmasq.d/03-pihole-wildcard.conf
+ [ -e /run/log/pihole/pihole.log ] && rm /run/log/pihole/pihole.log
# delete all temp files except those modified the user
# TODO - make this more intelligent to save *.pacsave.# where # is a number
@@ -35,7 +37,7 @@ post_remove() {
_dnsmasq_address_setup() { # official code here
. /etc/pihole/setupVars.conf
- dnsmasq_pihole_conf=/etc/dnsmasq.d/02-pihole.conf
+ dnsmasq_pihole_conf=/usr/share/pihole/configs/02-pihole.example.conf
if [[ -f /etc/hostname ]]; then
hostname=$(</etc/hostname)