mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Merge branch 'development' into uninstall_compat_check
# Conflicts: # automated install/uninstall.sh
This commit is contained in:
commit
34f5db9ed4
6 changed files with 49 additions and 44 deletions
|
@ -493,6 +493,13 @@ parse_setup_vars() {
|
|||
fi
|
||||
}
|
||||
|
||||
parse_locale() {
|
||||
local pihole_locale
|
||||
echo_current_diagnostic "Locale"
|
||||
pihole_locale="$(locale)"
|
||||
parse_file "${pihole_locale}"
|
||||
}
|
||||
|
||||
does_ip_match_setup_vars() {
|
||||
# Check for IPv4 or 6
|
||||
local protocol="${1}"
|
||||
|
@ -652,15 +659,22 @@ check_required_ports() {
|
|||
# Sort the addresses and remove duplicates
|
||||
while IFS= read -r line; do
|
||||
ports_in_use+=( "$line" )
|
||||
done < <( lsof -i -P -n | awk -F' ' '/LISTEN/ {print $9, $1}' | sort -n | uniq | cut -d':' -f2 )
|
||||
done < <( lsof -iTCP -sTCP:LISTEN -P -n +c 10 )
|
||||
|
||||
# Now that we have the values stored,
|
||||
for i in "${!ports_in_use[@]}"; do
|
||||
# loop through them and assign some local variables
|
||||
local port_number
|
||||
port_number="$(echo "${ports_in_use[$i]}" | awk '{print $1}')"
|
||||
local service_name
|
||||
service_name=$(echo "${ports_in_use[$i]}" | awk '{print $2}')
|
||||
service_name=$(echo "${ports_in_use[$i]}" | awk '{print $1}')
|
||||
local protocol_type
|
||||
protocol_type=$(echo "${ports_in_use[$i]}" | awk '{print $5}')
|
||||
local port_number
|
||||
port_number="$(echo "${ports_in_use[$i]}" | awk '{print $9}')"
|
||||
|
||||
# Skip the line if it's the titles of the columns the lsof command produces
|
||||
if [[ "${service_name}" == COMMAND ]]; then
|
||||
continue
|
||||
fi
|
||||
# Use a case statement to determine if the right services are using the right ports
|
||||
case "${port_number}" in
|
||||
53) compare_port_to_service_assigned "${resolver}"
|
||||
|
@ -670,7 +684,7 @@ check_required_ports() {
|
|||
4711) compare_port_to_service_assigned "${ftl}"
|
||||
;;
|
||||
# If it's not a default port that Pi-hole needs, just print it out for the user to see
|
||||
*) log_write "[${port_number}] is in use by ${service_name}";
|
||||
*) log_write "${port_number} ${service_name} (${protocol_type})";
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -879,8 +893,11 @@ parse_file() {
|
|||
# Put the current Internal Field Separator into another variable so it can be restored later
|
||||
OLD_IFS="$IFS"
|
||||
# Get the lines that are in the file(s) and store them in an array for parsing later
|
||||
if [[ -f "$filename" ]]; then
|
||||
IFS=$'\r\n' command eval 'file_info=( $(cat "${filename}") )'
|
||||
|
||||
else
|
||||
read -a file_info <<< $filename
|
||||
fi
|
||||
# Set a named variable for better readability
|
||||
local file_lines
|
||||
# For each line in the file,
|
||||
|
@ -1193,6 +1210,7 @@ parse_setup_vars
|
|||
check_x_headers
|
||||
analyze_gravity_list
|
||||
show_content_of_pihole_files
|
||||
parse_locale
|
||||
analyze_pihole_log
|
||||
copy_to_debug_log
|
||||
upload_to_tricorder
|
||||
|
|
|
@ -149,8 +149,12 @@ ProcessDNSSettings() {
|
|||
let COUNTER=COUNTER+1
|
||||
done
|
||||
|
||||
# The option LOCAL_DNS_PORT is deprecated
|
||||
# We apply it once more, and then convert it into the current format
|
||||
if [ ! -z "${LOCAL_DNS_PORT}" ]; then
|
||||
add_dnsmasq_setting "server" "127.0.0.1#${LOCAL_DNS_PORT}"
|
||||
add_setting "PIHOLE_DNS_${COUNTER}" "127.0.0.1#${LOCAL_DNS_PORT}"
|
||||
delete_setting "LOCAL_DNS_PORT"
|
||||
fi
|
||||
|
||||
delete_dnsmasq_setting "domain-needed"
|
||||
|
@ -529,16 +533,6 @@ SetPrivacyLevel() {
|
|||
changeFTLsetting "PRIVACYLEVEL" "${args[2]}"
|
||||
fi
|
||||
}
|
||||
SetLocalDNSport() {
|
||||
# Ensure port is a natural number { 0, 1, 2, 3, ... }
|
||||
if [[ "${1}" == "0" ]]; then
|
||||
delete_setting "LOCAL_DNS_PORT"
|
||||
ProcessDNSSettings
|
||||
elif [[ "${1}" =~ ^[0-9]+$ ]]; then
|
||||
change_setting "LOCAL_DNS_PORT" "${1}"
|
||||
ProcessDNSSettings
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
args=("$@")
|
||||
|
@ -570,7 +564,6 @@ main() {
|
|||
"adlist" ) CustomizeAdLists;;
|
||||
"audit" ) audit;;
|
||||
"-l" | "privacylevel" ) SetPrivacyLevel;;
|
||||
"localdnsport" ) SetLocalDNSport "$3";;
|
||||
* ) helpFunc;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -102,8 +102,10 @@ if ($serverName === "pi.hole") {
|
|||
$bpAskAdmin = !empty($svEmail) ? '<a href="mailto:'.$svEmail.'?subject=Site Blocked: '.$serverName.'"></a>' : "<span/>";
|
||||
|
||||
// Determine if at least one block list has been generated
|
||||
if (empty(glob("/etc/pihole/list.0.*.domains")))
|
||||
$blocklistglob = glob("/etc/pihole/list.0.*.domains");
|
||||
if ($blocklistglob === array()) {
|
||||
die("[ERROR] There are no domain lists generated lists within <code>/etc/pihole/</code>! Please update gravity by running <code>pihole -g</code>, or repair Pi-hole using <code>pihole -r</code>.");
|
||||
}
|
||||
|
||||
// Set location of adlists file
|
||||
if (is_file("/etc/pihole/adlists.list")) {
|
||||
|
|
|
@ -1933,12 +1933,14 @@ FTLinstall() {
|
|||
popd > /dev/null || { echo "Unable to return to original directory after FTL binary download."; return 1; }
|
||||
# Install the FTL service
|
||||
echo -e "${OVER} ${TICK} ${str}"
|
||||
# dnsmasq can now be stopped and disabled
|
||||
# dnsmasq can now be stopped and disabled if it exists
|
||||
if which dnsmasq > /dev/null; then
|
||||
if check_service_active "dnsmasq";then
|
||||
echo " ${INFO} FTL can now resolve DNS Queries without dnsmasq running separately"
|
||||
stop_service dnsmasq
|
||||
disable_service dnsmasq
|
||||
fi
|
||||
fi
|
||||
|
||||
#ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d`
|
||||
confdir="conf-dir=/etc/dnsmasq.d"
|
||||
|
@ -2051,10 +2053,12 @@ FTLcheckUpdate()
|
|||
local remoteSha1
|
||||
local localSha1
|
||||
|
||||
# if dnsmasq is running at this point, force reinstall of FTL Binary
|
||||
# if dnsmasq exists and is running at this point, force reinstall of FTL Binary
|
||||
if which dnsmasq > /dev/null; then
|
||||
if check_service_active "dnsmasq";then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! "${ftlBranch}" == "master" ]]; then
|
||||
#Check whether or not the binary for this FTL branch actually exists. If not, then there is no update!
|
||||
|
|
|
@ -59,19 +59,12 @@ if [ -x "$(command -v apt-get)" ]; then
|
|||
package_check() {
|
||||
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed"
|
||||
}
|
||||
package_cleanup() {
|
||||
"${SUDO} ${PKG_MANAGER}" -y autoremove
|
||||
"${SUDO} ${PKG_MANAGER}" -y autoclean
|
||||
}
|
||||
elif [ -x "$(command -v rpm)" ]; then
|
||||
# Fedora Family
|
||||
PKG_REMOVE="${PKG_MANAGER} remove -y"
|
||||
package_check() {
|
||||
rpm -qa | grep "^$1-" > /dev/null
|
||||
}
|
||||
package_cleanup() {
|
||||
"${SUDO} ${PKG_MANAGER}" -y autoremove
|
||||
}
|
||||
else
|
||||
echo -e " ${CROSS} OS distribution not supported"
|
||||
exit 1
|
||||
|
@ -100,14 +93,9 @@ removeAndPurge() {
|
|||
done
|
||||
|
||||
# Remove dnsmasq config files
|
||||
${SUDO} rm -f /etc/dnsmasq.conf /etc/dnsmasq.conf.orig /etc/dnsmasq.d/01-pihole.conf &> /dev/null
|
||||
${SUDO} rm -f /etc/dnsmasq.conf /etc/dnsmasq.conf.orig /etc/dnsmasq.d/*-pihole*.conf &> /dev/null
|
||||
echo -e " ${TICK} Removing dnsmasq config files"
|
||||
|
||||
# Take care of any additional package cleaning
|
||||
echo -ne " ${INFO} Removing & cleaning remaining dependencies..."
|
||||
package_cleanup &> /dev/null
|
||||
echo -e "${OVER} ${TICK} Removed & cleaned up remaining dependencies"
|
||||
|
||||
# Call removeNoPurge to remove Pi-hole specific files
|
||||
removeNoPurge
|
||||
}
|
||||
|
|
2
pihole
2
pihole
|
@ -232,7 +232,7 @@ Options:
|
|||
|
||||
# Handle notices
|
||||
if [[ -z "${wbMatch:-}" ]] && [[ -z "${wcMatch:-}" ]] && [[ -z "${results[*]}" ]]; then
|
||||
echo -e " ${INFO} No ${exact/t/t }results found for ${COL_BOLD}${domainQuery}${COL_NC} found within block lists"
|
||||
echo -e " ${INFO} No ${exact/t/t }results found for ${COL_BOLD}${domainQuery}${COL_NC} within the block lists"
|
||||
exit 0
|
||||
elif [[ -z "${results[*]}" ]]; then
|
||||
# Result found in WL/BL/Wildcards
|
||||
|
|
Loading…
Reference in a new issue