blob: b64ee7b016c1cdb81caaedf2f61d891d4fa71206 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
warning() {
echo -e "\e[1;33m==>\e[0m Ver. 3.2: \e[1;31mWeb servers configurations are changed.\e[0m Please follow WIKI instructions.\e[0m"
}
cache_problem() {
echo -e "\e[1;33m==>\e[0m If you suffer strange rendering issues in the web GUI, please clear your browser cache.\e[0m"
}
post_install() {
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"
# permissions
chown -R http:http /srv/http/pihole
chown pihole:pihole /etc/pihole
/opt/pihole/mimic_setupVars.conf.sh
# update lists on first run
pihole -g > /dev/null
# populate /etc/dnsmasq.d/01-pihole.conf
echo -e "\e[1;33m==>\e[0m Populating initial dnsmasq files...\e[0m"
source /opt/pihole/basic-install.sh
dnsmasq_pihole_01_target="/etc/dnsmasq.d/01-pihole.conf"
addOrEditKeyValPair "${dnsmasq_pihole_01_target}" "interface" "$PIHOLE_INTERFACE"
addOrEditKeyValPair "${dnsmasq_pihole_01_target}" "server" "$PIHOLE_DNS_1"
addKey "${dnsmasq_pihole_01_target}" "server=$PIHOLE_DNS_2"
# /etc/pihole/versions file generation
echo -e "\e[1;33m==>\e[0m Creating 'versions' file...\e[0m"
/opt/pihole/updatecheck.sh
}
post_upgrade() {
# clean old/unused/deprecated files
[ -e /etc/pihole/hosts ] && rm /etc/pihole/hosts
[ -e /etc/pihole/.useIPv6 ] && rm /etc/pihole/.useIPv6
# update owner of existing dir and file
chown pihole:pihole /etc/pihole
# pihole version output improvement
grep -qxF 'INSTALL_WEB_INTERFACE=true' /etc/pihole/setupVars.conf || echo 'INSTALL_WEB_INTERFACE=true' >> /etc/pihole/setupVars.conf
# query logging disabling needs this
grep -qF 'QUERY_LOGGING=' /etc/pihole/setupVars.conf || echo 'QUERY_LOGGING=true' >> /etc/pihole/setupVars.conf
# /etc/pihole/versions file generation
echo -e "\e[1;33m==>\e[0m Updating 'versions' file...\e[0m"
/opt/pihole/updatecheck.sh
# warning
cache_problem
# keep pacman from throwing errors should none them be on the filesystem
return 0
}
post_remove() {
# 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' ! -name 'gravity.db' -delete
}
|