From 01d7fc0ac9f68d9c6172d7e860288fcf7e743662 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 10:07:12 +0000 Subject: [PATCH 01/28] Removed apt-get update/upgrade, instead checking for updates availible and advising user to update/upgrade after installation of pi-hole. Addresses issue #218 --- automated install/basic-install.sh | 35 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d9e448a9..09fe2eb3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -293,24 +293,27 @@ stopServices(){ } checkForDependencies(){ - echo ":::" - #Check to see if apt-get update has already been run today - timestamp=$(stat -c %Y /var/cache/apt/) - timestampAsDate=$(date -d @$timestamp "+%b %e") + + #Running apt-get update/upgrade with minimal output can cause some issues with + #requiring user input (e.g password for phpmyadmin see #218) + #We'll change the logic up here, to check to see if there are any updates availible and + # if so, advise the user to run apt-get update/upgrade at their own discretion + today=$(date "+%b %e") - if [ ! "$today" == "$timestampAsDate" ]; then - #update package lists - echo -n "::: Updating package list before install...." - $SUDO apt-get -qq update > /dev/null & spinner $! - echo " done!" - echo -n "::: Upgrading installed apt-get packages...." - $SUDO apt-get -y -qq upgrade > /dev/null & spinner $! - echo " done!" - else - echo "::: Apt-get update already run today, any more would be overkill..." - fi - + echo -n "::: Checking apt-get for upgraded packages...." + updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) & spinner $! + echo " done!" + + if [ updatesToInstall > 0 ]; then + echo "::: There are $updatesToInstall updates availible for your pi!" + echo "::: Please consider running 'sudo apt-get update', followed by 'sudo apt-get upgrade'" + echo "::: after pi-hole has finished installing. + echo ":::" + echo "::: Continuing with pi-hole installation..." + else + echo "::: Your pi is up to date! Continuing with pi-hole installation..." + fi echo ":::" echo "::: Checking dependencies:" From 32389e4ab80079e5ee49606503f0d653d82ffefe Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 25 Jan 2016 02:27:44 -0800 Subject: [PATCH 02/28] Terminate string with missing quote --- 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 09fe2eb3..06fffd8e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -308,7 +308,7 @@ checkForDependencies(){ if [ updatesToInstall > 0 ]; then echo "::: There are $updatesToInstall updates availible for your pi!" echo "::: Please consider running 'sudo apt-get update', followed by 'sudo apt-get upgrade'" - echo "::: after pi-hole has finished installing. + echo "::: after pi-hole has finished installing." echo ":::" echo "::: Continuing with pi-hole installation..." else From e99be28a73c1ba49d377ce6cace15fb5a1451b7e Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 25 Jan 2016 02:31:03 -0800 Subject: [PATCH 03/28] Variable missing $ --- 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 06fffd8e..de9cfed3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -305,7 +305,7 @@ checkForDependencies(){ updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) & spinner $! echo " done!" - if [ updatesToInstall > 0 ]; then + if [ $updatesToInstall > 0 ]; then echo "::: There are $updatesToInstall updates availible for your pi!" echo "::: Please consider running 'sudo apt-get update', followed by 'sudo apt-get upgrade'" echo "::: after pi-hole has finished installing." From 4cedca342748df3dd5363a88cb003e8c08c7a762 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 12:47:03 +0000 Subject: [PATCH 04/28] add in a prompt to give users the option to quit installation or continue --- automated install/basic-install.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index de9cfed3..0feb5e8d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -310,7 +310,16 @@ checkForDependencies(){ echo "::: Please consider running 'sudo apt-get update', followed by 'sudo apt-get upgrade'" echo "::: after pi-hole has finished installing." echo ":::" - echo "::: Continuing with pi-hole installation..." + #add in a prompt to give users the option to quit installation or continue + echo -n "::: Would you like to continue with the pi-hole installation? (Y/n):" + read answer + + case "$answer" in + [yY][eE][sS]|[yY] ) echo "::: Continuing!;; + * ) echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!" + exit 0;; + esac + else echo "::: Your pi is up to date! Continuing with pi-hole installation..." fi From 354a42dd00502735238920ddfdae9e8af9b11b41 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 12:49:04 +0000 Subject: [PATCH 05/28] close quotes on line 318!!! --- 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 0feb5e8d..d96a4416 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -315,7 +315,7 @@ checkForDependencies(){ read answer case "$answer" in - [yY][eE][sS]|[yY] ) echo "::: Continuing!;; + [yY][eE][sS]|[yY] ) echo "::: Continuing!";; * ) echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!" exit 0;; esac From 74ea597bd811a6dd01b17af8489012113243222a Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 15:52:22 +0000 Subject: [PATCH 06/28] Cosmetic enhancement. Add the domain 'Pi-Hole.IsWorking.OK' to the top of the domain list to return a friendlier looking domain when pinging a blocked host! --- gravity.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gravity.sh b/gravity.sh index 255bb264..c33eb05c 100755 --- a/gravity.sh +++ b/gravity.sh @@ -55,7 +55,8 @@ sources=('https://adaway.org/hosts.txt' 'http://www.malwaredomainlist.com/hostslist/hosts.txt' 'http://pgl.yoyo.org/adservers/serverlist.php?' 'http://someonewhocares.org/hosts/hosts' -'http://winhelp2002.mvps.org/hosts.txt') +'http://winhelp2002.mvps.org/hosts.txt' + 'http://mirror1.malwaredomains.com/files/justdomains') # Variables for various stages of downloading and formatting the list basename=pihole @@ -256,10 +257,15 @@ function gravity_hostFormat() { echo "::: Formatting domains into a HOSTS file..." # 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 - cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' > $piholeDir/$accretionDisc + #Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain! + echo -e "$piholeIP Pi-Hole.IsWorking.OK \n$piholeIPv6 Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc + cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $piholeDir/$accretionDisc + else - # Otherwise, just create gravity.list as normal using IPv4 - cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' > $piholeDir/$accretionDisc + # Otherwise, just create gravity.list as normal using IPv4 + #Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain! + echo -e "$piholeIP Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc + cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >> $piholeDir/$accretionDisc fi # Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it cp $piholeDir/$accretionDisc $adList From e87443b3e4c4ec10de1bed3425e93441d5109c6c Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 15:53:49 +0000 Subject: [PATCH 07/28] add 'http://mirror1.malwaredomains.com/files/justdomains' to list of ad-list sources, can be removed if it causes problems --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index c33eb05c..5097e050 100755 --- a/gravity.sh +++ b/gravity.sh @@ -56,7 +56,7 @@ sources=('https://adaway.org/hosts.txt' 'http://pgl.yoyo.org/adservers/serverlist.php?' 'http://someonewhocares.org/hosts/hosts' 'http://winhelp2002.mvps.org/hosts.txt' - 'http://mirror1.malwaredomains.com/files/justdomains') +'http://mirror1.malwaredomains.com/files/justdomains') # Variables for various stages of downloading and formatting the list basename=pihole From 2b99fa81f337bb166f04f33f75a4e2aa2b7f665e Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 25 Jan 2016 16:08:48 +0000 Subject: [PATCH 08/28] Tidy up output lines around new code --- 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 d96a4416..a8676721 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -300,11 +300,12 @@ checkForDependencies(){ # if so, advise the user to run apt-get update/upgrade at their own discretion today=$(date "+%b %e") - + echo ":::" echo -n "::: Checking apt-get for upgraded packages...." updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) & spinner $! echo " done!" + echo ":::" if [ $updatesToInstall > 0 ]; then echo "::: There are $updatesToInstall updates availible for your pi!" echo "::: Please consider running 'sudo apt-get update', followed by 'sudo apt-get upgrade'" From 80bec9c5cfa72ef28c4d7732ad4cb487189045ec Mon Sep 17 00:00:00 2001 From: PromoFaux Date: Mon, 25 Jan 2016 16:28:26 +0000 Subject: [PATCH 09/28] Delete install Not sure how this got in here... :) --- automated install/install | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 automated install/install diff --git a/automated install/install b/automated install/install deleted file mode 100644 index e69de29b..00000000 From 556799428ce6ed9ef41f2429c7bdd2470757f431 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Tue, 26 Jan 2016 20:22:29 +0000 Subject: [PATCH 10/28] Contains default adlists. --- adlists.default | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 adlists.default diff --git a/adlists.default b/adlists.default new file mode 100644 index 00000000..d603c5f0 --- /dev/null +++ b/adlists.default @@ -0,0 +1,8 @@ +https://adaway.org/hosts.txt +http://adblock.gjtech.net/?format=unix-hosts +http://hosts-file.net/ad_servers.txt +http://www.malwaredomainlist.com/hostslist/hosts.txt +http://pgl.yoyo.org/adservers/serverlist.php? +http://someonewhocares.org/hosts/hosts +http://winhelp2002.mvps.org/hosts.txt +http://mirror1.malwaredomains.com/files/justdomains \ No newline at end of file From 352ebc3193d17ae4e075eec7f71bfe909ab8fa06 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Tue, 26 Jan 2016 20:26:09 +0000 Subject: [PATCH 11/28] outsource list of adlists to a file in /etc/pihole/. --- gravity.sh | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/gravity.sh b/gravity.sh index 5097e050..5fbcc82f 100755 --- a/gravity.sh +++ b/gravity.sh @@ -29,6 +29,9 @@ fi piholeIPfile=/tmp/piholeIP piholeIPv6file=/etc/pihole/.useIPv6 +adListFile=/etc/pihole/adlists.list +adListDefault=/etc/pihole/adlists.default + 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) @@ -45,18 +48,8 @@ if [[ -f $piholeIPv6file ]];then piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }') fi -# Ad-list sources--one per line in single quotes -# The mahakala source is commented out due to many users having issues with it blocking legitimate domains. -# Uncomment at your own risk -sources=('https://adaway.org/hosts.txt' -'http://adblock.gjtech.net/?format=unix-hosts' -#'http://adblock.mahakala.is/' -'http://hosts-file.net/ad_servers.txt' -'http://www.malwaredomainlist.com/hostslist/hosts.txt' -'http://pgl.yoyo.org/adservers/serverlist.php?' -'http://someonewhocares.org/hosts/hosts' -'http://winhelp2002.mvps.org/hosts.txt' -'http://mirror1.malwaredomains.com/files/justdomains') + + # Variables for various stages of downloading and formatting the list basename=pihole @@ -97,7 +90,26 @@ spinner(){ ########################### # collapse - begin formation of pihole function gravity_collapse() { - echo -n "::: Neutrino emissions detected..." + echo "::: Neutrino emissions detected..." + echo ":::" + #Decide if we're using a custom ad block list, or defaults. + if [ -f $adListFile ]; then + #custom file found, use this instead of default + echo -n "::: Custom adList file detected. Reading..." + sources=() + while read -a line; do + sources+=($line) + done < $adListFile + echo " done!" + else + #no custom file found, use defaults! + echo -n "::: No custom adlist file detected, reading from default file..." + sources=() + while read -a line; do + sources+=($line) + done < $adListDefault + echo " done!" + fi # Create the pihole resource directory if it doesn't exist. Future files will be stored here if [[ -d $piholeDir ]];then From ef99fe2d18f4dbc1812af4b22de47527a2346752 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Tue, 26 Jan 2016 20:33:49 +0000 Subject: [PATCH 12/28] Add line to copy default ad list into /etc/pihole --- 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 a8676721..dfe279a9 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -434,6 +434,7 @@ runGravity(){ $SUDO echo "::: Preparing to run gravity.sh to refresh hosts..." if ls /etc/pihole/list* 1> /dev/null 2>&1; then echo "::: Cleaning up previous install (preserving whitelist/blacklist)" + $SUDO cp -o /etc/.pihole/adlists.default /etc/pihole/adlists.default $SUDO rm /etc/pihole/list.* fi #Don't run as SUDO, this was causing issues From 4a61b80dd6a43f9a3837eb26cf5e64f1c37e4019 Mon Sep 17 00:00:00 2001 From: PromoFaux Date: Tue, 26 Jan 2016 23:14:38 +0000 Subject: [PATCH 13/28] Update adlists.default Add new line to end of file.. Github was complaining --- adlists.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adlists.default b/adlists.default index d603c5f0..dd391357 100644 --- a/adlists.default +++ b/adlists.default @@ -5,4 +5,4 @@ http://www.malwaredomainlist.com/hostslist/hosts.txt http://pgl.yoyo.org/adservers/serverlist.php? http://someonewhocares.org/hosts/hosts http://winhelp2002.mvps.org/hosts.txt -http://mirror1.malwaredomains.com/files/justdomains \ No newline at end of file +http://mirror1.malwaredomains.com/files/justdomains From ae336da7a154133e2c33222c857afb6bf96a1c00 Mon Sep 17 00:00:00 2001 From: Chad Howell Date: Wed, 27 Jan 2016 01:11:38 -0500 Subject: [PATCH 14/28] Fix formatting, use consistent style, add comments Fix formatting, use consistent style, add comments --- automated install/basic-install.sh | 177 +++++++++++++++-------------- 1 file changed, 90 insertions(+), 87 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d9e448a9..0b78d850 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -59,33 +59,32 @@ else fi fi +# Is this if statement used anymore? if [ -f "/etc/dnsmasq.d/01-pihole.conf" ]; then - #Likely an existing install + # Likely an existing install upgrade=true else - upgrade=false + upgrade=false fi ####### FUNCTIONS ########## ###All credit for the below function goes to http://fitnr.com/showing-a-bash-spinner.html -spinner(){ - local pid=$1 +spinner() { + local pid=$1 - spin='-\|/' - i=0 - while $SUDO kill -0 $pid 2>/dev/null - do - i=$(( (i+1) %4 )) - printf "\b${spin:$i:1}" - sleep .1 - done - printf "\b" + spin='-\|/' + i=0 + while $SUDO kill -0 $pid 2>/dev/null + do + i=$(( (i+1) %4 )) + printf "\b${spin:$i:1}" + sleep .1 + done + printf "\b" } - - - -backupLegacyPihole(){ +backupLegacyPihole() { + # This function detects and backups the pi-hole v1 files. It will not do anything to the current version files. if [[ -f /etc/dnsmasq.d/adList.conf ]];then echo "Original Pi-hole detected. Initiating sub space transport" $SUDO mkdir -p /etc/pihole/original/ @@ -100,7 +99,7 @@ backupLegacyPihole(){ fi } -welcomeDialogs(){ +welcomeDialogs() { # Display the welcome dialog whiptail --msgbox --backtitle "Welcome" --title "Pi-hole automated installer" "This installer will transform your Raspberry Pi into a network-wide ad blocker!" $r $c @@ -112,8 +111,8 @@ welcomeDialogs(){ In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c } -chooseInterface(){ -# Turn the available interfaces into an array so it can be used with a whiptail dialog +chooseInterface() { + # Turn the available interfaces into an array so it can be used with a whiptail dialog interfacesArray=() firstloop=1 @@ -141,7 +140,7 @@ chooseInterface(){ } -use4andor6(){ +use4andor6() { # Let use select IPv4 and/or IPv6 cmd=(whiptail --separate-output --checklist "Select Protocols" $r $c 2) options=(IPv4 "Block ads over IPv4" on @@ -179,14 +178,15 @@ use4andor6(){ fi } -useIPv6dialog(){ +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 mkdir -p /etc/pihole/ $SUDO touch /etc/pihole/.useIPv6 } -getStaticIPv4Settings(){ +getStaticIPv4Settings() { # Ask if the user wants to use DHCP settings as their static IP if (whiptail --backtitle "Calibrating network interface" --title "Static IP Address" --yesno "Do you want to use your current network settings as a static address? IP address: $IPv4addr @@ -241,15 +241,16 @@ getStaticIPv4Settings(){ fi } -setDHCPCD(){ - #Append these lines to dhcpcd.conf to enable a static IP +setDHCPCD() { + # Append these lines to dhcpcd.conf to enable a static IP echo "interface $piholeInterface static ip_address=$IPv4addr static routers=$IPv4gw static domain_name_servers=$IPv4gw" | $SUDO tee -a $dhcpcdFile >/dev/null } -setStaticIPv4(){ +setStaticIPv4() { + # Tries to set the IPv4 address if grep -q $IPv4addr $dhcpcdFile; then # address already set, noop : @@ -260,7 +261,8 @@ setStaticIPv4(){ fi } -installScripts(){ +installScripts() { + # Install the scripts from /etc/.pihole to their various locations $SUDO echo ":::" $SUDO echo -n "::: Installing scripts..." $SUDO cp /etc/.pihole/gravity.sh /usr/local/bin/gravity.sh @@ -273,7 +275,8 @@ installScripts(){ $SUDO echo " done." } -installConfigs(){ +installConfigs() { + # Install the configs from /etc/.pihole to their various locations $SUDO echo ":::" $SUDO echo -n "::: Installing configs..." $SUDO mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig @@ -284,7 +287,8 @@ installConfigs(){ $SUDO echo " done." } -stopServices(){ +stopServices() { + # Stop dnsmasq and lighttpd $SUDO echo ":::" $SUDO echo -n "::: Stopping services..." $SUDO service dnsmasq stop & spinner $! || true @@ -292,14 +296,14 @@ stopServices(){ $SUDO echo " done." } -checkForDependencies(){ - echo ":::" - #Check to see if apt-get update has already been run today - timestamp=$(stat -c %Y /var/cache/apt/) - timestampAsDate=$(date -d @$timestamp "+%b %e") - today=$(date "+%b %e") - - if [ ! "$today" == "$timestampAsDate" ]; then +checkForDependencies() { + echo ":::" + #Check to see if apt-get update has already been run today + timestamp=$(stat -c %Y /var/cache/apt/) + timestampAsDate=$(date -d @$timestamp "+%b %e") + today=$(date "+%b %e") + + if [ ! "$today" == "$timestampAsDate" ]; then #update package lists echo -n "::: Updating package list before install...." $SUDO apt-get -qq update > /dev/null & spinner $! @@ -308,64 +312,59 @@ checkForDependencies(){ $SUDO apt-get -y -qq upgrade > /dev/null & spinner $! echo " done!" else - echo "::: Apt-get update already run today, any more would be overkill..." + echo "::: Apt-get update already run today, any more would be overkill..." fi - - + echo ":::" echo "::: Checking dependencies:" - dependencies=( dnsutils bc toilet figlet dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget ) - for i in "${dependencies[@]}" - do - : - echo -n "::: Checking for $i..." - if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then - echo -n " Not found! Installing...." - $SUDO apt-get -y -qq install $i > /dev/null & spinner $! - echo " done!" - else - echo " already installed!" - fi - done + dependencies=( dnsutils bc toilet figlet dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget ) + for i in "${dependencies[@]}" + do + : + echo -n "::: Checking for $i..." + if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then + echo -n " Not found! Installing...." + $SUDO apt-get -y -qq install $i > /dev/null & spinner $! + echo " done!" + else + echo " already installed!" + fi + done } -getGitFiles(){ - - echo ":::" +getGitFiles() { + # Setup git repos for base files and web admin + echo ":::" echo "::: Checking for existing base files..." if is_repo $piholeFilesDir; then - make_repo $piholeFilesDir $piholeGitUrl - else - update_repo $piholeFilesDir - fi - - echo ":::" - echo "::: Checking for existing web interface..." - if is_repo $webInterfaceDir; then - make_repo $webInterfaceDir $webInterfaceGitUrl - else - update_repo $webInterfaceDir - - fi + make_repo $piholeFilesDir $piholeGitUrl + else + update_repo $piholeFilesDir + fi + echo ":::" + echo "::: Checking for existing web interface..." + if is_repo $webInterfaceDir; then + make_repo $webInterfaceDir $webInterfaceGitUrl + else + update_repo $webInterfaceDir + fi } is_repo() { - echo -n "::: Checking $1 is a repo..." - # if the directory does not have a .git folder - # it is not a repo + # If the directory does not have a .git folder it is not a repo + echo -n "::: Checking $1 is a repo..." if [ -d "$1/.git" ]; then echo " OK!" return 1 fi echo " not found!!" return 0 - } make_repo() { - # remove the non-repod interface and clone the interface + # Remove the non-repod interface and clone the interface echo -n "::: Cloning $2 into $1..." $SUDO rm -rf $1 $SUDO git clone -q "$2" "$1" > /dev/null & spinner $! @@ -373,7 +372,7 @@ make_repo() { } update_repo() { - # pull the latest commits + # Pull the latest commits echo -n "::: Updating repo in $1..." cd "$1" $SUDO git pull -q > /dev/null & spinner $! @@ -381,7 +380,8 @@ update_repo() { } -CreateLogFile(){ +CreateLogFile() { + # Create logfiles if necessary echo ":::" $SUDO echo -n "::: Creating log file and changing owner to dnsmasq..." if [ ! -f /var/log/pihole.log ]; then @@ -391,11 +391,11 @@ CreateLogFile(){ $SUDO echo " done!" else $SUDO echo " already exists!" - fi - + fi } -installPiholeWeb(){ +installPiholeWeb() { + # Install the web interface $SUDO echo ":::" $SUDO echo -n "::: Installing pihole custom index page..." if [ -d "/var/www/html/pihole" ]; then @@ -406,17 +406,18 @@ installPiholeWeb(){ $SUDO cp /etc/.pihole/advanced/index.html /var/www/html/pihole/index.html $SUDO echo " done!" fi - } -installCron(){ +installCron() { + # Install the cron job $SUDO echo ":::" $SUDO echo -n "::: Installing latest Cron script..." $SUDO cp /etc/.pihole/advanced/pihole.cron /etc/cron.d/pihole $SUDO echo " done!" } -runGravity(){ +runGravity() { + # Rub gravity.sh to build blacklists $SUDO echo ":::" $SUDO echo "::: Preparing to run gravity.sh to refresh hosts..." if ls /etc/pihole/list* 1> /dev/null 2>&1; then @@ -426,13 +427,13 @@ runGravity(){ #Don't run as SUDO, this was causing issues echo "::: Running gravity.sh" echo ":::" - + /usr/local/bin/gravity.sh - } -installPihole(){ +installPihole() { + # Install base files and web interface checkForDependencies # done stopServices @@ -451,8 +452,9 @@ installPihole(){ runGravity } -displayFinalMessage(){ -whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using: +displayFinalMessage() { + # Final completion message to user + whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using: $IPv4addr $piholeIPv6 @@ -483,5 +485,6 @@ $SUDO mv $tmpLog $instalLogLoc displayFinalMessage +# Start services $SUDO service dnsmasq start $SUDO service lighttpd start From b1bd56cd517898d6bab51abbcb9adc72559500b2 Mon Sep 17 00:00:00 2001 From: PromoFaux Date: Wed, 27 Jan 2016 09:47:28 +0000 Subject: [PATCH 15/28] Update basic-install.sh --- 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 dfe279a9..29d0cec6 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -434,7 +434,7 @@ runGravity(){ $SUDO echo "::: Preparing to run gravity.sh to refresh hosts..." if ls /etc/pihole/list* 1> /dev/null 2>&1; then echo "::: Cleaning up previous install (preserving whitelist/blacklist)" - $SUDO cp -o /etc/.pihole/adlists.default /etc/pihole/adlists.default + $SUDO cp /etc/.pihole/adlists.default /etc/pihole/adlists.default $SUDO rm /etc/pihole/list.* fi #Don't run as SUDO, this was causing issues From 98a0d17431df81e40d505ad19eb29909e9c9618a Mon Sep 17 00:00:00 2001 From: PromoFaux Date: Wed, 27 Jan 2016 15:28:40 +0000 Subject: [PATCH 16/28] Update basic-install.sh Emergency Bug fix. I take the blame for this one, it got lost in a merge! --- 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 a8676721..94fd0b46 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -182,7 +182,7 @@ use4andor6(){ useIPv6dialog(){ 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 mkdir -p /etc/pihole/ + $SUDO touch /etc/pihole/.useIPv6 } @@ -448,7 +448,7 @@ runGravity(){ installPihole(){ checkForDependencies # done stopServices - + $SUDO mkdir -p /etc/pihole/ $SUDO chown www-data:www-data /var/www/html $SUDO chmod 775 /var/www/html $SUDO usermod -a -G www-data pi From 701ae06e4aa17c89f02703e1937cdadd56825399 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Wed, 27 Jan 2016 21:14:06 +0000 Subject: [PATCH 17/28] Move copying of adlists.default to gravity.sh --- automated install/basic-install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index dfe279a9..39a043d9 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -431,10 +431,9 @@ installCron(){ runGravity(){ $SUDO echo ":::" - $SUDO echo "::: Preparing to run gravity.sh to refresh hosts..." + $SUDO echo "::: Preparing to run gravity.sh to refresh hosts..." if ls /etc/pihole/list* 1> /dev/null 2>&1; then - echo "::: Cleaning up previous install (preserving whitelist/blacklist)" - $SUDO cp -o /etc/.pihole/adlists.default /etc/pihole/adlists.default + echo "::: Cleaning up previous install (preserving whitelist/blacklist)" $SUDO rm /etc/pihole/list.* fi #Don't run as SUDO, this was causing issues From b75b290351f60f694a95b75211e5aeb9dc558ced Mon Sep 17 00:00:00 2001 From: Promofaux Date: Wed, 27 Jan 2016 21:14:23 +0000 Subject: [PATCH 18/28] adlists.default copied on each run of gravity. In case it has been overwritten --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 5fbcc82f..11689479 100755 --- a/gravity.sh +++ b/gravity.sh @@ -331,7 +331,7 @@ function gravity_reload() { echo " done!" } - +$SUDO cp -o /etc/.pihole/adlists.default /etc/pihole/adlists.default gravity_collapse gravity_spinup gravity_Schwarzchild From 3d78b44a8ee5933a4dfe7f7396e161681a5af0d6 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Wed, 27 Jan 2016 22:32:08 +0000 Subject: [PATCH 19/28] Changes as in #253, but with less commits to keep the repo tidy --- automated install/basic-install.sh | 67 ++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index a8676721..ed5fd60d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -16,7 +16,9 @@ # # curl -L install.pi-hole.net | bash + ######## VARIABLES ######### + tmpLog=/tmp/pihole-install.log instalLogLoc=/etc/pihole/install.log @@ -34,7 +36,9 @@ columns=$(tput cols) r=$(( rows / 2 )) c=$(( columns / 2 )) + # Find IP used to route to outside world + IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') IPv4addr=$(ip -o -f inet addr show dev $IPv4dev | awk '{print $4}' | awk 'END {print}') IPv4gw=$(ip route get 8.8.8.8 | awk '{print $3}') @@ -59,7 +63,7 @@ else fi fi -if [ -f "/etc/dnsmasq.d/01-pihole.conf" ]; then +if [ -d "/etc/pihole" ]; then #Likely an existing install upgrade=true else @@ -182,7 +186,7 @@ use4andor6(){ useIPv6dialog(){ 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 mkdir -p /etc/pihole/ + $SUDO touch /etc/pihole/.useIPv6 } @@ -256,7 +260,9 @@ setStaticIPv4(){ else setDHCPCD $SUDO ip addr replace dev $piholeInterface $IPv4addr - echo "Setting IP to $IPv4addr. You may need to restart after the install is complete." + echo ":::" + echo "::: Setting IP to $IPv4addr. You may need to restart after the install is complete." + echo ":::" fi } @@ -269,7 +275,7 @@ installScripts(){ $SUDO cp /etc/.pihole/advanced/Scripts/blacklist.sh /usr/local/bin/blacklist.sh $SUDO cp /etc/.pihole/advanced/Scripts/piholeLogFlush.sh /usr/local/bin/piholeLogFlush.sh $SUDO cp /etc/.pihole/advanced/Scripts/updateDashboard.sh /usr/local/bin/updateDashboard.sh - $SUDO chmod 755 /usr/local/bin/{gravity,chronometer,whitelist,blacklist,piholeLogFlush,updateDashboard}.sh + $SUDO chmod 755 /usr/local/bin/{gravity,chronometer,whitelist,blacklist,piholeLogFlush,updateDashboard}.sh $SUDO echo " done." } @@ -299,30 +305,47 @@ checkForDependencies(){ #We'll change the logic up here, to check to see if there are any updates availible and # if so, advise the user to run apt-get update/upgrade at their own discretion + + #Check to see if apt-get update has already been run today + # it needs to have been run at least once on new installs! + + timestamp=$(stat -c %Y /var/cache/apt/) + timestampAsDate=$(date -d @$timestamp "+%b %e") today=$(date "+%b %e") - echo ":::" + + if [ ! "$today" == "$timestampAsDate" ]; then + #update package lists + echo ":::" + echo -n "::: apt-get update has not been run today. Running now..." + $SUDO apt-get -qq update & spinner $! + echo " done!" + fi + + echo ":::" echo -n "::: Checking apt-get for upgraded packages...." - updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) & spinner $! + updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) echo " done!" - + echo ":::" - if [ $updatesToInstall > 0 ]; then + if [[ $updatesToInstall -eq "0" ]]; then + echo "::: Your pi is up to date! Continuing with pi-hole installation..." + else echo "::: There are $updatesToInstall updates availible for your pi!" - echo "::: Please consider running 'sudo apt-get update', followed by 'sudo apt-get upgrade'" - echo "::: after pi-hole has finished installing." + echo "::: Please run 'sudo apt-get upgrade' before continuing with installation" echo ":::" + echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!" + echo ":::" + + exit 1 #add in a prompt to give users the option to quit installation or continue - echo -n "::: Would you like to continue with the pi-hole installation? (Y/n):" - read answer + #echo -n "::: Would you like to continue with the pi-hole installation? (Y/n):" + #read answer - case "$answer" in - [yY][eE][sS]|[yY] ) echo "::: Continuing!";; - * ) echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!" - exit 0;; - esac - - else - echo "::: Your pi is up to date! Continuing with pi-hole installation..." + #case "$answer" in + # [yY][eE][sS]|[yY] ) echo "::: Continuing!";; + # * ) echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!" + + #esac fi echo ":::" @@ -477,6 +500,7 @@ The install log is in /etc/pihole." $r $c ######## SCRIPT ############ # Start the installer +$SUDO mkdir -p /etc/pihole/ welcomeDialogs # Just back up the original Pi-hole right away since it won't take long and it gets it out of the way @@ -486,8 +510,6 @@ chooseInterface # Let the user decide if they want to block ads over IPv4 and/or IPv6 use4andor6 - - # Install and log everything to a file installPihole | tee $tmpLog @@ -495,6 +517,5 @@ installPihole | tee $tmpLog $SUDO mv $tmpLog $instalLogLoc displayFinalMessage - $SUDO service dnsmasq start $SUDO service lighttpd start From 5111880edfe44447dc7ea92b8e56d06933086918 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Wed, 27 Jan 2016 22:35:52 +0000 Subject: [PATCH 20/28] remove erroneous -o --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 11689479..3004b8a2 100755 --- a/gravity.sh +++ b/gravity.sh @@ -331,7 +331,7 @@ function gravity_reload() { echo " done!" } -$SUDO cp -o /etc/.pihole/adlists.default /etc/pihole/adlists.default +$SUDO cp /etc/.pihole/adlists.default /etc/pihole/adlists.default gravity_collapse gravity_spinup gravity_Schwarzchild From c00fb44cee77ae61e44acc1cb00e55c1ca457f9e Mon Sep 17 00:00:00 2001 From: Promofaux Date: Wed, 27 Jan 2016 23:28:36 +0000 Subject: [PATCH 21/28] Do not force apt-get upgrade on the user. Instead, advise them. We only need to make sure apt-get update has been run --- automated install/basic-install.sh | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index ed5fd60d..745566aa 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -331,21 +331,8 @@ checkForDependencies(){ echo "::: Your pi is up to date! Continuing with pi-hole installation..." else echo "::: There are $updatesToInstall updates availible for your pi!" - echo "::: Please run 'sudo apt-get upgrade' before continuing with installation" + echo "::: We recommend you run 'sudo apt-get upgrade' after installing Pi-Hole! " echo ":::" - echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!" - echo ":::" - - exit 1 - #add in a prompt to give users the option to quit installation or continue - #echo -n "::: Would you like to continue with the pi-hole installation? (Y/n):" - #read answer - - #case "$answer" in - # [yY][eE][sS]|[yY] ) echo "::: Continuing!";; - # * ) echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!" - - #esac fi echo ":::" @@ -518,4 +505,4 @@ $SUDO mv $tmpLog $instalLogLoc displayFinalMessage $SUDO service dnsmasq start -$SUDO service lighttpd start +$SUDO service lighttpd start \ No newline at end of file From cadc506aa59b727cbdbf89abb8418a642504db81 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 28 Jan 2016 09:25:00 +0000 Subject: [PATCH 22/28] Remove extraneous whitespace from basic-install.sh --- automated install/basic-install.sh | 64 +++++++++++++++--------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index ba682e5b..871f1884 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -106,10 +106,10 @@ backupLegacyPihole() { welcomeDialogs() { # Display the welcome dialog whiptail --msgbox --backtitle "Welcome" --title "Pi-hole automated installer" "This installer will transform your Raspberry Pi into a network-wide ad blocker!" $r $c - + # Support for a part-time dev whiptail --msgbox --backtitle "Plea" --title "Free and open source" "The Pi-hole is free, but powered by your donations: http://pi-hole.net/donate" $r $c - + # Explain the need for a static address whiptail --msgbox --backtitle "Initating network interface" --title "Static IP Needed" "The Pi-hole is a SERVER so it needs a STATIC IP ADDRESS to function properly. In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c @@ -119,7 +119,7 @@ chooseInterface() { # Turn the available interfaces into an array so it can be used with a whiptail dialog interfacesArray=() firstloop=1 - + while read -r line do mode="OFF" @@ -129,12 +129,12 @@ chooseInterface() { fi interfacesArray+=("$line" "available" "$mode") done <<< "$availableInterfaces" - + # 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) chooseInterfaceOptions=$("${chooseInterfaceCmd[@]}" "${interfacesArray[@]}" 2>&1 >/dev/tty) - + for desiredInterface in $chooseInterfaceOptions do piholeInterface=$desiredInterface @@ -186,7 +186,7 @@ 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 } @@ -271,13 +271,13 @@ installScripts() { # Install the scripts from /etc/.pihole to their various locations $SUDO echo ":::" $SUDO echo -n "::: Installing scripts..." - $SUDO cp /etc/.pihole/gravity.sh /usr/local/bin/gravity.sh + $SUDO cp /etc/.pihole/gravity.sh /usr/local/bin/gravity.sh $SUDO cp /etc/.pihole/advanced/Scripts/chronometer.sh /usr/local/bin/chronometer.sh - $SUDO cp /etc/.pihole/advanced/Scripts/whitelist.sh /usr/local/bin/whitelist.sh - $SUDO cp /etc/.pihole/advanced/Scripts/blacklist.sh /usr/local/bin/blacklist.sh - $SUDO cp /etc/.pihole/advanced/Scripts/piholeLogFlush.sh /usr/local/bin/piholeLogFlush.sh - $SUDO cp /etc/.pihole/advanced/Scripts/updateDashboard.sh /usr/local/bin/updateDashboard.sh - $SUDO chmod 755 /usr/local/bin/{gravity,chronometer,whitelist,blacklist,piholeLogFlush,updateDashboard}.sh + $SUDO cp /etc/.pihole/advanced/Scripts/whitelist.sh /usr/local/bin/whitelist.sh + $SUDO cp /etc/.pihole/advanced/Scripts/blacklist.sh /usr/local/bin/blacklist.sh + $SUDO cp /etc/.pihole/advanced/Scripts/piholeLogFlush.sh /usr/local/bin/piholeLogFlush.sh + $SUDO cp /etc/.pihole/advanced/Scripts/updateDashboard.sh /usr/local/bin/updateDashboard.sh + $SUDO chmod 755 /usr/local/bin/{gravity,chronometer,whitelist,blacklist,piholeLogFlush,updateDashboard}.sh $SUDO echo " done." } @@ -287,8 +287,8 @@ installConfigs() { $SUDO echo -n "::: Installing configs..." $SUDO mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig $SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig - $SUDO cp /etc/.pihole/advanced/dnsmasq.conf /etc/dnsmasq.conf - $SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf + $SUDO cp /etc/.pihole/advanced/dnsmasq.conf /etc/dnsmasq.conf + $SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf $SUDO sed -i "s/@INT@/$piholeInterface/" /etc/dnsmasq.conf $SUDO echo " done." } @@ -297,8 +297,8 @@ stopServices() { # Stop dnsmasq and lighttpd $SUDO echo ":::" $SUDO echo -n "::: Stopping services..." - $SUDO service dnsmasq stop & spinner $! || true - $SUDO service lighttpd stop & spinner $! || true + $SUDO service dnsmasq stop & spinner $! || true + $SUDO service lighttpd stop & spinner $! || true $SUDO echo " done." } @@ -315,26 +315,26 @@ checkForDependencies() { timestampAsDate=$(date -d @$timestamp "+%b %e") today=$(date "+%b %e") - if [ ! "$today" == "$timestampAsDate" ]; then + if [ ! "$today" == "$timestampAsDate" ]; then #update package lists echo ":::" echo -n "::: apt-get update has not been run today. Running now..." $SUDO apt-get -qq update & spinner $! echo " done!" - fi - echo ":::" + fi + echo ":::" echo -n "::: Checking apt-get for upgraded packages...." updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) echo " done!" echo ":::" if [[ $updatesToInstall -eq "0" ]]; then echo "::: Your pi is up to date! Continuing with pi-hole installation..." - else + else echo "::: There are $updatesToInstall updates availible for your pi!" - echo "::: We recommend you run 'sudo apt-get upgrade' after installing Pi-Hole! " + echo "::: We recommend you run 'sudo apt-get upgrade' after installing Pi-Hole! " echo ":::" fi - echo ":::" + echo ":::" echo "::: Checking dependencies:" dependencies=( dnsutils bc toilet figlet dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget ) @@ -356,16 +356,16 @@ getGitFiles() { # Setup git repos for base files and web admin echo ":::" echo "::: Checking for existing base files..." - if is_repo $piholeFilesDir; then - make_repo $piholeFilesDir $piholeGitUrl + if is_repo $piholeFilesDir; then + make_repo $piholeFilesDir $piholeGitUrl else - update_repo $piholeFilesDir + update_repo $piholeFilesDir fi - echo ":::" + echo ":::" echo "::: Checking for existing web interface..." - if is_repo $webInterfaceDir; then - make_repo $webInterfaceDir $webInterfaceGitUrl + if is_repo $webInterfaceDir; then + make_repo $webInterfaceDir $webInterfaceGitUrl else update_repo $webInterfaceDir fi @@ -410,7 +410,7 @@ CreateLogFile() { $SUDO echo " done!" else $SUDO echo " already exists!" - fi + fi } installPiholeWeb() { @@ -460,8 +460,8 @@ installPihole() { $SUDO chmod 775 /var/www/html $SUDO usermod -a -G www-data pi $SUDO lighty-enable-mod fastcgi fastcgi-php > /dev/null - - getGitFiles + + getGitFiles installScripts installConfigs #installWebAdmin @@ -505,4 +505,4 @@ displayFinalMessage # Start services $SUDO service dnsmasq start -$SUDO service lighttpd start \ No newline at end of file +$SUDO service lighttpd start From 5fa0d798e2e22963cc50983988adf83b1d9b9677 Mon Sep 17 00:00:00 2001 From: PromoFaux Date: Thu, 28 Jan 2016 10:13:55 +0000 Subject: [PATCH 23/28] Update README.md Add link to segment on MSDN/Channel 9's Defrag Show --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cc58b154..19ab0241 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei - [Minibian Pi-hole](http://munkjensen.net/wiki/index.php/See_my_Pi-Hole#Minibian_Pi-hole) ## Coverage +- [The Defrag Show - MSDN/Channel 9](https://channel9.msdn.com/Shows/The-Defrag-Show/Defrag-Endoscope-USB-Camera-The-Final-HoloLens-Vote-Adblock-Pi-and-more?WT.mc_id=dlvr_twitter_ch9#time=20m39s) - [MacObserver Podcast 585](http://www.macobserver.com/tmo/podcast/macgeekgab-585) - [Medium: Block All Ads For $53](https://medium.com/@robleathern/block-ads-on-all-home-devices-for-53-18-a5f1ec139693#.gj1xpgr5d) - [MakeUseOf: Adblock Everywhere, The Pi-hole Way](http://www.makeuseof.com/tag/adblock-everywhere-raspberry-pi-hole-way/) From 49a56cf131ccd2109713eaddf4f7c2c4d0feaf2c Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Fri, 29 Jan 2016 08:25:35 -0500 Subject: [PATCH 24/28] Start on new versioning --- automated install/basic-install.sh | 3 ++- version.txt | 0 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 version.txt diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 762de49c..bbc8b25f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -285,7 +285,8 @@ installConfigs(){ $SUDO mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig $SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig $SUDO cp /etc/.pihole/advanced/dnsmasq.conf /etc/dnsmasq.conf - $SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf + $SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf + $SUDO cp /etc/.pihole/version.txt /etc/pihole/version.txt $SUDO sed -i "s/@INT@/$piholeInterface/" /etc/dnsmasq.conf $SUDO echo " done." } diff --git a/version.txt b/version.txt new file mode 100644 index 00000000..e69de29b From 0ece58b9cbf64f61c0470a4f56bc5c991eadcac1 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Fri, 29 Jan 2016 12:23:03 -0500 Subject: [PATCH 25/28] Add version --- automated install/basic-install.sh | 4 ++-- version.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index bbc8b25f..60df899b 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -286,7 +286,7 @@ installConfigs(){ $SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig $SUDO cp /etc/.pihole/advanced/dnsmasq.conf /etc/dnsmasq.conf $SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf - $SUDO cp /etc/.pihole/version.txt /etc/pihole/version.txt + $SUDO cp /etc/.pihole/version.txt /etc/pihole/version.txt $SUDO sed -i "s/@INT@/$piholeInterface/" /etc/dnsmasq.conf $SUDO echo " done." } @@ -506,4 +506,4 @@ $SUDO mv $tmpLog $instalLogLoc displayFinalMessage $SUDO service dnsmasq start -$SUDO service lighttpd start \ No newline at end of file +$SUDO service lighttpd start diff --git a/version.txt b/version.txt index e69de29b..7208c218 100644 --- a/version.txt +++ b/version.txt @@ -0,0 +1 @@ +2.4 \ No newline at end of file From 895647b908c70764fda728c392183da18ce8815b Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Fri, 29 Jan 2016 12:32:58 -0500 Subject: [PATCH 26/28] Don't copy version to install dir --- automated install/basic-install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 60df899b..67df56be 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -286,7 +286,6 @@ installConfigs(){ $SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig $SUDO cp /etc/.pihole/advanced/dnsmasq.conf /etc/dnsmasq.conf $SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf - $SUDO cp /etc/.pihole/version.txt /etc/pihole/version.txt $SUDO sed -i "s/@INT@/$piholeInterface/" /etc/dnsmasq.conf $SUDO echo " done." } From b93e46de1438e5e93b0f640f0914ee7c39d6ffe0 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sat, 30 Jan 2016 14:55:02 +0000 Subject: [PATCH 27/28] Update basic-install.sh --- automated install/basic-install.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index f3771764..cd1b1efa 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -287,11 +287,7 @@ installConfigs() { $SUDO echo -n "::: Installing configs..." $SUDO mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig $SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig -<<<<<<< HEAD - $SUDO cp /etc/.pihole/advanced/dnsmasq.conf /etc/dnsmasq.conf -======= $SUDO cp /etc/.pihole/advanced/dnsmasq.conf /etc/dnsmasq.conf ->>>>>>> CBH/Bugfix/Formatting $SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf $SUDO sed -i "s/@INT@/$piholeInterface/" /etc/dnsmasq.conf $SUDO echo " done." From b83704dac206f30ab8caf4ad454f78c5519117ae Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Sat, 30 Jan 2016 10:20:01 -0600 Subject: [PATCH 28/28] splunk app --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 19ab0241..a0bf4cc3 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei - [Minibian Pi-hole](http://munkjensen.net/wiki/index.php/See_my_Pi-Hole#Minibian_Pi-hole) ## Coverage +- [Splunk: Pi-hole Visualizser](https://splunkbase.splunk.com/app/3023/) - [The Defrag Show - MSDN/Channel 9](https://channel9.msdn.com/Shows/The-Defrag-Show/Defrag-Endoscope-USB-Camera-The-Final-HoloLens-Vote-Adblock-Pi-and-more?WT.mc_id=dlvr_twitter_ch9#time=20m39s) - [MacObserver Podcast 585](http://www.macobserver.com/tmo/podcast/macgeekgab-585) - [Medium: Block All Ads For $53](https://medium.com/@robleathern/block-ads-on-all-home-devices-for-53-18-a5f1ec139693#.gj1xpgr5d)