mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-03-03 15:28:28 +00:00
This is all whitespace changes - the result of pressing alt+shift+f on all bash scripts. Utilising the vscode extension shell-format
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
821c953216
commit
c1936a52b8
11 changed files with 468 additions and 419 deletions
|
@ -10,14 +10,12 @@
|
|||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
# The basic usage steps are
|
||||
# 1) Test Availability of the API
|
||||
# 2) Try to authenticate (read password if needed)
|
||||
# 3) Get the data from the API endpoint
|
||||
# 4) Delete the session
|
||||
|
||||
|
||||
TestAPIAvailability() {
|
||||
|
||||
# as we are running locally, we can get the port value from FTL directly
|
||||
|
@ -115,14 +113,13 @@ LoginAPI() {
|
|||
echo "API Authentication: CLI password not available"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# If this did not work, ask the user for the password
|
||||
while [ "${validSession}" = false ] || [ -z "${validSession}" ]; do
|
||||
echo "Authentication failed. Please enter your Pi-hole password"
|
||||
|
||||
# secretly read the password
|
||||
secretRead; printf '\n'
|
||||
secretRead
|
||||
printf '\n'
|
||||
|
||||
# Try to authenticate again
|
||||
Authentication "${1}"
|
||||
|
@ -160,7 +157,7 @@ LogoutAPI() {
|
|||
case "${deleteResponse}" in
|
||||
"401") echo "Logout attempt without a valid session. Unauthorized!" ;;
|
||||
"204") if [ "${1}" = "verbose" ]; then echo "API Logout: ${COL_GREEN}Success${COL_NC} (session deleted)"; fi ;;
|
||||
esac;
|
||||
esac
|
||||
elif [ "${1}" = "verbose" ]; then
|
||||
echo "API Logout: ${COL_GREEN}Success${COL_NC} (no valid session)"
|
||||
fi
|
||||
|
@ -216,14 +213,12 @@ secretRead() {
|
|||
# `-s` option (suppressing the input) or
|
||||
# `-n` option (reading n chars)
|
||||
|
||||
|
||||
# This workaround changes the terminal characteristics to not echo input and later resets this option
|
||||
# credits https://stackoverflow.com/a/4316765
|
||||
# showing asterisk instead of password
|
||||
# https://stackoverflow.com/a/24600839
|
||||
# https://unix.stackexchange.com/a/464963
|
||||
|
||||
|
||||
# Save current terminal settings (needed for later restore after password prompt)
|
||||
stty_orig=$(stty -g)
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ RemoveDomain() {
|
|||
|
||||
# If there is an .error object in the returned data, display it
|
||||
local error
|
||||
error=$(jq --compact-output <<< "${data}" '.error')
|
||||
error=$(jq --compact-output '.error' <<<"${data}")
|
||||
if [[ $error != "null" && $error != "" ]]; then
|
||||
echo -e " ${CROSS} Failed to remove domain(s):"
|
||||
echo -e " $(jq <<<"${data}" '.error')"
|
||||
|
@ -198,17 +198,46 @@ GetComment() {
|
|||
|
||||
while (("$#")); do
|
||||
case "${1}" in
|
||||
"allow" | "allowlist" ) kindId="exact"; typeId="allow"; abbrv="allow";;
|
||||
"deny" | "denylist" ) kindId="exact"; typeId="deny"; abbrv="deny";;
|
||||
"--allow-regex" | "allow-regex" ) kindId="regex"; typeId="allow"; abbrv="--allow-regex";;
|
||||
"--allow-wild" | "allow-wild" ) kindId="regex"; typeId="allow"; wildcard=true; abbrv="--allow-wild";;
|
||||
"--regex" | "regex" ) kindId="regex"; typeId="deny"; abbrv="--regex";;
|
||||
"--wild" | "wildcard" ) kindId="regex"; typeId="deny"; wildcard=true; abbrv="--wild";;
|
||||
"allow" | "allowlist")
|
||||
kindId="exact"
|
||||
typeId="allow"
|
||||
abbrv="allow"
|
||||
;;
|
||||
"deny" | "denylist")
|
||||
kindId="exact"
|
||||
typeId="deny"
|
||||
abbrv="deny"
|
||||
;;
|
||||
"--allow-regex" | "allow-regex")
|
||||
kindId="regex"
|
||||
typeId="allow"
|
||||
abbrv="--allow-regex"
|
||||
;;
|
||||
"--allow-wild" | "allow-wild")
|
||||
kindId="regex"
|
||||
typeId="allow"
|
||||
wildcard=true
|
||||
abbrv="--allow-wild"
|
||||
;;
|
||||
"--regex" | "regex")
|
||||
kindId="regex"
|
||||
typeId="deny"
|
||||
abbrv="--regex"
|
||||
;;
|
||||
"--wild" | "wildcard")
|
||||
kindId="regex"
|
||||
typeId="deny"
|
||||
wildcard=true
|
||||
abbrv="--wild"
|
||||
;;
|
||||
"-d" | "remove" | "delete") addmode=false ;;
|
||||
"-q" | "--quiet") verbose=false ;;
|
||||
"-h" | "--help") helpFunc ;;
|
||||
"-l" | "--list") Displaylist ;;
|
||||
"--comment" ) GetComment "${2}"; shift;;
|
||||
"--comment")
|
||||
GetComment "${2}"
|
||||
shift
|
||||
;;
|
||||
*) CreateDomainList "${1}" ;;
|
||||
esac
|
||||
shift
|
||||
|
|
|
@ -56,13 +56,13 @@ checkout() {
|
|||
if ! is_repo "${PI_HOLE_FILES_DIR}"; then
|
||||
echo -e " ${COL_LIGHT_RED}Error: Core Pi-hole repo is missing from system!"
|
||||
echo -e " Please re-run install script from https://github.com/pi-hole/pi-hole${COL_NC}"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! is_repo "${webInterfaceDir}"; then
|
||||
echo -e " ${COL_LIGHT_RED}Error: Web Admin repo is missing from system!"
|
||||
echo -e " Please re-run install script from https://github.com/pi-hole/pi-hole${COL_NC}"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${1}" ]]; then
|
||||
|
@ -80,10 +80,16 @@ checkout() {
|
|||
echo -e " ${INFO} Shortcut \"${COL_YELLOW}dev${COL_NC}\" detected - checking out development branches..."
|
||||
echo ""
|
||||
echo -e " ${INFO} Pi-hole Core"
|
||||
fetch_checkout_pull_branch "${PI_HOLE_FILES_DIR}" "development" || { echo " ${CROSS} Unable to pull Core development branch"; exit 1; }
|
||||
fetch_checkout_pull_branch "${PI_HOLE_FILES_DIR}" "development" || {
|
||||
echo " ${CROSS} Unable to pull Core development branch"
|
||||
exit 1
|
||||
}
|
||||
echo ""
|
||||
echo -e " ${INFO} Web interface"
|
||||
fetch_checkout_pull_branch "${webInterfaceDir}" "development" || { echo " ${CROSS} Unable to pull Web development branch"; exit 1; }
|
||||
fetch_checkout_pull_branch "${webInterfaceDir}" "development" || {
|
||||
echo " ${CROSS} Unable to pull Web development branch"
|
||||
exit 1
|
||||
}
|
||||
#echo -e " ${TICK} Pi-hole Core"
|
||||
|
||||
local path
|
||||
|
@ -94,9 +100,15 @@ checkout() {
|
|||
# Shortcut to check out master branches
|
||||
echo -e " ${INFO} Shortcut \"${COL_YELLOW}master${COL_NC}\" detected - checking out master branches..."
|
||||
echo -e " ${INFO} Pi-hole core"
|
||||
fetch_checkout_pull_branch "${PI_HOLE_FILES_DIR}" "master" || { echo " ${CROSS} Unable to pull Core master branch"; exit 1; }
|
||||
fetch_checkout_pull_branch "${PI_HOLE_FILES_DIR}" "master" || {
|
||||
echo " ${CROSS} Unable to pull Core master branch"
|
||||
exit 1
|
||||
}
|
||||
echo -e " ${INFO} Web interface"
|
||||
fetch_checkout_pull_branch "${webInterfaceDir}" "master" || { echo " ${CROSS} Unable to pull Web master branch"; exit 1; }
|
||||
fetch_checkout_pull_branch "${webInterfaceDir}" "master" || {
|
||||
echo " ${CROSS} Unable to pull Web master branch"
|
||||
exit 1
|
||||
}
|
||||
#echo -e " ${TICK} Web Interface"
|
||||
local path
|
||||
path="master/${binary}"
|
||||
|
|
|
@ -196,16 +196,16 @@ compare_local_version_to_git_version() {
|
|||
# If the pihole git directory exists,
|
||||
if [[ -d "${git_dir}" ]]; then
|
||||
# move into it
|
||||
cd "${git_dir}" || \
|
||||
cd "${git_dir}" ||
|
||||
# If not, show an error
|
||||
log_write "${COL_RED}Could not cd into ${git_dir}$COL_NC"
|
||||
if git status &>/dev/null; then
|
||||
# The current version the user is on
|
||||
local local_version
|
||||
local_version=$(git describe --tags --abbrev=0 2> /dev/null);
|
||||
local_version=$(git describe --tags --abbrev=0 2>/dev/null)
|
||||
# What branch they are on
|
||||
local local_branch
|
||||
local_branch=$(git rev-parse --abbrev-ref HEAD);
|
||||
local_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
# The commit they are on
|
||||
local local_commit
|
||||
local_commit=$(git describe --long --dirty --tags --always)
|
||||
|
@ -269,7 +269,6 @@ check_ftl_version() {
|
|||
FTL_BRANCH=$(pihole-FTL branch)
|
||||
FTL_COMMIT=$(pihole-FTL --hash)
|
||||
|
||||
|
||||
log_write "${TICK} Version: ${FTL_VERSION}"
|
||||
|
||||
# If they use the master branch, they are on the stable codebase
|
||||
|
@ -305,7 +304,10 @@ os_check() {
|
|||
detected_os=$(grep "\bID\b" /etc/os-release | cut -d '=' -f2 | tr -d '"')
|
||||
detected_version=$(grep VERSION_ID /etc/os-release | cut -d '=' -f2 | tr -d '"')
|
||||
|
||||
cmdResult="$(dig -4 +short -t txt "${remote_os_domain}" @ns1.pi-hole.net 2>&1; echo $?)"
|
||||
cmdResult="$(
|
||||
dig -4 +short -t txt "${remote_os_domain}" @ns1.pi-hole.net 2>&1
|
||||
echo $?
|
||||
)"
|
||||
#Get the return code of the previous command (last line)
|
||||
digReturnCode="${cmdResult##*$'\n'}"
|
||||
|
||||
|
@ -319,7 +321,10 @@ os_check() {
|
|||
log_write "${CROSS} dig response: ${response}"
|
||||
log_write "${INFO} Retrying via IPv6"
|
||||
|
||||
cmdResult="$(dig -6 +short -t txt "${remote_os_domain}" @ns1.pi-hole.net 2>&1; echo $?)"
|
||||
cmdResult="$(
|
||||
dig -6 +short -t txt "${remote_os_domain}" @ns1.pi-hole.net 2>&1
|
||||
echo $?
|
||||
)"
|
||||
#Get the return code of the previous command (last line)
|
||||
digReturnCode="${cmdResult##*$'\n'}"
|
||||
|
||||
|
@ -333,16 +338,14 @@ os_check() {
|
|||
log_write "${CROSS} Error: ${COL_RED}dig command failed - Unable to check OS${COL_NC}"
|
||||
else
|
||||
IFS=" " read -r -a supportedOS < <(echo "${response}" | tr -d '"')
|
||||
for distro_and_versions in "${supportedOS[@]}"
|
||||
do
|
||||
for distro_and_versions in "${supportedOS[@]}"; do
|
||||
distro_part="${distro_and_versions%%=*}"
|
||||
versions_part="${distro_and_versions##*=}"
|
||||
|
||||
if [[ "${detected_os^^}" =~ ${distro_part^^} ]]; then
|
||||
valid_os=true
|
||||
IFS="," read -r -a supportedVer <<<"${versions_part}"
|
||||
for version in "${supportedVer[@]}"
|
||||
do
|
||||
for version in "${supportedVer[@]}"; do
|
||||
if [[ "${detected_version}" =~ $version ]]; then
|
||||
valid_version=true
|
||||
break
|
||||
|
@ -409,7 +412,7 @@ check_selinux() {
|
|||
log_write "${CROSS} ${COL_RED}Default SELinux: $DEFAULT_SELINUX${COL_NC}"
|
||||
;;
|
||||
*) # 'permissive' and 'disabled'
|
||||
log_write "${TICK} ${COL_GREEN}Default SELinux: $DEFAULT_SELINUX${COL_NC}";
|
||||
log_write "${TICK} ${COL_GREEN}Default SELinux: $DEFAULT_SELINUX${COL_NC}"
|
||||
;;
|
||||
esac
|
||||
# Check the current state of SELinux
|
||||
|
@ -419,11 +422,11 @@ check_selinux() {
|
|||
log_write "${CROSS} ${COL_RED}Current SELinux: $CURRENT_SELINUX${COL_NC}"
|
||||
;;
|
||||
*) # 'permissive' and 'disabled'
|
||||
log_write "${TICK} ${COL_GREEN}Current SELinux: $CURRENT_SELINUX${COL_NC}";
|
||||
log_write "${TICK} ${COL_GREEN}Current SELinux: $CURRENT_SELINUX${COL_NC}"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
log_write "${INFO} ${COL_GREEN}SELinux not detected${COL_NC}";
|
||||
log_write "${INFO} ${COL_GREEN}SELinux not detected${COL_NC}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -436,7 +439,7 @@ check_firewalld() {
|
|||
# get its status via systemctl
|
||||
local firewalld_status
|
||||
firewalld_status=$(systemctl is-active firewalld)
|
||||
log_write "${INFO} ${COL_GREEN}Firewalld service ${firewalld_status}${COL_NC}";
|
||||
log_write "${INFO} ${COL_GREEN}Firewalld service ${firewalld_status}${COL_NC}"
|
||||
if [ "${firewalld_status}" == "active" ]; then
|
||||
# test common required service ports
|
||||
local firewalld_enabled_services
|
||||
|
@ -444,7 +447,7 @@ check_firewalld() {
|
|||
local firewalld_expected_services=("http" "dns" "dhcp" "dhcpv6")
|
||||
for i in "${firewalld_expected_services[@]}"; do
|
||||
if [[ "${firewalld_enabled_services}" =~ ${i} ]]; then
|
||||
log_write "${TICK} ${COL_GREEN} Allow Service: ${i}${COL_NC}";
|
||||
log_write "${TICK} ${COL_GREEN} Allow Service: ${i}${COL_NC}"
|
||||
else
|
||||
log_write "${CROSS} ${COL_RED} Allow Service: ${i}${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
|
||||
fi
|
||||
|
@ -453,12 +456,12 @@ check_firewalld() {
|
|||
local firewalld_zones
|
||||
firewalld_zones=$(firewall-cmd --get-zones)
|
||||
if [[ "${firewalld_zones}" =~ "ftl" ]]; then
|
||||
log_write "${TICK} ${COL_GREEN}FTL Custom Zone Detected${COL_NC}";
|
||||
log_write "${TICK} ${COL_GREEN}FTL Custom Zone Detected${COL_NC}"
|
||||
# check FTL custom zone interface: lo
|
||||
local firewalld_ftl_zone_interfaces
|
||||
firewalld_ftl_zone_interfaces=$(firewall-cmd --zone=ftl --list-interfaces)
|
||||
if [[ "${firewalld_ftl_zone_interfaces}" =~ "lo" ]]; then
|
||||
log_write "${TICK} ${COL_GREEN} Local Interface Detected${COL_NC}";
|
||||
log_write "${TICK} ${COL_GREEN} Local Interface Detected${COL_NC}"
|
||||
else
|
||||
log_write "${CROSS} ${COL_RED} Local Interface Not Detected${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
|
||||
fi
|
||||
|
@ -466,7 +469,7 @@ check_firewalld() {
|
|||
local firewalld_ftl_zone_ports
|
||||
firewalld_ftl_zone_ports=$(firewall-cmd --zone=ftl --list-ports)
|
||||
if [[ "${firewalld_ftl_zone_ports}" =~ "4711/tcp" ]]; then
|
||||
log_write "${TICK} ${COL_GREEN} FTL Port 4711/tcp Detected${COL_NC}";
|
||||
log_write "${TICK} ${COL_GREEN} FTL Port 4711/tcp Detected${COL_NC}"
|
||||
else
|
||||
log_write "${CROSS} ${COL_RED} FTL Port 4711/tcp Not Detected${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
|
||||
fi
|
||||
|
@ -475,7 +478,7 @@ check_firewalld() {
|
|||
fi
|
||||
fi
|
||||
else
|
||||
log_write "${TICK} ${COL_GREEN}Firewalld service not detected${COL_NC}";
|
||||
log_write "${TICK} ${COL_GREEN}Firewalld service not detected${COL_NC}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -679,7 +682,7 @@ check_required_ports() {
|
|||
compare_port_to_service_assigned "${ftl}" "${service_name}" "${protocol_type}:${port_number}"
|
||||
else
|
||||
# If it's not a default port that Pi-hole needs, just print it out for the user to see
|
||||
log_write " ${protocol_type}:${port_number} is in use by ${service_name:=<unknown>}";
|
||||
log_write " ${protocol_type}:${port_number} is in use by ${service_name:=<unknown>}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -1002,10 +1005,10 @@ list_files_in_dir() {
|
|||
if [[ -d "${dir_to_parse}/${each_file}" ]]; then
|
||||
# If it's a directory, do nothing
|
||||
:
|
||||
elif [[ "${dir_to_parse}/${each_file}" == "${PIHOLE_DEBUG_LOG}" ]] || \
|
||||
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_RAW_BLOCKLIST_FILES}" ]] || \
|
||||
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_INSTALL_LOG_FILE}" ]] || \
|
||||
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_LOG}" ]] || \
|
||||
elif [[ "${dir_to_parse}/${each_file}" == "${PIHOLE_DEBUG_LOG}" ]] ||
|
||||
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_RAW_BLOCKLIST_FILES}" ]] ||
|
||||
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_INSTALL_LOG_FILE}" ]] ||
|
||||
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_LOG}" ]] ||
|
||||
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_LOG_GZIPS}" ]]; then
|
||||
:
|
||||
elif [[ "${dir_to_parse}" == "${DNSMASQ_D_DIRECTORY}" ]]; then
|
||||
|
@ -1021,13 +1024,15 @@ list_files_in_dir() {
|
|||
# Check if the file we want to view has a limit (because sometimes we just need a little bit of info from the file, not the entire thing)
|
||||
case "${dir_to_parse}/${each_file}" in
|
||||
# If it's Web server log, give the first and last 25 lines
|
||||
"${PIHOLE_WEBSERVER_LOG}") head_tail_log "${dir_to_parse}/${each_file}" 25
|
||||
"${PIHOLE_WEBSERVER_LOG}")
|
||||
head_tail_log "${dir_to_parse}/${each_file}" 25
|
||||
;;
|
||||
# Same for the FTL log
|
||||
"${PIHOLE_FTL_LOG}") head_tail_log "${dir_to_parse}/${each_file}" 35
|
||||
"${PIHOLE_FTL_LOG}")
|
||||
head_tail_log "${dir_to_parse}/${each_file}" 35
|
||||
;;
|
||||
# parse the file into an array in case we ever need to analyze it line-by-line
|
||||
*) make_array_from_file "${dir_to_parse}/${each_file}";
|
||||
*) make_array_from_file "${dir_to_parse}/${each_file}" ;;
|
||||
esac
|
||||
else
|
||||
# Otherwise, do nothing since it's not a file needed for Pi-hole so we don't care about it
|
||||
|
@ -1096,12 +1101,12 @@ show_db_entries() {
|
|||
OLD_IFS="$IFS"
|
||||
IFS=$'\r\n'
|
||||
local entries=()
|
||||
mapfile -t entries < <(\
|
||||
mapfile -t entries < <(
|
||||
pihole-FTL sqlite3 -ni "${PIHOLE_GRAVITY_DB_FILE}" \
|
||||
-cmd ".headers on" \
|
||||
-cmd ".mode column" \
|
||||
-cmd ".width ${widths}" \
|
||||
"${query}"\
|
||||
"${query}"
|
||||
)
|
||||
|
||||
for line in "${entries[@]}"; do
|
||||
|
@ -1121,12 +1126,12 @@ show_FTL_db_entries() {
|
|||
OLD_IFS="$IFS"
|
||||
IFS=$'\r\n'
|
||||
local entries=()
|
||||
mapfile -t entries < <(\
|
||||
mapfile -t entries < <(
|
||||
pihole-FTL sqlite3 -ni "${PIHOLE_FTL_DB_FILE}" \
|
||||
-cmd ".headers on" \
|
||||
-cmd ".mode column" \
|
||||
-cmd ".width ${widths}" \
|
||||
"${query}"\
|
||||
"${query}"
|
||||
)
|
||||
|
||||
for line in "${entries[@]}"; do
|
||||
|
@ -1142,7 +1147,10 @@ check_dhcp_servers() {
|
|||
OLD_IFS="$IFS"
|
||||
IFS=$'\n'
|
||||
local entries=()
|
||||
mapfile -t entries < <(pihole-FTL dhcp-discover & spinner)
|
||||
mapfile -t entries < <(
|
||||
pihole-FTL dhcp-discover &
|
||||
spinner
|
||||
)
|
||||
|
||||
for line in "${entries[@]}"; do
|
||||
log_write " ${line}"
|
||||
|
@ -1221,14 +1229,19 @@ database_integrity_check(){
|
|||
local database="${1}"
|
||||
|
||||
log_write "${INFO} Checking integrity of ${database} ... (this can take several minutes)"
|
||||
result="$(pihole-FTL sqlite3 -ni "${database}" "PRAGMA integrity_check" 2>&1 & spinner)"
|
||||
result="$(
|
||||
pihole-FTL sqlite3 -ni "${database}" "PRAGMA integrity_check" 2>&1 &
|
||||
spinner
|
||||
)"
|
||||
if [[ ${result} = "ok" ]]; then
|
||||
log_write "${TICK} Integrity of ${database} intact"
|
||||
|
||||
|
||||
log_write "${INFO} Checking foreign key constraints of ${database} ... (this can take several minutes)"
|
||||
unset result
|
||||
result="$(pihole-FTL sqlite3 -ni "${database}" -cmd ".headers on" -cmd ".mode column" "PRAGMA foreign_key_check" 2>&1 & spinner)"
|
||||
result="$(
|
||||
pihole-FTL sqlite3 -ni "${database}" -cmd ".headers on" -cmd ".mode column" "PRAGMA foreign_key_check" 2>&1 &
|
||||
spinner
|
||||
)"
|
||||
if [[ -z ${result} ]]; then
|
||||
log_write "${TICK} No foreign key errors in ${database}"
|
||||
else
|
||||
|
@ -1318,7 +1331,6 @@ curl_to_tricorder() {
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
upload_to_tricorder() {
|
||||
local username="pihole"
|
||||
# Set the permissions and owner
|
||||
|
@ -1350,7 +1362,10 @@ upload_to_tricorder() {
|
|||
# If they say yes, run our function for uploading the log
|
||||
[yY][eE][sS] | [yY]) curl_to_tricorder ;;
|
||||
# If they choose no, just exit out of the script
|
||||
*) log_write " * Log will ${COL_GREEN}NOT${COL_NC} be uploaded to tricorder.\\n * A local copy of the debug log can be found at: ${COL_CYAN}${PIHOLE_DEBUG_LOG}${COL_NC}\\n";exit;
|
||||
*)
|
||||
log_write " * Log will ${COL_GREEN}NOT${COL_NC} be uploaded to tricorder.\\n * A local copy of the debug log can be found at: ${COL_CYAN}${PIHOLE_DEBUG_LOG}${COL_NC}\\n"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Check if tricorder.pi-hole.net is reachable and provide token
|
||||
|
|
|
@ -119,4 +119,3 @@ else
|
|||
echo -e "${OVER} ${TICK} Deleted ${deleted} queries from long-term query database"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -69,7 +69,6 @@ GitCheckUpdateAvail() {
|
|||
REMOTE="$(git rev-parse "@{upstream}")"
|
||||
fi
|
||||
|
||||
|
||||
if [[ "${#LOCAL}" == 0 ]]; then
|
||||
echo -e "\\n ${COL_LIGHT_RED}Error: Local revision could not be obtained, please contact Pi-hole Support"
|
||||
echo -e " Additional debugging output:${COL_NC}"
|
||||
|
@ -119,7 +118,7 @@ main() {
|
|||
if ! is_repo "${PI_HOLE_FILES_DIR}"; then
|
||||
echo -e "\\n ${COL_LIGHT_RED}Error: Core Pi-hole repo is missing from system!"
|
||||
echo -e " Please re-run install script from https://pi-hole.net${COL_NC}"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e " ${INFO} Checking for updates..."
|
||||
|
@ -135,7 +134,7 @@ main() {
|
|||
if ! is_repo "${ADMIN_INTERFACE_DIR}"; then
|
||||
echo -e "\\n ${COL_LIGHT_RED}Error: Web Admin repo is missing from system!"
|
||||
echo -e " Please re-run install script from https://pi-hole.net${COL_NC}"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if GitCheckUpdateAvail "${ADMIN_INTERFACE_DIR}"; then
|
||||
|
@ -169,6 +168,7 @@ main() {
|
|||
*)
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_LIGHT_RED}Something has gone wrong, contact support${COL_NC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
FTL_update=false
|
||||
fi
|
||||
|
@ -218,7 +218,7 @@ main() {
|
|||
fi
|
||||
|
||||
if [[ "${FTL_update}" == true || "${core_update}" == true ]]; then
|
||||
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --repair --unattended || \
|
||||
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --repair --unattended ||
|
||||
echo -e "${basicError}" && exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -225,7 +225,8 @@ os_check_dig(){
|
|||
local nameserver="$3"
|
||||
local response
|
||||
|
||||
response="$(dig -"${protocol}" +short -t txt "${domain}" "${nameserver}" 2>&1
|
||||
response="$(
|
||||
dig -"${protocol}" +short -t txt "${domain}" "${nameserver}" 2>&1
|
||||
echo $?
|
||||
)"
|
||||
echo "${response}"
|
||||
|
@ -2419,7 +2420,6 @@ main() {
|
|||
# Download or reset the appropriate git repos depending on the 'repair' flag
|
||||
clone_or_reset_repos
|
||||
|
||||
|
||||
# Create the pihole user
|
||||
create_pihole_user
|
||||
|
||||
|
@ -2448,11 +2448,9 @@ main() {
|
|||
# Copy the temp log file into final log location for storage
|
||||
copy_to_install_log
|
||||
|
||||
|
||||
# Migrate existing install to v6.0
|
||||
migrate_dnsmasq_configs
|
||||
|
||||
|
||||
# Check for and disable systemd-resolved-DNSStubListener before reloading resolved
|
||||
# DNSStubListener needs to remain in place for installer to download needed files,
|
||||
# so this change needs to be made after installation is complete,
|
||||
|
|
|
@ -14,7 +14,10 @@ while true; do
|
|||
read -rp " ${QST} Are you sure you would like to remove ${COL_WHITE}Pi-hole${COL_NC}? [y/N] " answer
|
||||
case ${answer} in
|
||||
[Yy]*) break ;;
|
||||
* ) echo -e "${OVER} ${COL_LIGHT_GREEN}Uninstall has been canceled${COL_NC}"; exit 0;;
|
||||
*)
|
||||
echo -e "${OVER} ${COL_LIGHT_GREEN}Uninstall has been canceled${COL_NC}"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -42,13 +45,12 @@ source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
|||
# package_manager_detect() sourced from basic-install.sh
|
||||
package_manager_detect
|
||||
|
||||
|
||||
removeMetaPackage() {
|
||||
# Purge Pi-hole meta package
|
||||
echo ""
|
||||
echo -ne " ${INFO} Removing Pi-hole meta package...";
|
||||
eval "${SUDO}" "${PKG_REMOVE}" "pihole-meta" &> /dev/null;
|
||||
echo -e "${OVER} ${INFO} Removed Pi-hole meta package";
|
||||
echo -ne " ${INFO} Removing Pi-hole meta package..."
|
||||
eval "${SUDO}" "${PKG_REMOVE}" "pihole-meta" &>/dev/null
|
||||
echo -e "${OVER} ${INFO} Removed Pi-hole meta package"
|
||||
|
||||
}
|
||||
|
||||
|
@ -57,7 +59,6 @@ removePiholeFiles() {
|
|||
echo -ne " ${INFO} Removing Web Interface..."
|
||||
${SUDO} rm -rf /var/www/html/admin &>/dev/null
|
||||
|
||||
|
||||
# If the web directory is empty after removing these files, then the parent html directory can be removed.
|
||||
if [ -d "/var/www/html" ]; then
|
||||
if [[ ! "$(ls -A /var/www/html)" ]]; then
|
||||
|
|
Loading…
Add table
Reference in a new issue