From 533e5dddd033682bd60ab2e5ae83f80de0de37e5 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 16 Jul 2020 18:33:53 +0100 Subject: [PATCH 01/20] clarify examples in case of unsupported OS Signed-off-by: Adam Warner --- automated install/basic-install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 5aa20187..30f68739 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -217,7 +217,8 @@ os_check() { printf " https://docs.pi-hole.net/main/prerequesites/#supported-operating-systems\\n" printf "\\n" printf " This check can be skipped by setting the environment variable %bPIHOLE_SKIP_OS_CHECK%b to %btrue%b\\n" "${COL_LIGHT_RED}" "${COL_NC}" "${COL_LIGHT_RED}" "${COL_NC}" - printf " e.g: export PIHOLE_SKIP_OS_CHECK=true\\n" + printf " e.g: 'sudo PIHOLE_SKIP_OS_CHECK=true curl -sSL https://install.pi-hole.net | bash'\\n" + printf " or 'sudo PIHOLE_SKIP_OS_CHECK=true pihole -up'\\n" printf " By setting this variable to true you acknowledge there may be issues with Pi-hole during or after the install\\n" printf " If that is the case, you can feel free to ask the community on Discourse with the %bCommunity Help%b category:\\n" "${COL_LIGHT_RED}" "${COL_NC}" printf " https://discourse.pi-hole.net/c/bugs-problems-issues/community-help/\\n" From 643d2c0f3ea7871b64f9eaa2c9a5a2060d9ad14e Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 16 Jul 2020 21:31:45 +0100 Subject: [PATCH 02/20] add missing port number validation section to valid_ip6 Signed-off-by: Adam Warner --- automated install/basic-install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 30f68739..2bbd4d10 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1040,8 +1040,10 @@ valid_ip6() { local ipv6elem="[0-9a-fA-F]{1,4}" # CIDR for IPv6 is 1- 128 bit local v6cidr="(\\/([1-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])){0,1}" + # optional port number starting '#' with range of 1-65536 + local portelem="(#([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-6]))?" # build a full regex string from the above parts - local regex="^(((${ipv6elem}))((:${ipv6elem}))*::((${ipv6elem}))*((:${ipv6elem}))*|((${ipv6elem}))((:${ipv6elem})){7})${v6cidr}$" + local regex="^(((${ipv6elem}))((:${ipv6elem}))*::((${ipv6elem}))*((:${ipv6elem}))*|((${ipv6elem}))((:${ipv6elem})){7})${v6cidr}${portelem}$" [[ ${ip} =~ ${regex} ]] From ea22774d163c1fbf235faa6ef1e911bc9e1ab167 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 21 Jul 2020 18:47:13 +0100 Subject: [PATCH 03/20] Wrap entire function in the check for the ENVVAR Signed-off-by: Adam Warner --- automated install/basic-install.sh | 89 +++++++++++++++--------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 2bbd4d10..ea4326d5 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -175,58 +175,61 @@ is_command() { } os_check() { - # This function gets a list of supported OS versions from a TXT record at versions.pi-hole.net - # and determines whether or not the script is running on one of those systems - local remote_os_domain valid_os valid_version detected_os_pretty detected_os detected_version display_warning - remote_os_domain="versions.pi-hole.net" - valid_os=false - valid_version=false - display_warning=true + if [ "$PIHOLE_SKIP_OS_CHECK" != true ]; then + # This function gets a list of supported OS versions from a TXT record at versions.pi-hole.net + # and determines whether or not the script is running on one of those systems + local remote_os_domain valid_os valid_version detected_os_pretty detected_os detected_version display_warning + remote_os_domain="versions.pi-hole.net" + valid_os=false + valid_version=false + display_warning=true - detected_os_pretty=$(cat /etc/*release | grep PRETTY_NAME | cut -d '=' -f2- | tr -d '"') - detected_os="${detected_os_pretty%% *}" - detected_version=$(cat /etc/*release | grep VERSION_ID | cut -d '=' -f2- | tr -d '"') + detected_os_pretty=$(cat /etc/*release | grep PRETTY_NAME | cut -d '=' -f2- | tr -d '"') + detected_os="${detected_os_pretty%% *}" + detected_version=$(cat /etc/*release | grep VERSION_ID | cut -d '=' -f2- | tr -d '"') - IFS=" " read -r -a supportedOS < <(dig +short -t txt ${remote_os_domain} | tr -d '"') + IFS=" " read -r -a supportedOS < <(dig +short -t txt ${remote_os_domain} | tr -d '"') - for i in "${supportedOS[@]}" - do - os_part=$(echo "$i" | cut -d '=' -f1) - versions_part=$(echo "$i" | cut -d '=' -f2-) + for i in "${supportedOS[@]}" + do + os_part=$(echo "$i" | cut -d '=' -f1) + versions_part=$(echo "$i" | cut -d '=' -f2-) - if [[ "${detected_os}" =~ ${os_part} ]]; then - valid_os=true - IFS="," read -r -a supportedVer <<<"${versions_part}" - for x in "${supportedVer[@]}" - do - if [[ "${detected_version}" =~ $x ]];then - valid_version=true - break + if [[ "${detected_os}" =~ ${os_part} ]]; then + valid_os=true + IFS="," read -r -a supportedVer <<<"${versions_part}" + for x in "${supportedVer[@]}" + do + if [[ "${detected_version}" =~ $x ]];then + valid_version=true + break + fi + done + break fi - done - break + done + + if [ "$valid_os" = true ] && [ "$valid_version" = true ]; then + display_warning=false fi - done - if [ "$valid_os" = true ] && [ "$valid_version" = true ]; then - display_warning=false - fi + if [ "$display_warning" = true ]; then + printf " %b %bUnsupported OS detected%b\\n" "${CROSS}" "${COL_LIGHT_RED}" "${COL_NC}" + printf " https://docs.pi-hole.net/main/prerequesites/#supported-operating-systems\\n" + printf "\\n" + printf " This check can be skipped by setting the environment variable %bPIHOLE_SKIP_OS_CHECK%b to %btrue%b\\n" "${COL_LIGHT_RED}" "${COL_NC}" "${COL_LIGHT_RED}" "${COL_NC}" + printf " e.g: 'sudo PIHOLE_SKIP_OS_CHECK=true curl -sSL https://install.pi-hole.net | bash'\\n" + printf " or 'sudo PIHOLE_SKIP_OS_CHECK=true pihole -up'\\n" + printf " By setting this variable to true you acknowledge there may be issues with Pi-hole during or after the install\\n" + printf " If that is the case, you can feel free to ask the community on Discourse with the %bCommunity Help%b category:\\n" "${COL_LIGHT_RED}" "${COL_NC}" + printf " https://discourse.pi-hole.net/c/bugs-problems-issues/community-help/\\n" + exit 1 - if [ "$display_warning" = true ] && [ "$PIHOLE_SKIP_OS_CHECK" != true ]; then - printf " %b %bUnsupported OS detected%b\\n" "${CROSS}" "${COL_LIGHT_RED}" "${COL_NC}" - printf " https://docs.pi-hole.net/main/prerequesites/#supported-operating-systems\\n" - printf "\\n" - printf " This check can be skipped by setting the environment variable %bPIHOLE_SKIP_OS_CHECK%b to %btrue%b\\n" "${COL_LIGHT_RED}" "${COL_NC}" "${COL_LIGHT_RED}" "${COL_NC}" - printf " e.g: 'sudo PIHOLE_SKIP_OS_CHECK=true curl -sSL https://install.pi-hole.net | bash'\\n" - printf " or 'sudo PIHOLE_SKIP_OS_CHECK=true pihole -up'\\n" - printf " By setting this variable to true you acknowledge there may be issues with Pi-hole during or after the install\\n" - printf " If that is the case, you can feel free to ask the community on Discourse with the %bCommunity Help%b category:\\n" "${COL_LIGHT_RED}" "${COL_NC}" - printf " https://discourse.pi-hole.net/c/bugs-problems-issues/community-help/\\n" - exit 1 - elif [ "$display_warning" = true ] && [ "$PIHOLE_SKIP_OS_CHECK" = true ]; then - printf " %b %bUnsupported OS detected%b. PIHOLE_SKIP_OS_CHECK env variable set to true - installer will continue\\n" "${INFO}" "${COL_LIGHT_RED}" "${COL_NC}" + else + printf " %b %bSupported OS detected%b\\n" "${TICK}" "${COL_LIGHT_GREEN}" "${COL_NC}" + fi else - printf " %b %bSupported OS detected%b\\n" "${TICK}" "${COL_LIGHT_GREEN}" "${COL_NC}" + printf " %b %bPIHOLE_SKIP_OS_CHECK env variable set to true - installer will continue%b\\n" "${INFO}" "${COL_LIGHT_GREEN}" "${COL_NC}" fi } From 6ee6eea1fb87f7bb74ab68a2fd3d7b49f92569fa Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 21 Jul 2020 21:13:40 +0200 Subject: [PATCH 04/20] Use pkill instead of the somewhat fragile combination of kill + pidof. This solves some issues especially when there are many TCP workers floating around. Signed-off-by: DL6ER --- pihole | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pihole b/pihole index b0ba8473..6e06e85d 100755 --- a/pihole +++ b/pihole @@ -20,8 +20,6 @@ PI_HOLE_BIN_DIR="/usr/local/bin" readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE" source "${colfile}" -resolver="pihole-FTL" - webpageFunc() { source "${PI_HOLE_SCRIPT_DIR}/webpage.sh" main "$@" @@ -107,19 +105,19 @@ restartDNS() { # Determine if we should reload or restart if [[ "${svcOption}" =~ "reload-lists" ]]; then # Reloading of the lists has been requested - # Note: This will NOT re-read any *.conf files + # Note 1: This will NOT re-read any *.conf files # Note 2: We cannot use killall here as it does # not know about real-time signals - svc="kill -SIGRTMIN $(pidof ${resolver})" + svc="pkill -RTMIN pihole-FTL" str="Reloading DNS lists" elif [[ "${svcOption}" =~ "reload" ]]; then # Reloading of the DNS cache has been requested # Note: This will NOT re-read any *.conf files - svc="killall -s SIGHUP ${resolver}" + svc="pkill -HUP pihole-FTL" str="Flushing DNS cache" else # A full restart has been requested - svc="service ${resolver} restart" + svc="service pihole-FTL restart" str="Restarting DNS server" fi From 17aabf26f7859600bd3f234530f01c85043c3d59 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 21 Jul 2020 21:19:19 +0200 Subject: [PATCH 05/20] Also use pkill/pgrep in the FTL service script Signed-off-by: DL6ER --- advanced/Templates/pihole-FTL.service | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/advanced/Templates/pihole-FTL.service b/advanced/Templates/pihole-FTL.service index 6af449f3..f0743b49 100644 --- a/advanced/Templates/pihole-FTL.service +++ b/advanced/Templates/pihole-FTL.service @@ -12,19 +12,8 @@ FTLUSER=pihole PIDFILE=/run/pihole-FTL.pid -get_pid() { - # First, try to obtain PID from PIDFILE - if [ -s "${PIDFILE}" ]; then - cat "${PIDFILE}" - return - fi - - # If the PIDFILE is empty or not available, obtain the PID using pidof - pidof "pihole-FTL" | awk '{print $(NF)}' -} - is_running() { - ps "$(get_pid)" > /dev/null 2>&1 + pgrep -o "pihole-FTL" > /dev/null 2>&1 } @@ -63,7 +52,7 @@ start() { # Stop the service stop() { if is_running; then - kill "$(get_pid)" + pkill -o pihole-FTL for i in {1..5}; do if ! is_running; then break @@ -76,7 +65,7 @@ stop() { if is_running; then echo "Not stopped; may still be shutting down or shutdown may have failed, killing now" - kill -9 "$(get_pid)" + pkill -o -9 pihole-FTL exit 1 else echo "Stopped" From 8f7f0881c636e54ad5cf610f4388f3dc8bdb6820 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 21 Jul 2020 21:21:24 +0200 Subject: [PATCH 06/20] Add /usr/sbin to cronjob PATH Signed-off-by: DL6ER --- advanced/Templates/pihole.cron | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/advanced/Templates/pihole.cron b/advanced/Templates/pihole.cron index ba89efdb..ecd1e808 100644 --- a/advanced/Templates/pihole.cron +++ b/advanced/Templates/pihole.cron @@ -18,19 +18,19 @@ # early morning. Download any updates from the adlists # Squash output to log, then splat the log to stdout on error to allow for # standard crontab job error handling. -59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity >/var/log/pihole_updateGravity.log || cat /var/log/pihole_updateGravity.log +59 1 * * 7 root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole_updateGravity.log || cat /var/log/pihole_updateGravity.log # Pi-hole: Flush the log daily at 00:00 # The flush script will use logrotate if available # parameter "once": logrotate only once (default is twice) # parameter "quiet": don't print messages -00 00 * * * root PATH="$PATH:/usr/local/bin/" pihole flush once quiet +00 00 * * * root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole flush once quiet @reboot root /usr/sbin/logrotate /etc/pihole/logrotate # Pi-hole: Grab local version and branch every 10 minutes -*/10 * * * * root PATH="$PATH:/usr/local/bin/" pihole updatechecker local +*/10 * * * * root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updatechecker local # Pi-hole: Grab remote version every 24 hours -59 17 * * * root PATH="$PATH:/usr/local/bin/" pihole updatechecker remote -@reboot root PATH="$PATH:/usr/local/bin/" pihole updatechecker remote reboot +59 17 * * * root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updatechecker remote +@reboot root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updatechecker remote reboot From 527fc3c5cf6372bc52de4a94064a23c7d88bdd9d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 21 Jul 2020 21:39:59 +0200 Subject: [PATCH 07/20] Also pidof -> pgrep in gravity.sh Signed-off-by: DL6ER --- gravity.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gravity.sh b/gravity.sh index 9d4c7bee..636c9872 100755 --- a/gravity.sh +++ b/gravity.sh @@ -43,8 +43,6 @@ optimize_database=false domainsExtension="domains" -resolver="pihole-FTL" - # Source setupVars from install script setupVars="${piholeDir}/setupVars.conf" if [[ -f "${setupVars}" ]];then @@ -284,7 +282,7 @@ gravity_CheckDNSResolutionAvailable() { fi # Determine error output message - if pidof ${resolver} &> /dev/null; then + if pgrep pihole-FTL &> /dev/null; then echo -e " ${CROSS} DNS resolution is currently unavailable" else echo -e " ${CROSS} DNS service is not running" @@ -746,7 +744,7 @@ gravity_Cleanup() { fi # Only restart DNS service if offline - if ! pidof ${resolver} &> /dev/null; then + if ! pgrep pihole-FTL &> /dev/null; then "${PIHOLE_COMMAND}" restartdns dnsWasOffline=true fi From 510b64673664f0e39abefb2a40b13f7a506c1dbe Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 22 Jul 2020 22:29:38 +0100 Subject: [PATCH 08/20] change up the verbiage with something that works (tested) Signed-off-by: Adam Warner --- automated install/basic-install.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index ea4326d5..660862bd 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -217,10 +217,13 @@ os_check() { printf " %b %bUnsupported OS detected%b\\n" "${CROSS}" "${COL_LIGHT_RED}" "${COL_NC}" printf " https://docs.pi-hole.net/main/prerequesites/#supported-operating-systems\\n" printf "\\n" - printf " This check can be skipped by setting the environment variable %bPIHOLE_SKIP_OS_CHECK%b to %btrue%b\\n" "${COL_LIGHT_RED}" "${COL_NC}" "${COL_LIGHT_RED}" "${COL_NC}" - printf " e.g: 'sudo PIHOLE_SKIP_OS_CHECK=true curl -sSL https://install.pi-hole.net | bash'\\n" - printf " or 'sudo PIHOLE_SKIP_OS_CHECK=true pihole -up'\\n" - printf " By setting this variable to true you acknowledge there may be issues with Pi-hole during or after the install\\n" + printf " e.g: If you are seeing this message on a fresh install, you can run:" + printf " 'PIHOLE_SKIP_OS_CHECK=true curl -sSL https://install.pi-hole.net | sudo -E bash'\\n" + printf "\\n" + printf " If you are seeing this message after having run pihole -up:\\n" + printf " 'PIHOLE_SKIP_OS_CHECK=true sudo -E pihole -r'\\n" + printf " (In this case, your previous run of pihole -up will have already updated the local repository)\\n" + printf "\\n" printf " If that is the case, you can feel free to ask the community on Discourse with the %bCommunity Help%b category:\\n" "${COL_LIGHT_RED}" "${COL_NC}" printf " https://discourse.pi-hole.net/c/bugs-problems-issues/community-help/\\n" exit 1 From 98dc51869e4acdd44053175a02a7ff25e4b90d51 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 22 Jul 2020 22:30:51 +0100 Subject: [PATCH 09/20] accidentally missed \\n Signed-off-by: Adam Warner --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 660862bd..2bf63882 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -217,7 +217,7 @@ os_check() { printf " %b %bUnsupported OS detected%b\\n" "${CROSS}" "${COL_LIGHT_RED}" "${COL_NC}" printf " https://docs.pi-hole.net/main/prerequesites/#supported-operating-systems\\n" printf "\\n" - printf " e.g: If you are seeing this message on a fresh install, you can run:" + printf " e.g: If you are seeing this message on a fresh install, you can run:\\n" printf " 'PIHOLE_SKIP_OS_CHECK=true curl -sSL https://install.pi-hole.net | sudo -E bash'\\n" printf "\\n" printf " If you are seeing this message after having run pihole -up:\\n" From ddb36c013d82aafa28ad8c590fff9f1fd3e170e6 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 22 Jul 2020 22:39:03 +0100 Subject: [PATCH 10/20] it helps if the echo goes variable set goes in the right place Signed-off-by: Adam Warner --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 2bf63882..188e889e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -218,7 +218,7 @@ os_check() { printf " https://docs.pi-hole.net/main/prerequesites/#supported-operating-systems\\n" printf "\\n" printf " e.g: If you are seeing this message on a fresh install, you can run:\\n" - printf " 'PIHOLE_SKIP_OS_CHECK=true curl -sSL https://install.pi-hole.net | sudo -E bash'\\n" + printf " 'curl -sSL https://install.pi-hole.net | PIHOLE_SKIP_OS_CHECK=true sudo -E bash'\\n" printf "\\n" printf " If you are seeing this message after having run pihole -up:\\n" printf " 'PIHOLE_SKIP_OS_CHECK=true sudo -E pihole -r'\\n" From 0ff32c3629220f386a45c14d8982aaaf128aa47f Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 27 Jul 2020 17:44:22 +0100 Subject: [PATCH 11/20] Use ns1.pi-hole.net to resolve versions.pi-hole.net so that we do not see DNS cookie issues Co-Authored-by: Dan Schaper Signed-off-by: Adam Warner --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 188e889e..1bbfd7c4 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -188,7 +188,7 @@ os_check() { detected_os="${detected_os_pretty%% *}" detected_version=$(cat /etc/*release | grep VERSION_ID | cut -d '=' -f2- | tr -d '"') - IFS=" " read -r -a supportedOS < <(dig +short -t txt ${remote_os_domain} | tr -d '"') + IFS=" " read -r -a supportedOS < <(dig +short -t txt ${remote_os_domain} @ns1.pi-hole.net | tr -d '"') for i in "${supportedOS[@]}" do From 8380112129a5ea0bd0356256a23d211a80038e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Tue, 28 Jul 2020 09:40:45 +0200 Subject: [PATCH 12/20] Resolve conflicts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 1bbfd7c4..7f3b276e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -214,7 +214,7 @@ os_check() { fi if [ "$display_warning" = true ]; then - printf " %b %bUnsupported OS detected%b\\n" "${CROSS}" "${COL_LIGHT_RED}" "${COL_NC}" + printf " %b %bUnsupported OS detected: %s%b\\n" "${CROSS}" "${COL_LIGHT_RED}" "${detected_os_pretty}" "${COL_NC}" printf " https://docs.pi-hole.net/main/prerequesites/#supported-operating-systems\\n" printf "\\n" printf " e.g: If you are seeing this message on a fresh install, you can run:\\n" From b207ceeab2e485a03a2b3451b59b2d1a1d80e2a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Mon, 27 Jul 2020 17:01:55 +0200 Subject: [PATCH 13/20] Report and exit if dig supportedOS returns nothing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- automated install/basic-install.sh | 35 +++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 1bbfd7c4..d1a74b40 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -190,24 +190,29 @@ os_check() { IFS=" " read -r -a supportedOS < <(dig +short -t txt ${remote_os_domain} @ns1.pi-hole.net | tr -d '"') - for i in "${supportedOS[@]}" - do - os_part=$(echo "$i" | cut -d '=' -f1) - versions_part=$(echo "$i" | cut -d '=' -f2-) + if [ -z "$supportedOS" ]; then + printf " %b %bRetrieval of supported OS failed. Please contact support. %b\\n" "${CROSS}" "${COL_LIGHT_RED}" "${COL_NC}" + exit 1 + else + for i in "${supportedOS[@]}" + do + os_part=$(echo "$i" | cut -d '=' -f1) + versions_part=$(echo "$i" | cut -d '=' -f2-) - if [[ "${detected_os}" =~ ${os_part} ]]; then - valid_os=true - IFS="," read -r -a supportedVer <<<"${versions_part}" - for x in "${supportedVer[@]}" - do - if [[ "${detected_version}" =~ $x ]];then - valid_version=true + if [[ "${detected_os}" =~ ${os_part} ]]; then + valid_os=true + IFS="," read -r -a supportedVer <<<"${versions_part}" + for x in "${supportedVer[@]}" + do + if [[ "${detected_version}" =~ $x ]];then + valid_version=true + break + fi + done break - fi + fi done - break - fi - done + fi if [ "$valid_os" = true ] && [ "$valid_version" = true ]; then display_warning=false From 6fc7dc28a2c8966549d67523dcfc3f40317e092d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Tue, 28 Jul 2020 10:25:57 +0200 Subject: [PATCH 14/20] Count elements of array instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d1a74b40..a4c93391 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -190,7 +190,7 @@ os_check() { IFS=" " read -r -a supportedOS < <(dig +short -t txt ${remote_os_domain} @ns1.pi-hole.net | tr -d '"') - if [ -z "$supportedOS" ]; then + if [ ${#supportedOS[@]} -eq 0 ]; then printf " %b %bRetrieval of supported OS failed. Please contact support. %b\\n" "${CROSS}" "${COL_LIGHT_RED}" "${COL_NC}" exit 1 else From dc2781d1f9aa58b4bc09d0958f658be6f8da238f Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 30 Jul 2020 09:14:05 -0700 Subject: [PATCH 15/20] .travis.yml is now a stub. Signed-off-by: Dan Schaper --- .travis.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 274c28cb..99882270 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,5 @@ -sudo: required -services: - - docker -language: python -python: - - "3.6" -install: - - pip install -r requirements.txt - -script: - # tox.ini handles setup, ordering of docker build first, and then run tests - - tox +import: + - source: pi-hole/pi-hole:/shared-configs:core.yml@main + if: branch = master + - source: pi-hole/pi-hole:/shared-configs:core.yml@main + if: branch != master From 932cdd33294d4dd407e8f050a912a6236046b25a Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 30 Jul 2020 09:31:48 -0700 Subject: [PATCH 16/20] Use the .github repository. Signed-off-by: Dan Schaper --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 99882270..7092049f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ import: - - source: pi-hole/pi-hole:/shared-configs:core.yml@main + - source: pi-hole/.github:/build-configs/core.yml@main if: branch = master - - source: pi-hole/pi-hole:/shared-configs:core.yml@main + - source: pi-hole/.github:/build-configs/core.yml@main if: branch != master From fa574cfd0851091f94b8a71f5adabba41273332f Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 30 Jul 2020 10:05:27 -0700 Subject: [PATCH 17/20] Set non-master to point to latest. Signed-off-by: Dan Schaper --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7092049f..3d80ab6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ import: - source: pi-hole/.github:/build-configs/core.yml@main if: branch = master - - source: pi-hole/.github:/build-configs/core.yml@main + - source: pi-hole/.github:/build-configs/core.yml@latest if: branch != master From 7c53b970040bda96b765421dc8dc19f443fa163a Mon Sep 17 00:00:00 2001 From: Aiden Mitchell <30846409+aidenmitchell@users.noreply.github.com> Date: Thu, 30 Jul 2020 12:57:19 -0700 Subject: [PATCH 18/20] Updating FAQ_HARDWARE_REQUIREMENTS and FAQ_HARDWARE_REQUIREMENTS_PORTS (#3632) Signed-off-by: Aiden Mitchell Co-authored-by: Adam Warner --- advanced/Scripts/piholeDebug.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index d5da57ae..92d6dad7 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -46,8 +46,8 @@ OBFUSCATED_PLACEHOLDER="" # FAQ URLs for use in showing the debug log FAQ_UPDATE_PI_HOLE="${COL_CYAN}https://discourse.pi-hole.net/t/how-do-i-update-pi-hole/249${COL_NC}" FAQ_CHECKOUT_COMMAND="${COL_CYAN}https://discourse.pi-hole.net/t/the-pihole-command-with-examples/738#checkout${COL_NC}" -FAQ_HARDWARE_REQUIREMENTS="${COL_CYAN}https://discourse.pi-hole.net/t/hardware-software-requirements/273${COL_NC}" -FAQ_HARDWARE_REQUIREMENTS_PORTS="${COL_CYAN}https://discourse.pi-hole.net/t/hardware-software-requirements/273#ports${COL_NC}" +FAQ_HARDWARE_REQUIREMENTS="${COL_CYAN}https://docs.pi-hole.net/main/prerequisites/${COL_NC}" +FAQ_HARDWARE_REQUIREMENTS_PORTS="${COL_CYAN}https://docs.pi-hole.net/main/prerequisites/#ports${COL_NC}" FAQ_GATEWAY="${COL_CYAN}https://discourse.pi-hole.net/t/why-is-a-default-gateway-important-for-pi-hole/3546${COL_NC}" FAQ_ULA="${COL_CYAN}https://discourse.pi-hole.net/t/use-ipv6-ula-addresses-for-pi-hole/2127${COL_NC}" FAQ_FTL_COMPATIBILITY="${COL_CYAN}https://github.com/pi-hole/FTL#compatibility-list${COL_NC}" From 8fa9096508b989e7412668e488d0912f26403d3e Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 1 Aug 2020 01:34:38 -0700 Subject: [PATCH 19/20] Remove respository templates. Use org templates instead. Signed-off-by: Dan Schaper --- .github/ISSUE_TEMPLATE.md | 37 -------------------------------- .github/PULL_REQUEST_TEMPLATE.md | 31 -------------------------- 2 files changed, 68 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index bef9f73c..00000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,37 +0,0 @@ -**In raising this issue, I confirm the following:** `{please fill the checkboxes, e.g: [X]}` - -- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md). -- [] The issue I am reporting can be *replicated*. -- [] The issue I am reporting isn't a duplicate (see [FAQs](https://github.com/pi-hole/pi-hole/wiki/FAQs), [closed issues](https://github.com/pi-hole/pi-hole/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), and [open issues](https://github.com/pi-hole/pi-hole/issues)). - -**How familiar are you with the the source code relevant to this issue?:** - -`{Replace this with a number from 1 to 10. 1 being not familiar, and 10 being very familiar}` - ---- -**Expected behavior:** - -`{A detailed description of what you expect to see}` - -**Actual behavior:** - -`{A detailed description and/or screenshots of what you do see}` - -**Steps to reproduce:** - -`{Detailed steps of how we can reproduce this}` - -**Debug token provided by [uploading `pihole -d` log](https://discourse.pi-hole.net/t/the-pihole-command-with-examples/738#debug):** - -`{Alphanumeric token}` - -**Troubleshooting undertaken, and/or other relevant information:** - -`{Steps of what you have done to fix this}` - -> * `{Please delete this quoted section when opening your issue}` -> * You must follow the template instructions. Failure to do so will result in your issue being closed. -> * Please [submit any feature requests here](https://discourse.pi-hole.net/c/feature-requests), so it is votable and trackable by the community. -> * Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time. -> * Detail helps us understand and resolve an issue quicker, but please ensure it's relevant. -> * _This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._ diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 7509e923..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,31 +0,0 @@ -**By submitting this pull request, I confirm the following:** -*please fill any appropriate checkboxes, e.g: [X]* - -- [ ] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template. -- [ ] I have made only one major change in my proposed changes. -- [ ] I have commented my proposed changes within the code. -- [ ] I have tested my proposed changes, and have included unit tests where possible. -- [ ] I am willing to help maintain this change if there are issues with it later. -- [ ] I give this submission freely and claim no ownership. -- [ ] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1) -- [ ] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)) - -Please make sure you [Sign Off](https://docs.pi-hole.net/guides/github/how-to-signoff/) all commits. Pi-hole enforces the [DCO](https://docs.pi-hole.net/guides/github/contributing/). - ---- -**What does this PR aim to accomplish?:** -*A detailed description, screenshots (if necessary), as well as links to any relevant GitHub issues* - - -**How does this PR accomplish the above?:** -*A detailed description (such as a changelog) and screenshots (if necessary) of the implemented fix* - - -**What documentation changes (if any) are needed to support this PR?:** -*A detailed list of any necessary changes* - - ---- -* You must follow the template instructions. Failure to do so will result in your pull request being closed. -* Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time. - From b5983a3fc1b2c6f3b02ada596d812ed3cd76384d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 4 Aug 2020 22:11:32 +0200 Subject: [PATCH 20/20] Do not require first element to be a hex value at any costs. It may also be a : in the valid address ::1 Signed-off-by: DL6ER --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index c5e2c1ff..ac00bf2b 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1054,7 +1054,7 @@ valid_ip6() { # optional port number starting '#' with range of 1-65536 local portelem="(#([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-6]))?" # build a full regex string from the above parts - local regex="^(((${ipv6elem}))((:${ipv6elem}))*::((${ipv6elem}))*((:${ipv6elem}))*|((${ipv6elem}))((:${ipv6elem})){7})${v6cidr}${portelem}$" + local regex="^(((${ipv6elem}))*((:${ipv6elem}))*::((${ipv6elem}))*((:${ipv6elem}))*|((${ipv6elem}))((:${ipv6elem})){7})${v6cidr}${portelem}$" [[ ${ip} =~ ${regex} ]]