Merge branch 'master' into tweak/32bitARM
Some checks are pending
Check for merge conflicts / main (push) Waiting to run
CodeQL / Analyze (pull_request) Waiting to run
Test Supported Distributions / smoke-tests (pull_request) Waiting to run
Test Supported Distributions / distro-test (alpine_3_21) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (alpine_3_22) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (alpine_3_23) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (centos_10) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (centos_9) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_11) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_12) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_13) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_40) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_41) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_42) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_43) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_20) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_22) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_24) (pull_request) Blocked by required conditions
Check for merge conflicts / main (pull_request_target) Waiting to run
Some checks are pending
Check for merge conflicts / main (push) Waiting to run
CodeQL / Analyze (pull_request) Waiting to run
Test Supported Distributions / smoke-tests (pull_request) Waiting to run
Test Supported Distributions / distro-test (alpine_3_21) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (alpine_3_22) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (alpine_3_23) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (centos_10) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (centos_9) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_11) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_12) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_13) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_40) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_41) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_42) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_43) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_20) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_22) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_24) (pull_request) Blocked by required conditions
Check for merge conflicts / main (pull_request_target) Waiting to run
This commit is contained in:
@@ -94,8 +94,8 @@ fresh_install=true
|
||||
|
||||
adlistFile="/etc/pihole/adlists.list"
|
||||
# Pi-hole needs an IP address; to begin, these variables are empty since we don't know what the IP is until this script can run
|
||||
IPV4_ADDRESS=${IPV4_ADDRESS}
|
||||
IPV6_ADDRESS=${IPV6_ADDRESS}
|
||||
IPV4_ADDRESS=
|
||||
IPV6_ADDRESS=
|
||||
# Give settings their default values. These may be changed by prompts later in the script.
|
||||
QUERY_LOGGING=
|
||||
PRIVACY_LEVEL=
|
||||
@@ -116,11 +116,11 @@ c=70
|
||||
PIHOLE_META_PACKAGE_CONTROL_APT=$(
|
||||
cat <<EOM
|
||||
Package: pihole-meta
|
||||
Version: 0.4
|
||||
Version: 0.6
|
||||
Maintainer: Pi-hole team <adblock@pi-hole.net>
|
||||
Architecture: all
|
||||
Description: Pi-hole dependency meta package
|
||||
Depends: awk,bash-completion,binutils,ca-certificates,cron|cron-daemon,curl,dialog,dnsutils,dns-root-data,git,grep,iproute2,iputils-ping,jq,libcap2,libcap2-bin,lshw,netcat-openbsd,procps,psmisc,sudo,unzip
|
||||
Depends: awk,bash-completion,binutils,ca-certificates,cron|cron-daemon,curl,dialog,bind9-dnsutils|dnsutils,dns-root-data,git,grep,iproute2,iputils-ping,jq,libcap2,libcap2-bin,lshw,procps,psmisc,sudo,unzip
|
||||
Section: contrib/metapackages
|
||||
Priority: optional
|
||||
EOM
|
||||
@@ -130,12 +130,12 @@ EOM
|
||||
PIHOLE_META_PACKAGE_CONTROL_RPM=$(
|
||||
cat <<EOM
|
||||
Name: pihole-meta
|
||||
Version: 0.2
|
||||
Version: 0.3
|
||||
Release: 1
|
||||
License: EUPL
|
||||
BuildArch: noarch
|
||||
Summary: Pi-hole dependency meta package
|
||||
Requires: bash-completion,bind-utils,binutils,ca-certificates,chkconfig,cronie,curl,dialog,findutils,gawk,git,grep,iproute,jq,libcap,lshw,nmap-ncat,procps-ng,psmisc,sudo,unzip
|
||||
Requires: bash-completion,bind-utils,binutils,ca-certificates,chkconfig,cronie,curl,dialog,findutils,gawk,git,grep,iproute,jq,libcap,lshw,procps-ng,psmisc,sudo,unzip
|
||||
%description
|
||||
Pi-hole dependency meta package
|
||||
%prep
|
||||
@@ -143,6 +143,9 @@ Pi-hole dependency meta package
|
||||
%files
|
||||
%install
|
||||
%changelog
|
||||
* Mon Jul 14 2025 Pi-hole Team - 0.3
|
||||
- Remove nmap-ncat from the list of dependencies
|
||||
|
||||
* Wed May 28 2025 Pi-hole Team - 0.2
|
||||
- Add gawk to the list of dependencies
|
||||
|
||||
@@ -151,19 +154,61 @@ Pi-hole dependency meta package
|
||||
EOM
|
||||
)
|
||||
|
||||
# List of required packages on APK based systems
|
||||
PIHOLE_META_VERSION_APK=0.2
|
||||
PIHOLE_META_DEPS_APK=(
|
||||
bash
|
||||
bash-completion
|
||||
bind-tools
|
||||
binutils
|
||||
coreutils
|
||||
cronie
|
||||
curl
|
||||
dialog
|
||||
git
|
||||
grep
|
||||
iproute2-minimal # piholeARPTable.sh
|
||||
iproute2-ss # piholeDebug.sh
|
||||
jq
|
||||
libcap
|
||||
logrotate
|
||||
lscpu # piholeDebug.sh
|
||||
lshw # piholeDebug.sh
|
||||
ncurses
|
||||
procps-ng
|
||||
psmisc
|
||||
shadow
|
||||
sudo
|
||||
tzdata
|
||||
unzip
|
||||
)
|
||||
|
||||
######## Undocumented Flags. Shhh ########
|
||||
# These are undocumented flags; some of which we can use when repairing an installation
|
||||
# The runUnattended flag is one example of this
|
||||
repair=false
|
||||
runUnattended=false
|
||||
skipFTL=false
|
||||
# Check arguments for the undocumented flags
|
||||
for var in "$@"; do
|
||||
case "$var" in
|
||||
case "${var}" in
|
||||
"--repair") repair=true ;;
|
||||
"--unattended") runUnattended=true ;;
|
||||
"--skipFTL") skipFTL=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "${runUnattended}" == true ]]; then
|
||||
# In order to run an unattended setup, a pre-seeded /etc/pihole/pihole.toml must exist
|
||||
if [[ ! -f "${PI_HOLE_CONFIG_DIR}/pihole.toml" ]]; then
|
||||
printf " %b Error: \"%s\" not found. Cannot run unattended setup\\n" "${CROSS}" "${PI_HOLE_CONFIG_DIR}/pihole.toml"
|
||||
exit 1
|
||||
fi
|
||||
printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"
|
||||
# also disable debconf-apt-progress dialogs
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
fi
|
||||
|
||||
# If the color table file exists,
|
||||
if [[ -f "${coltable}" ]]; then
|
||||
# source it
|
||||
@@ -173,13 +218,11 @@ if [[ -f "${coltable}" ]]; then
|
||||
else
|
||||
# Set these values so the installer can still run in color
|
||||
COL_NC='\e[0m' # No Color
|
||||
COL_LIGHT_GREEN='\e[1;32m'
|
||||
COL_LIGHT_RED='\e[1;31m'
|
||||
TICK="[${COL_LIGHT_GREEN}✓${COL_NC}]"
|
||||
CROSS="[${COL_LIGHT_RED}✗${COL_NC}]"
|
||||
COL_GREEN='\e[1;32m'
|
||||
COL_RED='\e[1;31m'
|
||||
TICK="[${COL_GREEN}✓${COL_NC}]"
|
||||
CROSS="[${COL_RED}✗${COL_NC}]"
|
||||
INFO="[i]"
|
||||
# shellcheck disable=SC2034
|
||||
DONE="${COL_LIGHT_GREEN} done!${COL_NC}"
|
||||
OVER="\\r\\033[K"
|
||||
fi
|
||||
|
||||
@@ -187,13 +230,13 @@ fi
|
||||
# This lets users know that it is a Pi-hole, LLC product
|
||||
show_ascii_berry() {
|
||||
echo -e "
|
||||
${COL_LIGHT_GREEN}.;;,.
|
||||
${COL_GREEN}.;;,.
|
||||
.ccccc:,.
|
||||
:cccclll:. ..,,
|
||||
:ccccclll. ;ooodc
|
||||
'ccll:;ll .oooodc
|
||||
.;cll.;;looo:.
|
||||
${COL_LIGHT_RED}.. ','.
|
||||
${COL_RED}.. ','.
|
||||
.',,,,,,'.
|
||||
.',,,,,,,,,,.
|
||||
.',,,,,,,,,,,,....
|
||||
@@ -215,7 +258,7 @@ abort() {
|
||||
# remove any leftover build directory that may exist
|
||||
rm -rf /tmp/pihole-meta_*
|
||||
|
||||
echo -e "\\n\\n ${COL_LIGHT_RED}Installation was interrupted${COL_NC}\\n"
|
||||
echo -e "\\n\\n ${COL_RED}Installation was interrupted${COL_NC}\\n"
|
||||
echo -e "Pi-hole's dependencies might be already installed. If you want to remove them you can try to\\n"
|
||||
echo -e "a) run 'pihole uninstall' \\n"
|
||||
echo -e "b) Remove the meta-package 'pihole-meta' manually \\n"
|
||||
@@ -231,6 +274,13 @@ is_command() {
|
||||
command -v "${check_command}" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
check_fresh_install() {
|
||||
# in case of an update (can be a v5 -> v6 or v6 -> v6 update) or repair
|
||||
if [[ -f "${PI_HOLE_V6_CONFIG}" ]] || [[ -f "/etc/pihole/setupVars.conf" ]]; then
|
||||
fresh_install=false
|
||||
fi
|
||||
}
|
||||
|
||||
# Compatibility
|
||||
package_manager_detect() {
|
||||
|
||||
@@ -247,8 +297,6 @@ package_manager_detect() {
|
||||
PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true"
|
||||
# The command we will use to remove packages (used in the uninstaller)
|
||||
PKG_REMOVE="${PKG_MANAGER} -y remove --purge"
|
||||
# Update package cache
|
||||
update_package_cache || exit 1
|
||||
|
||||
# If apt-get is not found, check for rpm.
|
||||
elif is_command rpm; then
|
||||
@@ -265,7 +313,15 @@ package_manager_detect() {
|
||||
PKG_COUNT="${PKG_MANAGER} check-update | grep -E '(.i686|.x86|.noarch|.arm|.src|.riscv64)' | wc -l || true"
|
||||
# The command we will use to remove packages (used in the uninstaller)
|
||||
PKG_REMOVE="${PKG_MANAGER} remove -y"
|
||||
# If neither apt-get or yum/dnf package managers were found
|
||||
|
||||
# If neither apt-get or yum/dnf package managers were found, check for apk.
|
||||
elif is_command apk; then
|
||||
PKG_MANAGER="apk"
|
||||
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
||||
PKG_INSTALL="${PKG_MANAGER} add"
|
||||
PKG_COUNT="${PKG_MANAGER} list --upgradable -q | wc -l"
|
||||
PKG_REMOVE="${PKG_MANAGER} del"
|
||||
|
||||
else
|
||||
# we cannot install required packages
|
||||
printf " %b No supported package manager found\\n" "${CROSS}"
|
||||
@@ -276,13 +332,20 @@ package_manager_detect() {
|
||||
|
||||
build_dependency_package(){
|
||||
# This function will build a package that contains all the dependencies needed for Pi-hole
|
||||
if is_command apk ; then
|
||||
local str="APK based system detected. Dependencies will be installed using a virtual package named pihole-meta"
|
||||
printf " %b %s...\\n" "${INFO}" "${str}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# remove any leftover build directory that may exist
|
||||
rm -rf /tmp/pihole-meta_*
|
||||
|
||||
# Create a fresh build directory with random name
|
||||
# Busybox Compat: `mktemp` long flags unsupported
|
||||
# -d flag is short form of --directory
|
||||
local tempdir
|
||||
tempdir="$(mktemp --directory /tmp/pihole-meta_XXXXX)"
|
||||
tempdir="$(mktemp -d /tmp/pihole-meta_XXXXX)"
|
||||
chmod 0755 "${tempdir}"
|
||||
|
||||
if is_command apt-get; then
|
||||
@@ -308,7 +371,7 @@ build_dependency_package(){
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||
else
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
printf "%b Error: Building pihole-meta.deb failed. %b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf "%b Error: Building pihole-meta.deb failed. %b\\n" "${COL_RED}" "${COL_NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -341,7 +404,7 @@ build_dependency_package(){
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||
else
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
printf "%b Error: Building pihole-meta.rpm failed. %b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf "%b Error: Building pihole-meta.rpm failed. %b\\n" "${COL_RED}" "${COL_NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -483,7 +546,7 @@ getGitFiles() {
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||
# Update the repo, returning an error message on failure
|
||||
update_repo "${directory}" || {
|
||||
printf "\\n %b: Could not update local repository. Contact support.%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf "\\n %b: Could not update local repository. Contact support.%b\\n" "${COL_RED}" "${COL_NC}"
|
||||
exit 1
|
||||
}
|
||||
# If it's not a .git repo,
|
||||
@@ -492,7 +555,7 @@ getGitFiles() {
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
# Attempt to make the repository, showing an error on failure
|
||||
make_repo "${directory}" "${remoteRepo}" || {
|
||||
printf "\\n %bError: Could not update local repository. Contact support.%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf "\\n %bError: Could not update local repository. Contact support.%b\\n" "${COL_RED}" "${COL_NC}"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
@@ -570,14 +633,17 @@ Do you wish to continue with an IPv6-only installation?\\n\\n" \
|
||||
;;
|
||||
esac
|
||||
|
||||
DNS_SERVERS="$DNS_SERVERS_IPV6_ONLY"
|
||||
DNS_SERVERS="${DNS_SERVERS_IPV6_ONLY}"
|
||||
printf " %b Proceeding with IPv6 only installation.\\n" "${INFO}"
|
||||
}
|
||||
|
||||
# Get available interfaces that are UP
|
||||
get_available_interfaces() {
|
||||
# There may be more than one so it's all stored in a variable
|
||||
availableInterfaces=$(ip --oneline link show up | awk '{print $2}' | grep -v "^lo" | cut -d':' -f1 | cut -d'@' -f1)
|
||||
# The ip command list all interfaces that are in the up state
|
||||
# The awk command filters out any interfaces that have the LOOPBACK flag set
|
||||
# while using the characters ": " or "@" as a field separator for awk
|
||||
availableInterfaces=$(ip --oneline link show up | awk -F ': |@' '!/<.*LOOPBACK.*>/ {print $2}')
|
||||
}
|
||||
|
||||
# A function for displaying the dialogs the user sees when first running the installer
|
||||
@@ -640,6 +706,7 @@ chooseInterface() {
|
||||
status="OFF"
|
||||
done
|
||||
# Disable check for double quote here as we are passing a string with spaces
|
||||
# shellcheck disable=SC2086
|
||||
PIHOLE_INTERFACE=$(dialog --no-shadow --keep-tite --output-fd 1 \
|
||||
--cancel-label "Exit" --ok-label "Select" \
|
||||
--radiolist "Choose An Interface (press space to toggle selection)" \
|
||||
@@ -665,9 +732,9 @@ testIPv6() {
|
||||
# first will contain fda2 (ULA)
|
||||
printf -v first "%s" "${1%%:*}"
|
||||
# value1 will contain 253 which is the decimal value corresponding to 0xFD
|
||||
value1=$(((0x$first) / 256))
|
||||
value1=$(((0x${first}) / 256))
|
||||
# value2 will contain 162 which is the decimal value corresponding to 0xA2
|
||||
value2=$(((0x$first) % 256))
|
||||
value2=$(((0x${first}) % 256))
|
||||
# the ULA test is testing for fc00::/7 according to RFC 4193
|
||||
if (((value1 & 254) == 252)); then
|
||||
# echoing result to calling function as return value
|
||||
@@ -692,7 +759,7 @@ find_IPv6_information() {
|
||||
# For each address in the array above, determine the type of IPv6 address it is
|
||||
for i in "${IPV6_ADDRESSES[@]}"; do
|
||||
# Check if it's ULA, GUA, or LL by using the function created earlier
|
||||
result=$(testIPv6 "$i")
|
||||
result=$(testIPv6 "${i}")
|
||||
# If it's a ULA address, use it and store it as a global variable
|
||||
[[ "${result}" == "ULA" ]] && ULA_ADDRESS="${i%/*}"
|
||||
# If it's a GUA address, use it and store it as a global variable
|
||||
@@ -727,7 +794,7 @@ collect_v4andv6_information() {
|
||||
printf " %b IPv4 address: %s\\n" "${INFO}" "${IPV4_ADDRESS}"
|
||||
find_IPv6_information
|
||||
printf " %b IPv6 address: %s\\n" "${INFO}" "${IPV6_ADDRESS}"
|
||||
if [ "$IPV4_ADDRESS" == "" ] && [ "$IPV6_ADDRESS" != "" ]; then
|
||||
if [ "${IPV4_ADDRESS}" == "" ] && [ "${IPV6_ADDRESS}" != "" ]; then
|
||||
confirm_ipv6_only
|
||||
fi
|
||||
}
|
||||
@@ -747,7 +814,7 @@ valid_ip() {
|
||||
local regex="^${ipv4elem}\\.${ipv4elem}\\.${ipv4elem}\\.${ipv4elem}${portelem}$"
|
||||
|
||||
# Evaluate the regex, and return the result
|
||||
[[ $ip =~ ${regex} ]]
|
||||
[[ ${ip} =~ ${regex} ]]
|
||||
|
||||
stat=$?
|
||||
return "${stat}"
|
||||
@@ -782,7 +849,7 @@ setDNS() {
|
||||
DNSChooseOptions=()
|
||||
local DNSServerCount=0
|
||||
# Save the old Internal Field Separator in a variable,
|
||||
OIFS=$IFS
|
||||
OIFS=${IFS}
|
||||
# and set the new one to newline
|
||||
IFS=$'\n'
|
||||
# Put the DNS Servers into an array
|
||||
@@ -807,7 +874,7 @@ setDNS() {
|
||||
result=$?
|
||||
case ${result} in
|
||||
"${DIALOG_CANCEL}" | "${DIALOG_ESC}")
|
||||
printf " %b Cancel was selected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf " %b Cancel was selected, exiting installer%b\\n" "${COL_RED}" "${COL_NC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -844,13 +911,13 @@ If you want to specify a port other than 53, separate it with a hash.\
|
||||
result=$?
|
||||
case ${result} in
|
||||
"${DIALOG_CANCEL}" | "${DIALOG_ESC}")
|
||||
printf " %b Cancel was selected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf " %b Cancel was selected, exiting installer%b\\n" "${COL_RED}" "${COL_NC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Clean user input and replace whitespace with comma.
|
||||
piholeDNS=$(sed 's/[, \t]\+/,/g' <<<"${piholeDNS}")
|
||||
piholeDNS="${piholeDNS//[[:blank:]]/,}"
|
||||
|
||||
# Separate the user input into the two DNS values (separated by a comma)
|
||||
printf -v PIHOLE_DNS_1 "%s" "${piholeDNS%%,*}"
|
||||
@@ -898,7 +965,7 @@ If you want to specify a port other than 53, separate it with a hash.\
|
||||
DNSSettingsCorrect=False
|
||||
;;
|
||||
"${DIALOG_ESC}")
|
||||
printf " %b Escape pressed, exiting installer at DNS Settings%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf " %b Escape pressed, exiting installer at DNS Settings%b\\n" "${COL_RED}" "${COL_NC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -906,7 +973,7 @@ If you want to specify a port other than 53, separate it with a hash.\
|
||||
done
|
||||
else
|
||||
# Save the old Internal Field Separator in a variable,
|
||||
OIFS=$IFS
|
||||
OIFS=${IFS}
|
||||
# and set the new one to newline
|
||||
IFS=$'\n'
|
||||
for DNSServer in ${DNS_SERVERS}; do
|
||||
@@ -949,7 +1016,7 @@ setLogging() {
|
||||
;;
|
||||
"${DIALOG_ESC}")
|
||||
# User pressed <ESC>
|
||||
printf " %b Escape pressed, exiting installer at Query Logging choice.%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf " %b Escape pressed, exiting installer at Query Logging choice.%b\\n" "${COL_RED}" "${COL_NC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -974,7 +1041,7 @@ setPrivacyLevel() {
|
||||
printf " %b Using privacy level: %s\\n" "${INFO}" "${PRIVACY_LEVEL}"
|
||||
;;
|
||||
"${DIALOG_CANCEL}" | "${DIALOG_ESC}")
|
||||
printf " %b Cancelled privacy level selection.%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf " %b Cancelled privacy level selection.%b\\n" "${COL_RED}" "${COL_NC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -1008,7 +1075,7 @@ chooseBlocklists() {
|
||||
;;
|
||||
"${DIALOG_ESC}")
|
||||
# User pressed <ESC>
|
||||
printf " %b Escape pressed, exiting installer at blocklist choice.%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf " %b Escape pressed, exiting installer at blocklist choice.%b\\n" "${COL_RED}" "${COL_NC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -1128,13 +1195,14 @@ installScripts() {
|
||||
install -o "${USER}" -Dm755 -t "${PI_HOLE_INSTALL_DIR}" ./automated\ install/uninstall.sh
|
||||
install -o "${USER}" -Dm755 -t "${PI_HOLE_INSTALL_DIR}" ./advanced/Scripts/COL_TABLE
|
||||
install -o "${USER}" -Dm755 -t "${PI_HOLE_BIN_DIR}" pihole
|
||||
install -Dm644 ./advanced/bash-completion/pihole /etc/bash_completion.d/pihole
|
||||
install -Dm644 ./advanced/bash-completion/pihole.bash /etc/bash_completion.d/pihole
|
||||
install -Dm644 ./advanced/bash-completion/pihole-ftl.bash /etc/bash_completion.d/pihole-FTL
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||
|
||||
else
|
||||
# Otherwise, show an error and exit
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
printf "\\t\\t%bError: Local repo %s not found, exiting installer%b\\n" "${COL_LIGHT_RED}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
||||
printf "\\t\\t%bError: Local repo %s not found, exiting installer%b\\n" "${COL_RED}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -1149,7 +1217,7 @@ installConfigs() {
|
||||
# Install empty custom.list file if it does not exist
|
||||
if [[ ! -r "${PI_HOLE_CONFIG_DIR}/hosts/custom.list" ]]; then
|
||||
if ! install -D -T -o pihole -g pihole -m 660 /dev/null "${PI_HOLE_CONFIG_DIR}/hosts/custom.list" &>/dev/null; then
|
||||
printf " %b Error: Unable to initialize configuration file %s/custom.list\\n" "${COL_LIGHT_RED}" "${PI_HOLE_CONFIG_DIR}/hosts"
|
||||
printf " %b Error: Unable to initialize configuration file %s/custom.list\\n" "${COL_RED}" "${PI_HOLE_CONFIG_DIR}/hosts"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
@@ -1167,7 +1235,12 @@ installConfigs() {
|
||||
# Load final service
|
||||
systemctl daemon-reload
|
||||
else
|
||||
install -T -m 0755 "${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole-FTL.service" '/etc/init.d/pihole-FTL'
|
||||
local INIT="service"
|
||||
if is_command openrc; then
|
||||
INIT="openrc"
|
||||
fi
|
||||
|
||||
install -T -m 0755 "${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole-FTL.${INIT}" '/etc/init.d/pihole-FTL'
|
||||
fi
|
||||
install -T -m 0755 "${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole-FTL-prestart.sh" "${PI_HOLE_INSTALL_DIR}/pihole-FTL-prestart.sh"
|
||||
install -T -m 0755 "${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole-FTL-poststop.sh" "${PI_HOLE_INSTALL_DIR}/pihole-FTL-poststop.sh"
|
||||
@@ -1191,10 +1264,6 @@ install_manpage() {
|
||||
# if not present, create man8 directory
|
||||
install -d -m 755 /usr/local/share/man/man8
|
||||
fi
|
||||
if [[ ! -d "/usr/local/share/man/man5" ]]; then
|
||||
# if not present, create man5 directory
|
||||
install -d -m 755 /usr/local/share/man/man5
|
||||
fi
|
||||
# Testing complete, copy the files & update the man db
|
||||
install -D -m 644 -T ${PI_HOLE_LOCAL_REPO}/manpages/pihole.8 /usr/local/share/man/man8/pihole.8
|
||||
|
||||
@@ -1256,6 +1325,8 @@ enable_service() {
|
||||
if is_command systemctl; then
|
||||
# use that to enable the service
|
||||
systemctl -q enable "${1}"
|
||||
elif is_command openrc; then
|
||||
rc-update add "${1}" "${2:-default}" &> /dev/null
|
||||
else
|
||||
# Otherwise, use update-rc.d to accomplish this
|
||||
update-rc.d "${1}" defaults >/dev/null
|
||||
@@ -1271,7 +1342,10 @@ disable_service() {
|
||||
# If systemctl exists,
|
||||
if is_command systemctl; then
|
||||
# use that to disable the service
|
||||
systemctl -q disable "${1}"
|
||||
systemctl -q disable --now "${1}"
|
||||
elif is_command openrc; then
|
||||
rc-update del "${1}" "${2:-default}" &> /dev/null
|
||||
|
||||
else
|
||||
# Otherwise, use update-rc.d to accomplish this
|
||||
update-rc.d "${1}" disable >/dev/null
|
||||
@@ -1284,6 +1358,8 @@ check_service_active() {
|
||||
if is_command systemctl; then
|
||||
# use that to check the status of the service
|
||||
systemctl -q is-enabled "${1}" 2>/dev/null
|
||||
elif is_command openrc; then
|
||||
rc-status default boot | grep -q "${1}"
|
||||
else
|
||||
# Otherwise, fall back to service command
|
||||
service "${1}" status &>/dev/null
|
||||
@@ -1328,7 +1404,7 @@ update_package_cache() {
|
||||
UPDATE_PKG_CACHE="apt update"
|
||||
fi
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
printf " %b Error: Unable to update package cache. Please try \"%s\"%b\\n" "${COL_LIGHT_RED}" "sudo ${UPDATE_PKG_CACHE}" "${COL_NC}"
|
||||
printf " %b Error: Unable to update package cache. Please try \"%s\"%b\\n" "${COL_RED}" "sudo ${UPDATE_PKG_CACHE}" "${COL_NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -1346,7 +1422,7 @@ notify_package_updates_available() {
|
||||
printf "%b %b %s... up to date!\\n\\n" "${OVER}" "${TICK}" "${str}"
|
||||
else
|
||||
printf "%b %b %s... %s updates available\\n" "${OVER}" "${TICK}" "${str}" "${updatesToInstall}"
|
||||
printf " %b %bIt is recommended to update your OS after installing the Pi-hole!%b\\n\\n" "${INFO}" "${COL_LIGHT_GREEN}" "${COL_NC}"
|
||||
printf " %b %bIt is recommended to update your OS after installing the Pi-hole!%b\\n\\n" "${INFO}" "${COL_GREEN}" "${COL_NC}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1363,11 +1439,11 @@ install_dependent_packages() {
|
||||
rm /tmp/pihole-meta.deb
|
||||
else
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
||||
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_RED}"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
printf " %b Error: Unable to find Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
||||
printf " %b Error: Unable to find Pi-hole dependency package.\\n" "${COL_RED}"
|
||||
return 1
|
||||
fi
|
||||
# Install Fedora/CentOS packages
|
||||
@@ -1378,15 +1454,34 @@ install_dependent_packages() {
|
||||
rm /tmp/pihole-meta.rpm
|
||||
else
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
||||
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_RED}"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
printf " %b Error: Unable to find Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
||||
printf " %b Error: Unable to find Pi-hole dependency package.\\n" "${COL_RED}"
|
||||
return 1
|
||||
fi
|
||||
# Install Alpine packages
|
||||
elif is_command apk; then
|
||||
local repo_str="Ensuring alpine 'community' repo is enabled."
|
||||
printf "%b %b %s" "${OVER}" "${INFO}" "${repo_str}"
|
||||
|
||||
# If neither apt-get or yum/dnf package managers were found
|
||||
local pattern='^\s*#(.*/community/?)\s*$'
|
||||
sed -Ei "s:${pattern}:\1:" /etc/apk/repositories
|
||||
if grep -Eq "${pattern}" /etc/apk/repositories; then
|
||||
# Repo still commented out = Failure
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${repo_str}"
|
||||
else
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${repo_str}"
|
||||
fi
|
||||
printf " %b %s..." "${INFO}" "${str}"
|
||||
if { ${PKG_INSTALL} -q -t "pihole-meta=${PIHOLE_META_VERSION_APK}" "${PIHOLE_META_DEPS_APK[@]}" &>/dev/null; }; then
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||
else
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_RED}"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
# we cannot install the dependency package
|
||||
printf " %b No supported package manager found\\n" "${CROSS}"
|
||||
@@ -1411,6 +1506,15 @@ installCron() {
|
||||
# Randomize update checker time
|
||||
sed -i "s/59 17/$((1 + RANDOM % 58)) $((12 + RANDOM % 8))/" /etc/cron.d/pihole
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||
|
||||
# Switch off of busybox cron on alpine
|
||||
if is_command openrc; then
|
||||
printf " %b Switching from busybox crond to cronie...\\n" "${INFO}"
|
||||
stop_service crond
|
||||
disable_service crond
|
||||
enable_service cronie
|
||||
restart_service cronie
|
||||
fi
|
||||
}
|
||||
|
||||
# Gravity is a very important script as it aggregates all of the domains into a single HOSTS formatted list,
|
||||
@@ -1460,7 +1564,7 @@ create_pihole_user() {
|
||||
# then create and add her to the pihole group
|
||||
local str="Creating user 'pihole'"
|
||||
printf "%b %b %s..." "${OVER}" "${INFO}" "${str}"
|
||||
if useradd -r --no-user-group -g pihole -s /usr/sbin/nologin pihole; then
|
||||
if useradd -r --no-user-group -g pihole -s "$(command -v nologin)" pihole; then
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||
else
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
@@ -1475,7 +1579,7 @@ create_pihole_user() {
|
||||
# create and add pihole user to the pihole group
|
||||
local str="Creating user 'pihole'"
|
||||
printf "%b %b %s..." "${OVER}" "${INFO}" "${str}"
|
||||
if useradd -r --no-user-group -g pihole -s /usr/sbin/nologin pihole; then
|
||||
if useradd -r --no-user-group -g pihole -s "$(command -v nologin)" pihole; then
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||
else
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
@@ -1611,13 +1715,13 @@ checkSelinux() {
|
||||
if [[ "${SELINUX_ENFORCING}" -eq 1 ]] && [[ -z "${PIHOLE_SELINUX}" ]]; then
|
||||
printf " Pi-hole does not provide an SELinux policy as the required changes modify the security of your system.\\n"
|
||||
printf " Please refer to https://wiki.centos.org/HowTos/SELinux if SELinux is required for your deployment.\\n"
|
||||
printf " This check can be skipped by setting the environment variable %bPIHOLE_SELINUX%b to %btrue%b\\n" "${COL_LIGHT_RED}" "${COL_NC}" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf " This check can be skipped by setting the environment variable %bPIHOLE_SELINUX%b to %btrue%b\\n" "${COL_RED}" "${COL_NC}" "${COL_RED}" "${COL_NC}"
|
||||
printf " e.g: export PIHOLE_SELINUX=true\\n"
|
||||
printf " By setting this variable to true you acknowledge there may be issues with Pi-hole during or after the install\\n"
|
||||
printf "\\n %bSELinux Enforcing detected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf "\\n %bSELinux Enforcing detected, exiting installer%b\\n" "${COL_RED}" "${COL_NC}"
|
||||
exit 1
|
||||
elif [[ "${SELINUX_ENFORCING}" -eq 1 ]] && [[ -n "${PIHOLE_SELINUX}" ]]; then
|
||||
printf " %b %bSELinux Enforcing detected%b. PIHOLE_SELINUX env variable set - installer will continue\\n" "${INFO}" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf " %b %bSELinux Enforcing detected%b. PIHOLE_SELINUX env variable set - installer will continue\\n" "${INFO}" "${COL_RED}" "${COL_NC}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1627,9 +1731,9 @@ check_download_exists() {
|
||||
status=$(curl --head --silent "https://ftl.pi-hole.net/${1}" | head -n 1)
|
||||
|
||||
# Check the status code
|
||||
if grep -q "200" <<<"$status"; then
|
||||
if grep -q "200" <<<"${status}"; then
|
||||
return 0
|
||||
elif grep -q "404" <<<"$status"; then
|
||||
elif grep -q "404" <<<"${status}"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -1662,7 +1766,7 @@ get_available_branches() {
|
||||
# Get reachable remote branches, but store STDERR as STDOUT variable
|
||||
output=$({ git ls-remote --heads --quiet | cut -d'/' -f3- -; } 2>&1)
|
||||
# echo status for calling function to capture
|
||||
echo "$output"
|
||||
echo "${output}"
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1695,9 +1799,9 @@ checkout_pull_branch() {
|
||||
oldbranch="$(git symbolic-ref HEAD)"
|
||||
|
||||
str="Switching to branch: '${branch}' from '${oldbranch}'"
|
||||
printf " %b %s" "${INFO}" "$str"
|
||||
printf " %b %s" "${INFO}" "${str}"
|
||||
git checkout "${branch}" --quiet || return 1
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "$str"
|
||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||
# Data in the repositories is public anyway so we can make it readable by everyone (+r to keep executable permission if already set by git)
|
||||
chmod -R a+rX "${directory}"
|
||||
|
||||
@@ -1712,16 +1816,22 @@ clone_or_reset_repos() {
|
||||
# If the user wants to repair/update,
|
||||
if [[ "${repair}" == true ]]; then
|
||||
printf " %b Resetting local repos\\n" "${INFO}"
|
||||
|
||||
# import getFTLConfigValue from utils.sh
|
||||
source "/opt/pihole/utils.sh"
|
||||
# Use the configured Web repo location on repair/update
|
||||
webInterfaceDir=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
||||
|
||||
# Reset the Core repo
|
||||
resetRepo ${PI_HOLE_LOCAL_REPO} ||
|
||||
{
|
||||
printf " %b Unable to reset %s, exiting installer%b\\n" "${COL_LIGHT_RED}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
||||
printf " %b Unable to reset %s, exiting installer%b\\n" "${COL_RED}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
||||
exit 1
|
||||
}
|
||||
# Reset the Web repo
|
||||
resetRepo ${webInterfaceDir} ||
|
||||
{
|
||||
printf " %b Unable to reset %s, exiting installer%b\\n" "${COL_LIGHT_RED}" "${webInterfaceDir}" "${COL_NC}"
|
||||
printf " %b Unable to reset %s, exiting installer%b\\n" "${COL_RED}" "${webInterfaceDir}" "${COL_NC}"
|
||||
exit 1
|
||||
}
|
||||
# Otherwise, a fresh installation is happening
|
||||
@@ -1729,13 +1839,13 @@ clone_or_reset_repos() {
|
||||
# so get git files for Core
|
||||
getGitFiles ${PI_HOLE_LOCAL_REPO} ${piholeGitUrl} ||
|
||||
{
|
||||
printf " %b Unable to clone %s into %s, unable to continue%b\\n" "${COL_LIGHT_RED}" "${piholeGitUrl}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
||||
printf " %b Unable to clone %s into %s, unable to continue%b\\n" "${COL_RED}" "${piholeGitUrl}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
||||
exit 1
|
||||
}
|
||||
# get the Web git files
|
||||
getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl} ||
|
||||
{
|
||||
printf " %b Unable to clone %s into ${webInterfaceDir}, exiting installer%b\\n" "${COL_LIGHT_RED}" "${webInterfaceGitUrl}" "${COL_NC}"
|
||||
printf " %b Unable to clone %s into ${webInterfaceDir}, exiting installer%b\\n" "${COL_RED}" "${webInterfaceGitUrl}" "${COL_NC}"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
@@ -1785,8 +1895,12 @@ FTLinstall() {
|
||||
# Before stopping FTL, we download the macvendor database
|
||||
curl -sSL "https://ftl.pi-hole.net/macvendor.db" -o "${PI_HOLE_CONFIG_DIR}/macvendor.db" || true
|
||||
|
||||
# Stop pihole-FTL service if available
|
||||
stop_service pihole-FTL >/dev/null
|
||||
|
||||
# If the binary already exists in /usr/bin, then we need to stop the service
|
||||
# If the binary does not exist (fresh installs), then we can skip this step.
|
||||
if [[ -f /usr/bin/pihole-FTL ]]; then
|
||||
stop_service pihole-FTL >/dev/null
|
||||
fi
|
||||
|
||||
# Install the new version with the correct permissions
|
||||
install -T -m 0755 "${binary}" /usr/bin/pihole-FTL
|
||||
@@ -1811,7 +1925,7 @@ FTLinstall() {
|
||||
return 1
|
||||
}
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
printf " %b Error: Download of %s/%s failed (checksum error)%b\\n" "${COL_LIGHT_RED}" "${url}" "${binary}" "${COL_NC}"
|
||||
printf " %b Error: Download of %s/%s failed (checksum error)%b\\n" "${COL_RED}" "${url}" "${binary}" "${COL_NC}"
|
||||
|
||||
# Remove temp dir
|
||||
remove_dir "${tempdir}"
|
||||
@@ -1825,7 +1939,7 @@ FTLinstall() {
|
||||
}
|
||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
# The URL could not be found
|
||||
printf " %b Error: URL %s/%s not found%b\\n" "${COL_LIGHT_RED}" "${url}" "${binary}" "${COL_NC}"
|
||||
printf " %b Error: URL %s/%s not found%b\\n" "${COL_RED}" "${url}" "${binary}" "${COL_NC}"
|
||||
|
||||
# Remove temp dir
|
||||
remove_dir "${tempdir}"
|
||||
@@ -1909,9 +2023,9 @@ get_binary_name() {
|
||||
l_binary="pihole-FTL-riscv64"
|
||||
else
|
||||
# Something else - we try to use 32bit executable and warn the user
|
||||
if [[ ! "${machine}" == "i686" ]]; then
|
||||
if [[ "${machine}" != "i686" ]]; then
|
||||
printf "%b %b %s...\\n" "${OVER}" "${CROSS}" "${str}"
|
||||
printf " %b %bNot able to detect architecture (unknown: %s), trying x86 (32bit) executable%b\\n" "${INFO}" "${COL_LIGHT_RED}" "${machine}" "${COL_NC}"
|
||||
printf " %b %bNot able to detect architecture (unknown: %s), trying x86 (32bit) executable%b\\n" "${INFO}" "${COL_RED}" "${machine}" "${COL_NC}"
|
||||
printf " %b Contact Pi-hole Support if you experience issues (e.g: FTL not running)\\n" "${INFO}"
|
||||
else
|
||||
printf "%b %b Detected 32bit (i686) architecture\\n" "${OVER}" "${TICK}"
|
||||
@@ -1943,18 +2057,18 @@ FTLcheckUpdate() {
|
||||
local remoteSha1
|
||||
local localSha1
|
||||
|
||||
if [[ ! "${ftlBranch}" == "master" ]]; then
|
||||
if [[ "${ftlBranch}" != "master" ]]; then
|
||||
# This is not the master branch
|
||||
local path
|
||||
path="${ftlBranch}/${binary}"
|
||||
|
||||
# Check whether or not the binary for this FTL branch actually exists. If not, then there is no update!
|
||||
if ! check_download_exists "$path"; then
|
||||
local status
|
||||
local status
|
||||
if ! check_download_exists "${path}"; then
|
||||
status=$?
|
||||
if [ "${status}" -eq 1 ]; then
|
||||
printf " %b Branch \"%s\" is not available.\\n" "${INFO}" "${ftlBranch}"
|
||||
printf " %b Use %bpihole checkout ftl [branchname]%b to switch to a valid branch.\\n" "${INFO}" "${COL_LIGHT_GREEN}" "${COL_NC}"
|
||||
printf " %b Use %bpihole checkout ftl [branchname]%b to switch to a valid branch.\\n" "${INFO}" "${COL_GREEN}" "${COL_NC}"
|
||||
elif [ "${status}" -eq 2 ]; then
|
||||
printf " %b Unable to download from ftl.pi-hole.net. Please check your Internet connection and try again later.\\n" "${CROSS}"
|
||||
return 3
|
||||
@@ -2040,6 +2154,11 @@ FTLdetect() {
|
||||
|
||||
if FTLcheckUpdate "${1}"; then
|
||||
FTLinstall "${1}" || return 1
|
||||
else
|
||||
case $? in
|
||||
1) :;; # FTL is up-to-date
|
||||
*) exit 1;; # 404 (2), other HTTP or curl error (3), unknown (4)
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -2048,11 +2167,11 @@ make_temporary_log() {
|
||||
TEMPLOG=$(mktemp /tmp/pihole_temp.XXXXXX)
|
||||
# Open handle 3 for templog
|
||||
# https://stackoverflow.com/questions/18460186/writing-outputs-to-log-file-and-console
|
||||
exec 3>"$TEMPLOG"
|
||||
exec 3>"${TEMPLOG}"
|
||||
# Delete templog, but allow for addressing via file handle
|
||||
# This lets us write to the log without having a temporary file on the drive, which
|
||||
# is meant to be a security measure so there is not a lingering file on the drive during the install process
|
||||
rm "$TEMPLOG"
|
||||
rm "${TEMPLOG}"
|
||||
}
|
||||
|
||||
copy_to_install_log() {
|
||||
@@ -2167,7 +2286,7 @@ main() {
|
||||
else
|
||||
# Otherwise, they do not have enough privileges, so let the user know
|
||||
printf " %b %s\\n" "${INFO}" "${str}"
|
||||
printf " %b %bScript called with non-root privileges%b\\n" "${INFO}" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||
printf " %b %bScript called with non-root privileges%b\\n" "${INFO}" "${COL_RED}" "${COL_NC}"
|
||||
printf " The Pi-hole requires elevated privileges to install and run\\n"
|
||||
printf " Please check the installer for any concerns regarding this requirement\\n"
|
||||
printf " Make sure to download this script from a trusted source\\n\\n"
|
||||
@@ -2191,7 +2310,7 @@ main() {
|
||||
# Otherwise, tell the user they need to run the script as root, and bail
|
||||
printf "%b %b Sudo utility check\\n" "${OVER}" "${CROSS}"
|
||||
printf " %b Sudo is needed for the Web Interface to run pihole commands\\n\\n" "${INFO}"
|
||||
printf " %b %bPlease re-run this installer as root${COL_NC}\\n" "${INFO}" "${COL_LIGHT_RED}"
|
||||
printf " %b %bPlease re-run this installer as root${COL_NC}\\n" "${INFO}" "${COL_RED}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -2202,9 +2321,17 @@ main() {
|
||||
# Check for availability of either the "service" or "systemctl" commands
|
||||
check_service_command
|
||||
|
||||
# Check if this is a fresh install or an update/repair
|
||||
check_fresh_install
|
||||
|
||||
# Check for supported package managers so that we may install dependencies
|
||||
package_manager_detect
|
||||
|
||||
# Update package cache only on apt based systems
|
||||
if is_command apt-get; then
|
||||
update_package_cache || exit 1
|
||||
fi
|
||||
|
||||
# Notify user of package availability
|
||||
notify_package_updates_available
|
||||
|
||||
@@ -2217,24 +2344,18 @@ main() {
|
||||
|
||||
# Check if there is a usable FTL binary available on this architecture - do
|
||||
# this early on as FTL is a hard dependency for Pi-hole
|
||||
local funcOutput
|
||||
funcOutput=$(get_binary_name) #Store output of get_binary_name here
|
||||
# Abort early if this processor is not supported (get_binary_name returns empty string)
|
||||
if [[ "${funcOutput}" == "" ]]; then
|
||||
printf " %b Upgrade/install aborted\\n" "${CROSS}" "${DISTRO_NAME}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# in case of an update (can be a v5 -> v6 or v6 -> v6 update) or repair
|
||||
if [[ -f "${PI_HOLE_V6_CONFIG}" ]] || [[ -f "/etc/pihole/setupVars.conf" ]]; then
|
||||
# retain settings
|
||||
fresh_install=false
|
||||
# if it's running unattended,
|
||||
if [[ "${runUnattended}" == true ]]; then
|
||||
printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"
|
||||
# also disable debconf-apt-progress dialogs
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
# Allow the user to skip this check if they are using a self-compiled FTL binary from an unsupported architecture
|
||||
if [ "${skipFTL}" != true ]; then
|
||||
# Get the binary name for the current architecture
|
||||
local funcOutput
|
||||
funcOutput=$(get_binary_name) #Store output of get_binary_name here
|
||||
# Abort early if this processor is not supported (get_binary_name returns empty string)
|
||||
if [[ "${funcOutput}" == "" ]]; then
|
||||
printf " %b Upgrade/install aborted\\n" "${CROSS}" "${DISTRO_NAME}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
printf " %b %b--skipFTL set - skipping architecture check%b\\n" "${INFO}" "${COL_YELLOW}" "${COL_NC}"
|
||||
fi
|
||||
|
||||
if [[ "${fresh_install}" == true ]]; then
|
||||
@@ -2267,13 +2388,18 @@ main() {
|
||||
create_pihole_user
|
||||
|
||||
# Download and install FTL
|
||||
local binary
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL)
|
||||
local theRest
|
||||
theRest="${funcOutput%pihole-FTL*}" # Print the rest of get_binary_name's output to display (cut out from first instance of "pihole-FTL")
|
||||
if ! FTLdetect "${binary}" "${theRest}"; then
|
||||
printf " %b FTL Engine not installed\\n" "${CROSS}"
|
||||
exit 1
|
||||
# Allow the user to skip this check if they are using a self-compiled FTL binary from an unsupported architecture
|
||||
if [ "${skipFTL}" != true ]; then
|
||||
local binary
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL)
|
||||
local theRest
|
||||
theRest="${funcOutput%pihole-FTL*}" # Print the rest of get_binary_name's output to display (cut out from first instance of "pihole-FTL")
|
||||
if ! FTLdetect "${binary}" "${theRest}"; then
|
||||
printf " %b FTL Engine not installed\\n" "${CROSS}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
printf " %b %b--skipFTL set - skipping FTL binary installation%b\\n" "${INFO}" "${COL_YELLOW}" "${COL_NC}"
|
||||
fi
|
||||
|
||||
# Install and log everything to a file
|
||||
@@ -2337,7 +2463,7 @@ main() {
|
||||
if [ -n "${PIHOLE_DNS_1}" ]; then
|
||||
local string="\"${PIHOLE_DNS_1}\""
|
||||
[ -n "${PIHOLE_DNS_2}" ] && string+=", \"${PIHOLE_DNS_2}\""
|
||||
setFTLConfigValue "dns.upstreams" "[ $string ]"
|
||||
setFTLConfigValue "dns.upstreams" "[ ${string} ]"
|
||||
fi
|
||||
|
||||
if [ -n "${QUERY_LOGGING}" ]; then
|
||||
@@ -2376,8 +2502,10 @@ main() {
|
||||
printf " %b If you have not done so already, the above IP should be set to static.\\n" "${INFO}"
|
||||
|
||||
printf " %b View the web interface at http://pi.hole:${WEBPORT}/admin or http://%s/admin\\n\\n" "${INFO}" "${IPV4_ADDRESS%/*}:${WEBPORT}"
|
||||
printf " %b Web Interface password: %b%s%b\\n" "${INFO}" "${COL_LIGHT_GREEN}" "${pw}" "${COL_NC}"
|
||||
printf " %b Web Interface password: %b%s%b\\n" "${INFO}" "${COL_GREEN}" "${pw}" "${COL_NC}"
|
||||
printf " %b This can be changed using 'pihole setpassword'\\n\\n" "${INFO}"
|
||||
printf " %b To allow your user to use all CLI functions without authentication, refer to\\n" "${INFO}"
|
||||
printf " our documentation at: https://docs.pi-hole.net/main/post-install/\\n\\n"
|
||||
|
||||
# Final dialog message to the user
|
||||
dialog --no-shadow --keep-tite \
|
||||
@@ -2386,7 +2514,11 @@ main() {
|
||||
\\n\\nIPv4: ${IPV4_ADDRESS%/*}\
|
||||
\\nIPv6: ${IPV6_ADDRESS:-"Not Configured"}\
|
||||
\\nIf you have not done so already, the above IP should be set to static.\
|
||||
\\nView the web interface at http://pi.hole/admin:${WEBPORT} or http://${IPV4_ADDRESS%/*}:${WEBPORT}/admin\\n\\nYour Admin Webpage login password is ${pw}" "${r}" "${c}"
|
||||
\\nView the web interface at http://pi.hole:${WEBPORT}/admin or http://${IPV4_ADDRESS%/*}:${WEBPORT}/admin\\n\\nYour Admin Webpage login password is ${pw}\
|
||||
\\n
|
||||
\\n
|
||||
\\nTo allow your user to use all CLI functions without authentication,\
|
||||
\\nrefer to https://docs.pi-hole.net/main/post-install/" "${r}" "${c}"
|
||||
|
||||
INSTALL_TYPE="Installation"
|
||||
else
|
||||
@@ -2395,7 +2527,7 @@ main() {
|
||||
|
||||
# Display where the log file is
|
||||
printf "\\n %b The install log is located at: %s\\n" "${INFO}" "${installLogLoc}"
|
||||
printf " %b %b%s complete! %b\\n" "${TICK}" "${COL_LIGHT_GREEN}" "${INSTALL_TYPE}" "${COL_NC}"
|
||||
printf " %b %b%s complete! %b\\n" "${TICK}" "${COL_GREEN}" "${INSTALL_TYPE}" "${COL_NC}"
|
||||
|
||||
if [[ "${INSTALL_TYPE}" == "Update" ]]; then
|
||||
printf "\\n"
|
||||
|
||||
Reference in New Issue
Block a user