From 1dd9f0747eb15f333765ac74e1309ba6d4d3017f Mon Sep 17 00:00:00 2001 From: bcambl Date: Wed, 7 Sep 2016 19:41:54 -0600 Subject: [PATCH 01/17] add gateway to interface configuration pi-hole@9cb4e8b broke #593 original commit 8550b76 --- automated install/basic-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 0caa8bf7..3963b6ef 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -358,6 +358,7 @@ setStaticIPv4() { ${SUDO} echo "ONBOOT=yes" >> ${IFCFG_FILE} ${SUDO} echo "IPADDR=$IPADDR" >> ${IFCFG_FILE} ${SUDO} echo "PREFIX=$CIDR" >> ${IFCFG_FILE} + ${SUDO} echo "GATEWAY=$IPv4gw" >> ${IFCFG_FILE} ${SUDO} echo "USERCTL=no" >> ${IFCFG_FILE} ${SUDO} ip addr replace dev "$piholeInterface" "$IPv4addr" if [ -x "$(command -v nmcli)" ];then From 05ad4445b54ded54b60f10b543428878a1277bbf Mon Sep 17 00:00:00 2001 From: bcambl Date: Wed, 7 Sep 2016 19:58:35 -0600 Subject: [PATCH 02/17] add dns to sysconfig interface configuration --- automated install/basic-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 3963b6ef..1356a002 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -359,6 +359,8 @@ setStaticIPv4() { ${SUDO} echo "IPADDR=$IPADDR" >> ${IFCFG_FILE} ${SUDO} echo "PREFIX=$CIDR" >> ${IFCFG_FILE} ${SUDO} echo "GATEWAY=$IPv4gw" >> ${IFCFG_FILE} + ${SUDO} echo "DNS1=$piholeDNS1" >> ${IFCFG_FILE} + ${SUDO} echo "DNS2=$piholeDNS2" >> ${IFCFG_FILE} ${SUDO} echo "USERCTL=no" >> ${IFCFG_FILE} ${SUDO} ip addr replace dev "$piholeInterface" "$IPv4addr" if [ -x "$(command -v nmcli)" ];then From 6c0c6182e9979e87300ca8e2e25b7a48041db96c Mon Sep 17 00:00:00 2001 From: bcambl Date: Wed, 7 Sep 2016 20:06:36 -0600 Subject: [PATCH 03/17] fix newline in configureSelinux stdout --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 1356a002..9f31100b 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -871,9 +871,9 @@ configureSelinux() { printf "::: Enabling httpd server side includes (SSI).. " ${SUDO} setsebool -P httpd_ssi_exec on if [ $? -eq 0 ]; then - echo -n "Success\n" + echo -n "Success" fi - printf ":::\tCompiling Pi-Hole SELinux policy..\n" + printf "\n:::\tCompiling Pi-Hole SELinux policy..\n" ${SUDO} checkmodule -M -m -o /etc/pihole/pihole.mod /etc/.pihole/advanced/selinux/pihole.te ${SUDO} semodule_package -o /etc/pihole/pihole.pp -m /etc/pihole/pihole.mod ${SUDO} semodule -i /etc/pihole/pihole.pp From 640af300cba4c032d55f9af7e5b2ea2fd6f0893c Mon Sep 17 00:00:00 2001 From: bcambl Date: Wed, 7 Sep 2016 20:38:44 -0600 Subject: [PATCH 04/17] additional hostname checks in gravity.sh - Test if /etc/hostname exists before attempting to cat the file. - Add alternative hostname discovery via hostname command - Add an error message to stdout if unable to determine host fqdn --- gravity.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 0b1622e0..a1485acf 100755 --- a/gravity.sh +++ b/gravity.sh @@ -264,7 +264,13 @@ function gravity_unique() { function gravity_hostFormat() { # Format domain list as "192.168.x.x domain.com" echo "::: Formatting domains into a HOSTS file..." - hostname=$( Date: Mon, 12 Sep 2016 18:12:31 +0100 Subject: [PATCH 05/17] Only pull master branch, the rest aren't needed! --- pihole | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pihole b/pihole index bd948b55..d6da8366 100755 --- a/pihole +++ b/pihole @@ -55,7 +55,7 @@ function updateDashboardFunc { function updatePiholeFunc { echo "::: Fetching latest changes from Github..." cd /etc/.pihole - ${SUDO} git pull + ${SUDO} git pull origin master ${SUDO} /etc/.pihole/automated\ install/basic-install.sh pihole exit 1 } From 0229f7076176e777dbba05681fbcd2200280697c Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 12 Sep 2016 18:29:04 +0100 Subject: [PATCH 06/17] Make updatePiholeFunc a bit smarter. Only run update if version is not the latest. --- pihole | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/pihole b/pihole index d6da8366..f23db60e 100755 --- a/pihole +++ b/pihole @@ -53,10 +53,26 @@ function updateDashboardFunc { } function updatePiholeFunc { - echo "::: Fetching latest changes from Github..." - cd /etc/.pihole - ${SUDO} git pull origin master - ${SUDO} /etc/.pihole/automated\ install/basic-install.sh pihole + echo "::: Checking for updates..." + piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0) + piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//') + + if [[ ${piholeVersion} == ${piholeVersionLatest} ]] ; then + echo "::: Pi-hole is already up to date! Version: ${piholeVersion}" + echo ":::" + echo "::: No need to update!" + else + echo "::: An update is available! Current Version: ${piholeVersion}" + echo "::: Latest Version: ${piholeVersionLatest}" + echo ":::" + echo "::: Fetching latest changes from Github..." + cd /etc/.pihole + ${SUDO} git pull origin master + ${SUDO} /etc/.pihole/automated\ install/basic-install.sh pihole + echo ":::" + echo "::: Pi-hole has been updated, see https://changes.pi-hole.net for details" + fi + exit 1 } From d124c2c12e78426a823a430eaff4fdcd641ac8a7 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 12 Sep 2016 18:57:19 +0100 Subject: [PATCH 07/17] Expand to check web admin versions --- pihole | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/pihole b/pihole index f23db60e..e6f6e292 100755 --- a/pihole +++ b/pihole @@ -57,20 +57,51 @@ function updatePiholeFunc { piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0) piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//') + webVersion=$(cd /var/www/html/admin/ && git describe --tags --abbrev=0) + webVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//') + + echo "::: Pi-hole version is $piholeVersion (Latest version is $piholeVersionLatest)" + echo "::: Web Admin version is $webVersion (Latest version is $webVersionLatest)" + if [[ ${piholeVersion} == ${piholeVersionLatest} ]] ; then - echo "::: Pi-hole is already up to date! Version: ${piholeVersion}" - echo ":::" + echo "::: Pi-hole Base files are already up to date! Version: ${piholeVersionLatest}" echo "::: No need to update!" - else - echo "::: An update is available! Current Version: ${piholeVersion}" - echo "::: Latest Version: ${piholeVersionLatest}" echo ":::" - echo "::: Fetching latest changes from Github..." + + if [[ ${webVersion} == ${webVersionLatest} ]] ; then + echo "::: Web Admin files are already up to date!" + echo "::: No need to update!" + echo ":::" + else + echo "::: An Update is available for the Web Admin!" + echo ":::" + echo "::: Fetching latest changes from GitHub..." + cd /var/www/html/admin + ${SUDO} git pull origin master + echo ":::" + echo "::: Pi-hole Web Admin has been updated to ${webVersion}" + echo "::: See https://changes.pi-hole.net for details" + fi + else + echo -n "::: An update is available for " + if [[ ${webVersion} == ${webVersionLatest} ]] ; then + echo " Pi-Hole!" + else + echo " Pi-Hole base files and the Web Admin. Both will be updated!" + fi + + echo "::: Fetching latest changes from GitHub..." cd /etc/.pihole ${SUDO} git pull origin master ${SUDO} /etc/.pihole/automated\ install/basic-install.sh pihole + echo ":::" - echo "::: Pi-hole has been updated, see https://changes.pi-hole.net for details" + echo "::: Pi-hole has been updated to version ${piholeVersionLatest}" + if [[ ${webVersion} != ${webVersionLatest} ]] ; then + echo "::: Web Admin has been updated to version ${webVersionLatest}" + fi + echo ":::" + echo "::: See https://changes.pi-hole.net for details" fi exit 1 From d58f7c6ec92a95903e5464420df30b9100633602 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 12 Sep 2016 19:08:33 +0100 Subject: [PATCH 08/17] Remove references to dashboard update Script --- pihole | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pihole b/pihole index e6f6e292..8fc98f51 100755 --- a/pihole +++ b/pihole @@ -47,10 +47,6 @@ function flushFunc { exit 1 } -function updateDashboardFunc { - ${SUDO} /opt/pihole/updateDashboard.sh - exit 1 -} function updatePiholeFunc { echo "::: Checking for updates..." @@ -159,8 +155,7 @@ function helpFunc { echo "::: -b, blacklist Blacklist domains" echo "::: -d, debug Start a debugging session if having trouble" echo "::: -f, flush Flush the pihole.log file" - echo "::: -ud, updateDashboard Update the web dashboard manually" - echo "::: -up, updatePihole Update Pi-hole" + echo "::: -up, updatePihole Update Pi-hole" echo "::: -g, updateGravity Update the list of ad-serving domains" echo "::: -s, setupLCD Automatically configures the Pi to use the 2.8 LCD screen to display stats on it" echo "::: -c, chronometer Calculates stats and displays to an LCD" @@ -181,7 +176,6 @@ case "$1" in "-b" | "blacklist" ) blacklistFunc "$@";; "-d" | "debug" ) debugFunc;; "-f" | "flush" ) flushFunc;; -"-ud" | "updateDashboard" ) updateDashboardFunc;; "-up" | "updatePihole" ) updatePiholeFunc;; "-g" | "updateGravity" ) updateGravityFunc "$@";; "-s" | "setupLCD" ) setupLCDFunction;; From a3ef9efd2f6ecc65d41aed11d81b88c86a8d6c52 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 12 Sep 2016 19:09:19 +0100 Subject: [PATCH 09/17] remove updateDashboard script --- advanced/Scripts/updateDashboard.sh | 69 ----------------------------- 1 file changed, 69 deletions(-) delete mode 100755 advanced/Scripts/updateDashboard.sh diff --git a/advanced/Scripts/updateDashboard.sh b/advanced/Scripts/updateDashboard.sh deleted file mode 100755 index 991089c2..00000000 --- a/advanced/Scripts/updateDashboard.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash -# Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net -# Updates the Pi-hole web interface -# -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -WEB_INTERFACE_GIT_URL="https://github.com/pi-hole/AdminLTE.git" -WEB_INTERFACE_DIR="/var/www/html/admin" - -main() { - prerequisites - if ! is_repo; then - make_repo - fi - update_repo -} - -prerequisites() { - - # must be root to update - if [[ $EUID -ne 0 ]]; then - sudo bash "$0" "$@" - exit $? - fi - - # web interface must already exist. this is a (lazy) - # check to make sure pihole is actually installed. - if [ ! -d "$WEB_INTERFACE_DIR" ]; then - echo "$WEB_INTERFACE_DIR not found. Exiting." - exit 1 - fi - - if ! type "git" > /dev/null; then - apt-get -y install git - fi -} - -is_repo() { - # if the web interface directory does not have a .git folder - # it means its using the master.zip archive from the install - # script. - if [ ! -d "$WEB_INTERFACE_DIR/.git" ]; then - return 1 - fi - return 0 -} - -# removes the web interface installed from the master.zip archive and -# replaces it with the current master branch from github -make_repo() { - # remove the non-repod interface and clone the interface - rm -rf ${WEB_INTERFACE_DIR} - git clone "$WEB_INTERFACE_GIT_URL" "$WEB_INTERFACE_DIR" -} - -# pulls the latest master branch from github -update_repo() { - # pull the latest commits - cd "$WEB_INTERFACE_DIR" - git pull -} - -main From a0977af0818d9e27f49a4a38abfcb01de6d4e7a2 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 12 Sep 2016 19:10:12 +0100 Subject: [PATCH 10/17] remove references to UpdateDashboard.sh --- automated install/basic-install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 97171c31..0df28498 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -543,11 +543,10 @@ installScripts() { ${SUDO} cp /etc/.pihole/advanced/Scripts/blacklist.sh /opt/pihole/blacklist.sh ${SUDO} cp /etc/.pihole/advanced/Scripts/piholeDebug.sh /opt/pihole/piholeDebug.sh ${SUDO} cp /etc/.pihole/advanced/Scripts/piholeLogFlush.sh /opt/pihole/piholeLogFlush.sh - ${SUDO} cp /etc/.pihole/advanced/Scripts/updateDashboard.sh /opt/pihole/updateDashboard.sh ${SUDO} cp /etc/.pihole/automated\ install/uninstall.sh /opt/pihole/uninstall.sh ${SUDO} cp /etc/.pihole/advanced/Scripts/setupLCD.sh /opt/pihole/setupLCD.sh ${SUDO} cp /etc/.pihole/advanced/Scripts/version.sh /opt/pihole/version.sh - ${SUDO} chmod 755 /opt/pihole/gravity.sh /opt/pihole/chronometer.sh /opt/pihole/whitelist.sh /opt/pihole/blacklist.sh /opt/pihole/piholeLogFlush.sh /opt/pihole/updateDashboard.sh /opt/pihole/uninstall.sh /opt/pihole/setupLCD.sh /opt/pihole/version.sh + ${SUDO} chmod 755 /opt/pihole/gravity.sh /opt/pihole/chronometer.sh /opt/pihole/whitelist.sh /opt/pihole/blacklist.sh /opt/pihole/piholeLogFlush.sh /opt/pihole/uninstall.sh /opt/pihole/setupLCD.sh /opt/pihole/version.sh ${SUDO} cp /etc/.pihole/pihole /usr/local/bin/pihole ${SUDO} chmod 755 /usr/local/bin/pihole ${SUDO} cp /etc/.pihole/advanced/bash-completion/pihole /etc/bash_completion.d/pihole From ec0c68621c1d0f991c9176a967c9bfa8b86d2665 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 12 Sep 2016 19:40:34 +0100 Subject: [PATCH 11/17] add blank line after Current version display --- pihole | 1 + 1 file changed, 1 insertion(+) diff --git a/pihole b/pihole index 8fc98f51..00e4a7bf 100755 --- a/pihole +++ b/pihole @@ -58,6 +58,7 @@ function updatePiholeFunc { echo "::: Pi-hole version is $piholeVersion (Latest version is $piholeVersionLatest)" echo "::: Web Admin version is $webVersion (Latest version is $webVersionLatest)" + echo ":::" if [[ ${piholeVersion} == ${piholeVersionLatest} ]] ; then echo "::: Pi-hole Base files are already up to date! Version: ${piholeVersionLatest}" From b1a7b0a1864f8a65fea94b226c80c776ce3dcc4e Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 15 Sep 2016 15:16:06 +0100 Subject: [PATCH 12/17] Update piholeDebug.sh I can spell, honest. --- advanced/Scripts/piholeDebug.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index e2e59244..d003c1a4 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -338,7 +338,7 @@ function dumpPiHoleLog { # Anything to be done after capturing of pihole.log terminates function finalWork { echo "::: Finshed debugging!" - echo "::: The degug log can be uploaded to Termbin.com for easier sharing." + echo "::: The debug log can be uploaded to Termbin.com for easier sharing." read -r -p "::: Would you like to upload the log? [y/N] " response case ${response} in [yY][eE][sS]|[yY]) From 3ed62d45f5285d162f39da453ac3e2f318fb82bf Mon Sep 17 00:00:00 2001 From: Promofaux Date: Fri, 16 Sep 2016 23:05:08 +0100 Subject: [PATCH 13/17] Source IP addresses from /etc/pihole/setupVars.conf --- gravity.sh | 45 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/gravity.sh b/gravity.sh index 0b1622e0..acf7c76f 100755 --- a/gravity.sh +++ b/gravity.sh @@ -39,44 +39,26 @@ function helpFunc() exit 1 } -piholeIPfile=/etc/pihole/piholeIP -piholeIPv6file=/etc/pihole/.useIPv6 adListFile=/etc/pihole/adlists.list adListDefault=/etc/pihole/adlists.default whitelistScript=/opt/pihole/whitelist.sh blacklistScript=/opt/pihole/blacklist.sh -if [[ -f ${piholeIPfile} ]];then - # If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script - piholeIP=$(cat ${piholeIPfile}) - #rm $piholeIPfile -else - # Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script - IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') - piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}') - piholeIP=${piholeIPCIDR%/*} -fi - -if [[ -f ${piholeIPv6file} ]];then - # If the file exists, then the user previously chose to use IPv6 in the automated installer - piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }') -fi +#Source the setupVars from install script for the IP +. /etc/pihole/setupVars.conf +#Remove the /* from the end of the IPv4addr. +IPv4addr=${IPv4addr%/*} # Variables for various stages of downloading and formatting the list -## Nate 3/26/2016 - Commented unused variables basename=pihole piholeDir=/etc/${basename} adList=${piholeDir}/gravity.list -#blacklist=$piholeDir/blacklist.txt -#whitelist=$piholeDir/whitelist.txt -#latentWhitelist=$piholeDir/latentWhitelist.txt justDomainsExtension=domains -matterandlight=${basename}.0.matterandlight.txt +matterAndLight=${basename}.0.matterandlight.txt supernova=${basename}.1.supernova.txt eventHorizon=${basename}.2.eventHorizon.txt accretionDisc=${basename}.3.accretionDisc.txt -#eyeOfTheNeedle=$basename.4.wormhole.txt # After setting defaults, check if there's local overrides if [[ -r ${piholeDir}/pihole.conf ]];then @@ -213,10 +195,10 @@ function gravity_Schwarzchild() { echo "::: " # Find all active domains and compile them into one file and remove CRs echo -n "::: Aggregating list of domains..." - truncate -s 0 ${piholeDir}/${matterandlight} + truncate -s 0 ${piholeDir}/${matterAndLight} for i in "${activeDomains[@]}" do - cat "$i" | tr -d '\r' >> ${piholeDir}/${matterandlight} + cat "$i" | tr -d '\r' >> ${piholeDir}/${matterAndLight} done echo " done!" } @@ -268,13 +250,13 @@ function gravity_hostFormat() { # If there is a value in the $piholeIPv6, then IPv6 will be used, so the awk command modified to create a line for both protocols if [[ -n ${piholeIPv6} ]];then # Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin) - echo -e "$piholeIP $hostname\n$piholeIPv6 $hostname\n$piholeIP pi.hole\n$piholeIPv6 pi.hole" > ${piholeDir}/${accretionDisc} - cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} + echo -e "$IPv4addr $hostname\n$piholeIPv6 $hostname\n$IPv4addr pi.hole\n$piholeIPv6 pi.hole" > ${piholeDir}/${accretionDisc} + cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPv4addr" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc} else # Otherwise, just create gravity.list as normal using IPv4 # Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin) - echo -e "$piholeIP $hostname\n$piholeIP pi.hole" > ${piholeDir}/${accretionDisc} - cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc} + echo -e "$IPv4addr $hostname\n$IPv4addr pi.hole" > ${piholeDir}/${accretionDisc} + cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPv4addr" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc} fi # Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it @@ -301,7 +283,7 @@ function gravity_advanced() { # This helps with that and makes it easier to read # It also helps with debugging so each stage of the script can be researched more in depth echo -n "::: Formatting list of domains to remove comments...." - awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' ${piholeDir}/${matterandlight} | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova} + awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' ${piholeDir}/${matterAndLight} | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova} echo " done!" numberOf=$(wc -l < ${piholeDir}/${supernova}) @@ -349,14 +331,13 @@ do esac done -#Overwrite adlists.default from /etc/.pihole in case any changes have been made. Changes should be saved in /etc/adlists.list - if [[ ${forceGrav} == true ]]; then echo -n "::: Deleting exising list cache..." ${SUDO} rm /etc/pihole/list.* echo " done!" fi +#Overwrite adlists.default from /etc/.pihole in case any changes have been made. Changes should be saved in /etc/adlists.list ${SUDO} cp /etc/.pihole/adlists.default /etc/pihole/adlists.default gravity_collapse gravity_spinup From f16574085f98b74ac0a1a04e1773a067cfee2010 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Fri, 16 Sep 2016 23:09:14 +0100 Subject: [PATCH 14/17] remove code made redundant by the existence of /etc/pihole/setupVars.conf --- automated install/basic-install.sh | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 97171c31..3c86dd5a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -195,7 +195,6 @@ chooseInterface() { do piholeInterface=${desiredInterface} echo "::: Using interface: $piholeInterface" - echo "${piholeInterface}" > /tmp/piholeINT done else echo "::: Cancel selected, exiting...." @@ -204,13 +203,6 @@ chooseInterface() { } -cleanupIPv6() { - # Removes IPv6 indicator file if we are not using IPv6 - if [ -f "/etc/pihole/.useIPv6" ] && [ ! "$useIPv6" ]; then - rm /etc/pihole/.useIPv6 - fi -} - use4andor6() { # Let use select IPv4 and/or IPv6 cmd=(whiptail --separate-output --checklist "Select Protocols (press space to select)" ${r} ${c} 2) @@ -249,7 +241,7 @@ use4andor6() { echo "::: Exiting" exit 1 fi - cleanupIPv6 + else echo "::: Cancel selected. Exiting..." exit 1 @@ -260,8 +252,6 @@ useIPv6dialog() { # Show the IPv6 address used for blocking piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }') whiptail --msgbox --backtitle "IPv6..." --title "IPv6 Supported" "$piholeIPv6 will be used to block ads." ${r} ${c} - - ${SUDO} touch /etc/pihole/.useIPv6 } getStaticIPv4Settings() { @@ -273,8 +263,6 @@ getStaticIPv4Settings() { whiptail --msgbox --backtitle "IP information" --title "FYI: IP Conflict" "It is possible your router could still try to assign this IP to a device, which would cause a conflict. But in most cases the router is smart enough to not do that. If you are worried, either manually set the address, or modify the DHCP reservation pool so it does not include the IP you want. It is also possible to use a DHCP reservation, but if you are going to do that, you might as well set a static address." ${r} ${c} - #piholeIP is saved to a permanent file so gravity.sh can use it when updating - ${SUDO} echo "${IPv4addr%/*}" > /etc/pihole/piholeIP # Nothing else to do since the variables are already set above else # Otherwise, we need to ask the user to input their desired settings. @@ -294,10 +282,6 @@ It is also possible to use a DHCP reservation, but if you are going to do that, if (whiptail --backtitle "Calibrating network interface" --title "Static IP Address" --yesno "Are these settings correct? IP address: $IPv4addr Gateway: $IPv4gw" ${r} ${c}); then - # If the settings are correct, then we need to set the piholeIP - # Saving it to a temporary file us to retrieve it later when we run the gravity.sh script. piholeIP is saved to a permanent file so gravity.sh can use it when updating - $SUDO echo "${IPv4addr%/*}" > /etc/pihole/piholeIP - $SUDO echo "$piholeInterface" > /tmp/piholeINT # After that's done, the loop ends and we move on ipSettingsCorrect=True else From 3d5140458bde33fff9d9b89ffd94ccedf2cb51b1 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 19 Sep 2016 20:43:04 +0100 Subject: [PATCH 15/17] Change cron job --- advanced/pihole.cron | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/advanced/pihole.cron b/advanced/pihole.cron index d4ec56a7..2d06fbbc 100644 --- a/advanced/pihole.cron +++ b/advanced/pihole.cron @@ -13,9 +13,8 @@ # Download any updates from the adlists 59 1 * * 7 root /usr/local/bin/pihole updateGravity -# Pi-hole: Update the Web interface shortly after gravity runs -# This should also update the version number if it is changed in the dashboard repo -30 2 * * 7 root /usr/local/bin/pihole updateDashboard +# Pi-hole: Update Pi-hole! Uncomment to enable auto update +#30 2 * * 7 root /usr/local/bin/pihole updatePihole # Pi-hole: Parse the log file before it is flushed and save the stats to a database # This will be used for a historical view of your Pi-hole's performance From a3edd0b976494e03d403f71ee4cbbf1dd3021404 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 19 Sep 2016 21:06:28 +0100 Subject: [PATCH 16/17] Change reset_on_push to false So we don't have to reapprove every time the branch is updated. --- .pullapprove.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pullapprove.yml b/.pullapprove.yml index ae786ecf..f868b48d 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -1,7 +1,7 @@ approve_by_comment: true approve_regex: '^(Approved|:shipit:|:\+1:)' reject_regex: '^(Rejected|:-1:)' -reset_on_push: true +reset_on_push: false author_approval: required reviewers: members: From 655c422c3c4bafe0876b96d05f4b4eeb90ee9d27 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 19 Sep 2016 22:17:58 +0100 Subject: [PATCH 17/17] Add additional instruction. Include "(Press space to select)" on ChooseInterface --- 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 a19b465a..0e1c8046 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -188,7 +188,7 @@ chooseInterface() { # Find out how many interfaces are available to choose from interfaceCount=$(echo "$availableInterfaces" | wc -l) - chooseInterfaceCmd=(whiptail --separate-output --radiolist "Choose An Interface" ${r} ${c} ${interfaceCount}) + chooseInterfaceCmd=(whiptail --separate-output --radiolist "Choose An Interface (press space to select)" ${r} ${c} ${interfaceCount}) chooseInterfaceOptions=$("${chooseInterfaceCmd[@]}" "${interfacesArray[@]}" 2>&1 >/dev/tty) if [[ $? = 0 ]]; then for desiredInterface in ${chooseInterfaceOptions}