2323
2424# ####### VARIABLES #########
2525# For better maintainability, we store as much information that can change in variables
26- # This allows us to make a change in one place that can propogate to all instances of the variable
26+ # This allows us to make a change in one place that can propagate to all instances of the variable
2727# These variables should all be GLOBAL variables, written in CAPS
2828# Local variables will be in lowercase and will exist only within functions
2929# It's still a work in progress, so you may see some variance in this guideline until it is complete
@@ -43,7 +43,7 @@ webInterfaceGitUrl="https://github.com/pi-hole/AdminLTE.git"
4343webInterfaceDir=" /var/www/html/admin"
4444piholeGitUrl=" https://github.com/pi-hole/pi-hole.git"
4545PI_HOLE_LOCAL_REPO=" /etc/.pihole"
46- # These are the names of piholes files, stored in an array
46+ # These are the names of pi-holes files, stored in an array
4747PI_HOLE_FILES=(chronometer list piholeDebug piholeLogFlush setupLCD update version gravity uninstall webpage)
4848# This folder is where the Pi-hole scripts will be installed
4949PI_HOLE_INSTALL_DIR=" /opt/pihole"
@@ -81,7 +81,7 @@ runUnattended=false
8181if [[ -f " ${coltable} " ]]; then
8282 # source it
8383 source ${coltable}
84- # Othwerise ,
84+ # Otherwise ,
8585else
8686 # Set these values so the installer can still run in color
8787 COL_NC=' \e[0m' # No Color
@@ -163,7 +163,7 @@ if command -v apt-get &> /dev/null; then
163163 # These programs are stored in an array so they can be looped through later
164164 INSTALLER_DEPS=(apt-utils dialog debconf dhcpcd5 git ${iproute_pkg} whiptail)
165165 # Pi-hole itself has several dependencies that also need to be installed
166- PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget idn2)
166+ PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget idn2 sqlite3 )
167167 # The Web dashboard has some that also need to be installed
168168 # It's useful to separate the two since our repos are also setup as "Core" code and "Web" code
169169 PIHOLE_WEB_DEPS=(lighttpd ${phpVer} -common ${phpVer} -cgi ${phpVer} -${phpSqlite} )
@@ -771,6 +771,7 @@ setDNS() {
771771 Comodo " "
772772 DNSWatch " "
773773 Quad9 " "
774+ FamilyShield " "
774775 Custom " " )
775776 # In a whiptail dialog, show the options
776777 DNSchoices=$( whiptail --separate-output --menu " Select Upstream DNS Provider. To use your own, select Custom." ${r} ${c} 7 \
@@ -817,6 +818,11 @@ setDNS() {
817818 PIHOLE_DNS_1=" 9.9.9.9"
818819 PIHOLE_DNS_2=" 149.112.112.112"
819820 ;;
821+ FamilyShield)
822+ echo " FamilyShield servers"
823+ PIHOLE_DNS_1=" 208.67.222.123"
824+ PIHOLE_DNS_2=" 208.67.220.123"
825+ ;;
820826 Custom)
821827 # Until the DNS settings are selected,
822828 until [[ " ${DNSSettingsCorrect} " = True ]]; do
@@ -918,7 +924,7 @@ setLogging() {
918924 esac
919925}
920926
921- # Funtion to ask the user if they want to install the dashboard
927+ # Function to ask the user if they want to install the dashboard
922928setAdminFlag () {
923929 # Local, named variables
924930 local WebToggleCommand
@@ -946,7 +952,7 @@ setAdminFlag() {
946952 esac
947953}
948954
949- # Check if /etc/dnsmasq.conf is from pihole . If so replace with an original and install new in .d directory
955+ # Check if /etc/dnsmasq.conf is from pi-hole . If so replace with an original and install new in .d directory
950956version_check_dnsmasq () {
951957 # Local, named variables
952958 local dnsmasq_conf=" /etc/dnsmasq.conf"
@@ -1734,17 +1740,14 @@ clone_or_update_repos() {
17341740 fi
17351741}
17361742
1737- # Download and install FTL binary
1743+ # Download FTL binary to random temp directory and install FTL binary
17381744FTLinstall () {
17391745 # Local, named variables
17401746 local binary=" ${1} "
17411747 local latesttag
1742- local orig_dir
17431748 local str=" Downloading and Installing FTL"
17441749 echo -ne " ${INFO} ${str} ..."
17451750
1746- # Get the current working directory
1747- orig_dir=" ${PWD} "
17481751 # Find the latest version tag for FTL
17491752 latesttag=$( curl -sI https://github.com/pi-hole/FTL/releases/latest | grep " Location" | awk -F ' /' ' {print $NF}' )
17501753 # Tags should always start with v, check for that.
@@ -1754,42 +1757,44 @@ FTLinstall() {
17541757 return 1
17551758 fi
17561759
1760+ # Move into the temp ftl directory
1761+ pushd " $( mktemp -d) " || { echo " Unable to make temporary directory for FTL binary download" ; return 1; }
1762+
1763+ # Always replace pihole-FTL.service
1764+ install -T -m 0755 " ${PI_HOLE_LOCAL_REPO} /advanced/pihole-FTL.service" " /etc/init.d/pihole-FTL"
1765+
17571766 # If the download worked,
1758- if curl -sSL --fail " https://github.com/pi-hole/FTL/releases/download/${latesttag% $' \r ' } /${binary} " -o " /tmp/ ${binary} " ; then
1767+ if curl -sSL --fail " https://github.com/pi-hole/FTL/releases/download/${latesttag% $' \r ' } /${binary} " -o " ${binary} " ; then
17591768 # get sha1 of the binary we just downloaded for verification.
1760- curl -sSL --fail " https://github.com/pi-hole/FTL/releases/download/${latesttag% $' \r ' } /${binary} .sha1" -o " /tmp/ ${binary} .sha1"
1769+ curl -sSL --fail " https://github.com/pi-hole/FTL/releases/download/${latesttag% $' \r ' } /${binary} .sha1" -o " ${binary} .sha1"
17611770
1762- # Move into the temp directory
1763- cd /tmp
17641771 # If we downloaded binary file (as opposed to text),
17651772 if sha1sum --status --quiet -c " ${binary} " .sha1; then
17661773 echo -n " transferred... "
17671774 # Stop FTL
17681775 stop_service pihole-FTL & > /dev/null
17691776 # Install the new version with the correct permissions
1770- install -T -m 0755 /tmp/${binary} /usr/bin/pihole-FTL
1771- # Remove the tempoary file
1772- rm /tmp/${binary} /tmp/${binary} .sha1
1777+ install -T -m 0755 " ${binary} " /usr/bin/pihole-FTL
17731778 # Move back into the original directory the user was in
1774- cd " ${orig_dir} "
1779+ popd || { echo " Unable to return to original directory after FTL binary download. " ; return 1 ; }
17751780 # Install the FTL service
1776- install -T -m 0755 " ${PI_HOLE_LOCAL_REPO} /advanced/pihole-FTL.service" " /etc/init.d/pihole-FTL"
17771781 echo -e " ${OVER} ${TICK} ${str} "
17781782 return 0
17791783 # Otherise,
17801784 else
1785+ # the download failed, so just go back to the original directory
1786+ popd || { echo " Unable to return to original directory after FTL binary download." ; return 1; }
17811787 echo -e " ${OVER} ${CROSS} ${str} "
17821788 echo -e " ${COL_LIGHT_RED} Error: Download of binary from Github failed${COL_NC} "
1783- # the download failed, so just go back to the original directory
1784- cd " ${orig_dir} "
17851789 return 1
17861790 fi
17871791 # Otherwise,
17881792 else
1789- cd " ${orig_dir} "
1793+ popd || { echo " Unable to return to original directory after FTL binary download. " ; return 1 ; }
17901794 echo -e " ${OVER} ${CROSS} ${str} "
17911795 # The URL could not be found
17921796 echo -e " ${COL_LIGHT_RED} Error: URL not found${COL_NC} "
1797+ return 1
17931798 fi
17941799}
17951800
@@ -1957,7 +1962,7 @@ main() {
19571962 for var in " $@ " ; do
19581963 case " $var " in
19591964 " --reconfigure" ) reconfigure=true;;
1960- " --i_do_not_follow_recommendations" ) skipSpaceCheck=false ;;
1965+ " --i_do_not_follow_recommendations" ) skipSpaceCheck=true ;;
19611966 " --unattended" ) runUnattended=true;;
19621967 esac
19631968 done
0 commit comments