From 5ee382c8ebd96b920133e82c30079dcb6f6e6ab8 Mon Sep 17 00:00:00 2001 From: nate Date: Sat, 26 Mar 2016 17:00:52 -0500 Subject: [PATCH] Roll back addition of piholeDebug.sh (production master base) --- advanced/Scripts/piholeDebug.sh | 157 ----------------------------- automated install/basic-install.sh | 3 +- 2 files changed, 1 insertion(+), 159 deletions(-) delete mode 100644 advanced/Scripts/piholeDebug.sh diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh deleted file mode 100644 index ead75cd9..00000000 --- a/advanced/Scripts/piholeDebug.sh +++ /dev/null @@ -1,157 +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 -# Flushes /var/log/pihole.log -# -# 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. - -# Nate Brandeburg -# nate@ubiquisoft.com -# 3/19/2016 - -######## GLOBAL VARS ######## -DEBUG_LOG="/var/log/pihole_debug.log" - -######## FIRST CHECK ######## -# Must be root to debug -if [[ $EUID -eq 0 ]];then - echo "::: You are root... Beginning debug!" -else - echo "::: sudo will be used for debugging." - # Check if sudo is actually installed - if [[ $(dpkg-query -s sudo) ]];then - export SUDO="sudo" - else - echo "::: Please install sudo or run this as root." - exit 1 - fi -fi - -# Ensure the file exists, create if not, clear if exists. -if [ ! -f "$DEBUG_LOG" ] -then - $SUDO touch $DEBUG_LOG - $SUDO chmod 644 $DEBUG_LOG - $SUDO chown "$USER":root $DEBUG_LOG -else - truncate -s 0 $DEBUG_LOG -fi - -### Check Pi internet connections ### -# Log the IP addresses of this Pi -IPADDR=$(ifconfig | perl -nle 's/dr:(\S+)/print $1/e') -echo "Writing local IPs to debug log" -echo "IP Addresses of this Pi:" >> $DEBUG_LOG -echo "$IPADDR" >> $DEBUG_LOG -echo >> $DEBUG_LOG - -# Check if we can connect to the local gateway -GATEWAY_CHECK=$(ping -q -w 1 -c 1 "$(ip r | grep default | cut -d ' ' -f 3)" > /dev/null && echo ok || echo error) -echo "Gateway check:" >> $DEBUG_LOG -echo "$GATEWAY_CHECK" >> $DEBUG_LOG -echo >> $DEBUG_LOG - -echo "Writing dnsmasq.conf to debug log..." -echo "############### Dnsmasq ###############" >> $DEBUG_LOG -DNSMASQFILE="/etc/dnsmasq.conf" -if [ -e "$DNSMASQFILE" ] -then - cat $DNSMASQFILE >> $DEBUG_LOG - echo >> $DEBUG_LOG -else - echo "No dnsmasq.conf file found!" >> $DEBUG_LOG - echo "No dnsmasq.conf file found!" -fi - -echo "Writing hosts file to debug log..." -echo "############### Hosts ###############" >> $DEBUG_LOG -HOSTSFILE="/etc/hosts" -if [ -e "$HOSTSFILE" ] -then - cat "$HOSTSFILE" >> $DEBUG_LOG - echo >> $DEBUG_LOG -else - echo "No hosts file found!" >> $DEBUG_LOG - echo "No hosts file found!" -fi - -### PiHole application specific logging ### -# Write Pi-Hole logs to debug log -echo "Writing whitelist to debug log..." -echo "############### Whitelist ###############" >> $DEBUG_LOG -WHITELISTFILE="/etc/pihole/whitelist.txt" -if [ -e "$WHITELISTFILE" ] -then - cat "$WHITELISTFILE" >> $DEBUG_LOG - echo >> $DEBUG_LOG -else - echo "No whitelist.txt file found!" >> $DEBUG_LOG - echo "No whitelist.txt file found!" -fi - -echo "Writing blacklist to debug log..." -echo "############### Blacklist ###############" >> $DEBUG_LOG -BLACKLISTFILE="/etc/pihole/blacklist.txt" -if [ -e "$BLACKLISTFILE" ] -then - cat "$BLACKLISTFILE" >> $DEBUG_LOG - echo >> $DEBUG_LOG -else - echo "No blacklist.txt file found!" >> $DEBUG_LOG - echo "No blacklist.txt file found!" -fi - -echo "Writing adlists.list to debug log..." -echo "############### adlists.list ###############" >> $DEBUG_LOG -ADLISTSFILE="/etc/pihole/adlists.list" -if [ -e "$ADLISTSFILE" ] -then - cat "$ADLISTSFILE" >> $DEBUG_LOG - echo >> $DEBUG_LOG -else - echo "No adlists.list file found!" >> $DEBUG_LOG - echo "No adlists.list file found!" -fi - - -# Continuously append the pihole.log file to the pihole_debug.log file -function dumpPiHoleLog { - trap '{ echo -e "\nFinishing debug write from interrupt... Quitting!" ; exit 1; }' INT - echo -e "Writing current pihole traffic to debug log...\nTry loading any/all sites that you are having trouble with now... (Press ctrl+C to finish)" - echo "############### pihole.log ###############" >> $DEBUG_LOG - PIHOLELOG="/var/log/pihole.log" - if [ -e "$PIHOLELOG" ] - then - while true; do - tail -f "$PIHOLELOG" >> $DEBUG_LOG - echo >> $DEBUG_LOG - done - else - echo "No pihole.log file found!" >> $DEBUG_LOG - echo "No pihole.log file found!" - fi -} - -function finalWrites { - # Write the gravity.list after the user is finished capturing the pihole.log output - echo "Writing gravity.list to debug log..." - echo "############### gravity.list ###############" >> $DEBUG_LOG - GRAVITYFILE="/etc/pihole/gravity.list" - if [ -e "$GRAVITYFILE" ] - then - cat /etc/pihole/gravity.list >> $DEBUG_LOG - echo >> $DEBUG_LOG - else - echo "No gravity.list file found!" >> $DEBUG_LOG - echo "No gravity.list file found" - fi -} -trap finalWrites EXIT - -### Method calls for additinal logging ### -dumpPiHoleLog diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 2f910c03..d3ba437f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -477,8 +477,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 cp /etc/.pihole/advanced/Scripts/piholeDebug.sh /usr/local/bin/piholeDebug.sh - $SUDO chmod 755 /usr/local/bin/{gravity,chronometer,whitelist,blacklist,piholeLogFlush,updateDashboard,piholeDebug}.sh + $SUDO chmod 755 /usr/local/bin/{gravity,chronometer,whitelist,blacklist,piholeLogFlush,updateDashboard}.sh $SUDO echo " done." }