diff options
author | graysky | 2017-07-05 05:40:49 -0400 |
---|---|---|
committer | graysky | 2017-07-05 05:40:49 -0400 |
commit | 74edf2729bfff6f7df96650b4ab159bcee5d378a (patch) | |
tree | 8316e3e84dcdf3f3e055e89063e43da4b475d0a6 | |
parent | bfb18dd7ce4e91259cbc5ffafecbf4e3c9cfc78c (diff) | |
download | aur-74edf2729bfff6f7df96650b4ab159bcee5d378a.tar.gz |
simplify dnsmasq.d files from last commit but still not optimal
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 11 | ||||
-rw-r--r-- | nginx.pi-hole.conf | 2 | ||||
-rw-r--r-- | pi-hole-server.install | 41 |
4 files changed, 34 insertions, 26 deletions
@@ -1,9 +1,9 @@ # Generated by mksrcinfo v8 -# Tue Jul 4 23:21:19 UTC 2017 +# Wed Jul 5 09:40:49 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 = 10 + pkgrel = 11 url = https://github.com/pi-hole/pi-hole install = pi-hole-server.install arch = any @@ -45,7 +45,7 @@ pkgbase = pi-hole-server md5sums = 7ac346581ada71187b7fd18f164bbee9 md5sums = 2d10140f19f54015e6ab2807267e8aaf md5sums = a8a64dc2ff89bb87d534c83189447abc - md5sums = ebe0b0785fcc7b10accff3c1ae793cd2 + md5sums = 9618204d16333873136e65f886db2ab3 md5sums = 990b8abd0bfbba23a7ce82c59f2e3d64 md5sums = 047f13d4ac97877f724f87b002aaee63 md5sums = d42a864f88299998f8233c0bc0dd093d @@ -4,7 +4,7 @@ pkgname=pi-hole-server _pkgname=pi-hole pkgver=3.1 -pkgrel=10 +pkgrel=11 _wwwpkgname=AdminLTE _wwwpkgver=3.1 pkgdesc='The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server.' @@ -46,7 +46,7 @@ md5sums=('e24ce6a12ee97cd7de2c5ab13af99511' '7ac346581ada71187b7fd18f164bbee9' '2d10140f19f54015e6ab2807267e8aaf' 'a8a64dc2ff89bb87d534c83189447abc' - 'ebe0b0785fcc7b10accff3c1ae793cd2' + '9618204d16333873136e65f886db2ab3' '990b8abd0bfbba23a7ce82c59f2e3d64' '047f13d4ac97877f724f87b002aaee63' 'd42a864f88299998f8233c0bc0dd093d' @@ -299,15 +299,9 @@ package() { install -Dm644 /dev/null "$pkgdir"/etc/pihole/blacklist.txt install -Dm644 configuration "$pkgdir"/usr/share/pihole/doc/configuration - 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 @@ -329,4 +323,3 @@ package() { rm "$pkgdir"/srv/http/pihole/admin/scripts/vendor/LICENSE rm "$pkgdir"/srv/http/pihole/admin/style/vendor/SourceSansPro/OFL.txt } - diff --git a/nginx.pi-hole.conf b/nginx.pi-hole.conf index 51d02f316830..895bc839cce4 100644 --- a/nginx.pi-hole.conf +++ b/nginx.pi-hole.conf @@ -1,4 +1,4 @@ -# place in /etc/nginx/conf.d/pi_hole.conf +# place in /etc/nginx/conf.d/pihole.conf server { listen 80 default_server; diff --git a/pi-hole-server.install b/pi-hole-server.install index 5e081008befe..e778c69f434a 100644 --- a/pi-hole-server.install +++ b/pi-hole-server.install @@ -4,18 +4,16 @@ post_install() { chown -R http:http /srv/http/pihole /opt/pihole/mimic_setupVars.conf.sh + # sed magic to setup /etc/dnsmasq.d/02-pihole.conf and thus protect it from + # getting overwritten by package updates _dnsmasq_address_setup - - # 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 + + # setup dns server which by definition modifies /etc/dnsmasq.d/01-pihole.conf + # and thus protects it from getting overwritten by package updates + /usr/bin/pihole -a setdns 8.8.8.8,8.8.4.4 > /dev/null } post_upgrade() { @@ -23,13 +21,30 @@ post_upgrade() { [ -e /etc/pihole/hosts ] && rm /etc/pihole/hosts [ -e /etc/pihole/.useIPv6 ] && rm /etc/pihole/.useIPv6 - # if neither file is present, bash throws an non-0 exit + # if we run _dnsmasq_address_setup now and if the user has modified + # /etc/dnsmasq.d/02-pihole.conf it will be overwritten + # + # pacman will install the sed magic version of this file as + # /etc/dnsmasq.d/02-pihole.pacnew which we do not want on the file system + # so short of changing $dnsmasq_pihole_conf in the _dnsmasq_address_setup + # function, let's just delete it in post_upgrade + # + # users will see pacman output indicating there is a pacnew but I don't + # know an elegant way to provide a script processed config file without + # installing it to a temp file and pointing the sed magic on that temp file + # yet having pacman keep it in the BACKUP array for management to keep it + # from getting overwritten on updates + [ -e /etc/dnsmasq.d/02-pihole.conf.pacnew ] && rm /etc/dnsmasq.d/02-pihole.conf.pacnew + + # maybe the KISS solution is simply not to provide + # /etc/dnsmasq.d/02-pihole.conf at all and let the user make it from the wiki + + # finally, this shouldn't be the case but keep pacman from throwing errors should + # none of the three checks be true return 0 } post_remove() { - [ -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 find /etc/pihole -type f ! -name '*.pacsave' ! -name 'pihole-FTL.conf' ! -name 'pihole-FTL.db' -delete @@ -37,7 +52,7 @@ post_remove() { _dnsmasq_address_setup() { # official code here . /etc/pihole/setupVars.conf - dnsmasq_pihole_conf=/usr/share/pihole/configs/02-pihole.example.conf + dnsmasq_pihole_conf=/etc/dnsmasq.d/02-pihole.conf if [[ -f /etc/hostname ]]; then hostname=$(</etc/hostname) |