diff options
Diffstat (limited to 'pi-hole-server.install')
-rw-r--r-- | pi-hole-server.install | 58 |
1 files changed, 1 insertions, 57 deletions
diff --git a/pi-hole-server.install b/pi-hole-server.install index e778c69f434a..544ede6fad76 100644 --- a/pi-hole-server.install +++ b/pi-hole-server.install @@ -4,10 +4,6 @@ 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 - # update lists on first run pihole -g > /dev/null @@ -21,26 +17,7 @@ post_upgrade() { [ -e /etc/pihole/hosts ] && rm /etc/pihole/hosts [ -e /etc/pihole/.useIPv6 ] && rm /etc/pihole/.useIPv6 - # 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 + # keep pacman from throwing errors should none them be on the filesystem return 0 } @@ -49,36 +26,3 @@ post_remove() { # 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 } - -_dnsmasq_address_setup() { # official code here - . /etc/pihole/setupVars.conf - dnsmasq_pihole_conf=/etc/dnsmasq.d/02-pihole.conf - - 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_conf} - else - sed -i '/^address=\/pi.hole\/@IPv4@/d' ${dnsmasq_pihole_conf} - sed -i '/^address=\/@HOSTNAME@\/@IPv4@/d' ${dnsmasq_pihole_conf} - fi - - if [[ "${IPV6_ADDRESS}" != "" ]]; then - sed -i "s/@IPv6@/$IPV6_ADDRESS/" ${dnsmasq_pihole_conf} - else - sed -i '/^address=\/pi.hole\/@IPv6@/d' ${dnsmasq_pihole_conf} - sed -i '/^address=\/@HOSTNAME@\/@IPv6@/d' ${dnsmasq_pihole_conf} - fi - - if [[ "${hostname}" != "" ]]; then - sed -i "s/@HOSTNAME@/$hostname/" ${dnsmasq_pihole_conf} - else - sed -i '/^address=\/@HOSTNAME@*/d' ${dnsmasq_pihole_conf} - fi -} |