31
31
# List of supported DNS servers
32
32
DNS_SERVERS=$( cat << EOM
33
33
Google (ECS);8.8.8.8;8.8.4.4;2001:4860:4860:0:0:0:0:8888;2001:4860:4860:0:0:0:0:8844
34
- OpenDNS (ECS);208.67.222.222;208.67.220.220;2620:0:ccc::2 ;2620:0:ccd::2
34
+ OpenDNS (ECS);208.67.222.222;208.67.220.220;2620:119:35::35 ;2620:119:53::53
35
35
Level3;4.2.2.1;4.2.2.2;;
36
36
Comodo;8.26.56.26;8.20.247.20;;
37
37
DNS.WATCH;84.200.69.80;84.200.70.40;2001:1608:10:25:0:0:1c04:b12f;2001:1608:10:25:0:0:9249:d69b
@@ -65,6 +65,7 @@ PI_HOLE_FILES=(chronometer list piholeDebug piholeLogFlush setupLCD update versi
65
65
# This directory is where the Pi-hole scripts will be installed
66
66
PI_HOLE_INSTALL_DIR=" /opt/pihole"
67
67
PI_HOLE_CONFIG_DIR=" /etc/pihole"
68
+ PI_HOLE_BIN_DIR=" /usr/local/bin"
68
69
PI_HOLE_BLOCKPAGE_DIR=" ${webroot} /pihole"
69
70
useUpdateVars=false
70
71
@@ -84,8 +85,13 @@ if [ -z "${USER}" ]; then
84
85
fi
85
86
86
87
87
- # Find the rows and columns will default to 80x24 if it can not be detected
88
- screen_size=$( stty size || printf ' %d %d' 24 80)
88
+ # Check if we are running on a real terminal and find the rows and columns
89
+ # If there is no real terminal, we will default to 80x24
90
+ if [ -t 0 ] ; then
91
+ screen_size=$( stty size)
92
+ else
93
+ screen_size=" 24 80"
94
+ fi
89
95
# Set rows variable to contain first number
90
96
printf -v rows ' %d' " ${screen_size%% * } "
91
97
# Set columns variable to contain second number
@@ -283,7 +289,7 @@ elif is_command rpm ; then
283
289
UPDATE_PKG_CACHE=" :"
284
290
PKG_INSTALL=(${PKG_MANAGER} install -y)
285
291
PKG_COUNT=" ${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
286
- INSTALLER_DEPS=(dialog git iproute newt procps-ng which)
292
+ INSTALLER_DEPS=(dialog git iproute newt procps-ng which chkconfig )
287
293
PIHOLE_DEPS=(bind-utils cronie curl findutils nmap-ncat sudo unzip wget libidn2 psmisc sqlite libcap)
288
294
PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php-common php-cli php-pdo)
289
295
LIGHTTPD_USER=" lighttpd"
@@ -1168,12 +1174,11 @@ chooseBlocklists() {
1168
1174
mv " ${adlistFile} " " ${adlistFile} .old"
1169
1175
fi
1170
1176
# Let user select (or not) blocklists via a checklist
1171
- cmd=(whiptail --separate-output --checklist " Pi-hole relies on third party lists in order to block ads.\\ n\\ nYou can use the suggestions below, and/or add your own after installation\\ n\\ nTo deselect any list, use the arrow keys and spacebar" " ${r} " " ${c} " 7 )
1177
+ cmd=(whiptail --separate-output --checklist " Pi-hole relies on third party lists in order to block ads.\\ n\\ nYou can use the suggestions below, and/or add your own after installation\\ n\\ nTo deselect any list, use the arrow keys and spacebar" " ${r} " " ${c} " 6 )
1172
1178
# In an array, show the options available (all off by default):
1173
1179
options=(StevenBlack " StevenBlack's Unified Hosts List" on
1174
1180
MalwareDom " MalwareDomains" on
1175
1181
Cameleon " Cameleon" on
1176
- ZeusTracker " ZeusTracker" on
1177
1182
DisconTrack " Disconnect.me Tracking" on
1178
1183
DisconAd " Disconnect.me Ads" on
1179
1184
HostsFile " Hosts-file.net Ads" on)
@@ -1195,7 +1200,6 @@ appendToListsFile() {
1195
1200
StevenBlack ) echo " https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" >> " ${adlistFile} " ;;
1196
1201
MalwareDom ) echo " https://mirror1.malwaredomains.com/files/justdomains" >> " ${adlistFile} " ;;
1197
1202
Cameleon ) echo " http://sysctl.org/cameleon/hosts" >> " ${adlistFile} " ;;
1198
- ZeusTracker ) echo " https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist" >> " ${adlistFile} " ;;
1199
1203
DisconTrack ) echo " https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt" >> " ${adlistFile} " ;;
1200
1204
DisconAd ) echo " https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt" >> " ${adlistFile} " ;;
1201
1205
HostsFile ) echo " https://hosts-file.net/ad_servers.txt" >> " ${adlistFile} " ;;
@@ -1213,7 +1217,6 @@ installDefaultBlocklists() {
1213
1217
appendToListsFile StevenBlack
1214
1218
appendToListsFile MalwareDom
1215
1219
appendToListsFile Cameleon
1216
- appendToListsFile ZeusTracker
1217
1220
appendToListsFile DisconTrack
1218
1221
appendToListsFile DisconAd
1219
1222
appendToListsFile HostsFile
@@ -1337,7 +1340,7 @@ installScripts() {
1337
1340
install -o " ${USER} " -Dm755 -t " ${PI_HOLE_INSTALL_DIR} " ./advanced/Scripts/* .sh
1338
1341
install -o " ${USER} " -Dm755 -t " ${PI_HOLE_INSTALL_DIR} " ./automated\ install/uninstall.sh
1339
1342
install -o " ${USER} " -Dm755 -t " ${PI_HOLE_INSTALL_DIR} " ./advanced/Scripts/COL_TABLE
1340
- install -o " ${USER} " -Dm755 -t /usr/local/bin/ pihole
1343
+ install -o " ${USER} " -Dm755 -t " ${PI_HOLE_BIN_DIR} " pihole
1341
1344
install -Dm644 ./advanced/bash-completion/pihole /etc/bash_completion.d/pihole
1342
1345
printf " %b %b %s\\ n" " ${OVER} " " ${TICK} " " ${str} "
1343
1346
@@ -1605,7 +1608,6 @@ install_dependent_packages() {
1605
1608
1606
1609
# Install packages passed in via argument array
1607
1610
# No spinner - conflicts with set -e
1608
- declare -a argArray1=(" ${! 1} " )
1609
1611
declare -a installArray
1610
1612
1611
1613
# Debian based package install - debconf will download the entire package list
@@ -1615,7 +1617,7 @@ install_dependent_packages() {
1615
1617
# installed by us, and remove only the installed packages, and not the entire list.
1616
1618
if is_command debconf-apt-progress ; then
1617
1619
# For each package,
1618
- for i in " ${argArray1[@]} " ; do
1620
+ for i in " $@ " ; do
1619
1621
printf " %b Checking for %s..." " ${INFO} " " ${i} "
1620
1622
if dpkg-query -W -f=' ${Status}' " ${i} " 2> /dev/null | grep " ok installed" & > /dev/null; then
1621
1623
printf " %b %b Checking for %s\\ n" " ${OVER} " " ${TICK} " " ${i} "
@@ -1634,7 +1636,7 @@ install_dependent_packages() {
1634
1636
fi
1635
1637
1636
1638
# Install Fedora/CentOS packages
1637
- for i in " ${argArray1[@]} " ; do
1639
+ for i in " $@ " ; do
1638
1640
printf " %b Checking for %s..." " ${INFO} " " ${i} "
1639
1641
if ${PKG_MANAGER} -q list installed " ${i} " & > /dev/null; then
1640
1642
printf " %b %b Checking for %s" " ${OVER} " " ${TICK} " " ${i} "
@@ -1691,13 +1693,13 @@ installPiholeWeb() {
1691
1693
# and copy in the pihole sudoers file
1692
1694
install -m 0640 ${PI_HOLE_LOCAL_REPO} /advanced/Templates/pihole.sudo /etc/sudoers.d/pihole
1693
1695
# Add lighttpd user (OS dependent) to sudoers file
1694
- echo " ${LIGHTTPD_USER} ALL=NOPASSWD: /usr/local/bin /pihole" >> /etc/sudoers.d/pihole
1696
+ echo " ${LIGHTTPD_USER} ALL=NOPASSWD: ${PI_HOLE_BIN_DIR} /pihole" >> /etc/sudoers.d/pihole
1695
1697
1696
1698
# If the Web server user is lighttpd,
1697
1699
if [[ " $LIGHTTPD_USER " == " lighttpd" ]]; then
1698
1700
# Allow executing pihole via sudo with Fedora
1699
- # Usually /usr/local/bin is not permitted as directory for sudoable programs
1700
- echo " Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin " >> /etc/sudoers.d/pihole
1701
+ # Usually /usr/local/bin ${PI_HOLE_BIN_DIR} is not permitted as directory for sudoable programs
1702
+ echo " Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:${PI_HOLE_BIN_DIR} " >> /etc/sudoers.d/pihole
1701
1703
fi
1702
1704
# Set the strict permissions on the file
1703
1705
chmod 0440 /etc/sudoers.d/pihole
@@ -2381,8 +2383,16 @@ FTLcheckUpdate() {
2381
2383
if [[ ${ftlLoc} ]]; then
2382
2384
local FTLversion
2383
2385
FTLversion=$( /usr/bin/pihole-FTL tag)
2386
+ local FTLreleaseData
2384
2387
local FTLlatesttag
2385
- FTLlatesttag=$( curl -sI https://github.com/pi-hole/FTL/releases/latest | grep ' Location' | awk -F ' /' ' {print $NF}' | tr -d ' \r\n' )
2388
+
2389
+ if ! FTLreleaseData=$( curl -sI https://github.com/pi-hole/FTL/releases/latest) ; then
2390
+ # There was an issue while retrieving the latest version
2391
+ printf " %b Failed to retrieve latest FTL release metadata" " ${CROSS} "
2392
+ return 3
2393
+ fi
2394
+
2395
+ FTLlatesttag=$( grep ' Location' <<< " ${FTLreleaseData}" | awk -F ' /' ' {print $NF}' | tr -d ' \r\n' )
2386
2396
2387
2397
if [[ " ${FTLversion} " != " ${FTLlatesttag} " ]]; then
2388
2398
return 0
@@ -2506,7 +2516,7 @@ main() {
2506
2516
notify_package_updates_available
2507
2517
2508
2518
# Install packages used by this installation script
2509
- install_dependent_packages INSTALLER_DEPS[@]
2519
+ install_dependent_packages " ${ INSTALLER_DEPS[@]} "
2510
2520
2511
2521
# Check if SELinux is Enforcing
2512
2522
checkSelinux
@@ -2557,7 +2567,7 @@ main() {
2557
2567
dep_install_list+=(" ${PIHOLE_WEB_DEPS[@]} " )
2558
2568
fi
2559
2569
2560
- install_dependent_packages dep_install_list[@]
2570
+ install_dependent_packages " ${ dep_install_list[@]} "
2561
2571
unset dep_install_list
2562
2572
2563
2573
# On some systems, lighttpd is not enabled on first install. We need to enable it here if the user
@@ -2665,7 +2675,7 @@ main() {
2665
2675
2666
2676
if [[ " ${INSTALL_TYPE} " == " Update" ]]; then
2667
2677
printf " \\ n"
2668
- /usr/local/bin /pihole version --current
2678
+ " ${PI_HOLE_BIN_DIR} " /pihole version --current
2669
2679
fi
2670
2680
}
2671
2681
0 commit comments