diff options
Diffstat (limited to 'pi-hole-server.install')
-rw-r--r-- | pi-hole-server.install | 32 |
1 files changed, 17 insertions, 15 deletions
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) |