mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Reduce header verbosity. New header writer.
This commit is contained in:
parent
4839953328
commit
01f17f9cbb
1 changed files with 48 additions and 72 deletions
|
@ -50,12 +50,16 @@ log_write() {
|
|||
echo "${1}" >> "${DEBUG_LOG}"
|
||||
}
|
||||
|
||||
version_check() {
|
||||
log_write "############################################################"
|
||||
log_write "########## Installed Versions ##########"
|
||||
log_write "############################################################"
|
||||
header_write() {
|
||||
echo "" >> "${DEBUG_LOG}"
|
||||
echo "::: ${1}" >> "${DEBUG_LOG}"
|
||||
echo "" >> "${DEBUG_LOG}"
|
||||
}
|
||||
|
||||
version_check() {
|
||||
header_write "Installed Package Versions"
|
||||
echo "::: Detecting Pi-hole installed versions."
|
||||
|
||||
pi_hole_ver="$(cd /etc/.pihole/ && git describe --tags --abbrev=0)" \
|
||||
&& log_write "Pi-hole Version: $pi_hole_ver" || log_write "Pi-hole git repository not detected."
|
||||
admin_ver="$(cd /var/www/html/admin && git describe --tags --abbrev=0)" \
|
||||
|
@ -69,9 +73,7 @@ version_check() {
|
|||
}
|
||||
|
||||
files_check() {
|
||||
log_write "############################################################"
|
||||
log_write "########## Files Check ##########"
|
||||
log_write "############################################################"
|
||||
header_write "Files Check"
|
||||
|
||||
#Check existence of setupVars.conf, and source it to get configured network interface for later use in script.
|
||||
echo -n "::: Detecting existence setupVars.conf..."
|
||||
|
@ -99,9 +101,7 @@ files_check() {
|
|||
}
|
||||
|
||||
distro_check() {
|
||||
log_write "############################################################"
|
||||
log_write "######## Installed OS Distribution #########"
|
||||
log_write "############################################################"
|
||||
header_write "Installed OS Distribution"
|
||||
|
||||
echo "::: Checking installed OS Distribution release."
|
||||
TMP=$(cat /etc/*release || echo "Failed to find release")
|
||||
|
@ -112,9 +112,7 @@ distro_check() {
|
|||
}
|
||||
|
||||
ip_check() {
|
||||
log_write "############################################################"
|
||||
log_write "######## IP Address Information #########"
|
||||
log_write "############################################################"
|
||||
header_write "IP Address Information"
|
||||
|
||||
echo "::: Writing local IPs to logfile"
|
||||
IPADDR="$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet") print $(i+1) }')"
|
||||
|
@ -176,9 +174,7 @@ ip_check() {
|
|||
}
|
||||
|
||||
hostnameCheck() {
|
||||
log_write "############################################################"
|
||||
log_write "######## Hostname Information #########"
|
||||
log_write "############################################################"
|
||||
header_write "Hostname Information"
|
||||
|
||||
echo "::: Writing locally configured hostnames to logfile"
|
||||
# Write the hostname output to compare against entries in /etc/hosts, which is logged next
|
||||
|
@ -197,9 +193,7 @@ hostnameCheck() {
|
|||
}
|
||||
|
||||
portCheck() {
|
||||
log_write "############################################################"
|
||||
log_write "######## Open Port Information #########"
|
||||
log_write "############################################################"
|
||||
header_write "Open Port Information"
|
||||
|
||||
echo "::: Detecting local server port 80 and 53 processes."
|
||||
|
||||
|
@ -209,10 +203,7 @@ portCheck() {
|
|||
}
|
||||
|
||||
testResolver() {
|
||||
log_write "############################################################"
|
||||
log_write "############ Resolver Functions Check ############"
|
||||
log_write "############################################################"
|
||||
|
||||
header_write "Resolver Functions Check"
|
||||
|
||||
# Find a blocked url that has not been whitelisted.
|
||||
TESTURL="doubleclick.com"
|
||||
|
@ -269,10 +260,8 @@ testResolver() {
|
|||
}
|
||||
|
||||
checkProcesses() {
|
||||
log_write "#######################################"
|
||||
log_write "########### Processes Check ###########"
|
||||
log_write "#######################################"
|
||||
log_write ":::"
|
||||
header_write "Processes Check"
|
||||
|
||||
echo "::: Logging status of lighttpd and dnsmasq..."
|
||||
PROCESSES=( lighttpd dnsmasq )
|
||||
for i in "${PROCESSES[@]}"; do
|
||||
|
@ -285,10 +274,8 @@ checkProcesses() {
|
|||
}
|
||||
|
||||
debugLighttpd() {
|
||||
log_write "::: Writing lighttpd to debug log..."
|
||||
log_write "#######################################"
|
||||
log_write "############ lighttpd.conf ############"
|
||||
log_write "#######################################"
|
||||
header_write "lighttpd.conf"
|
||||
|
||||
if [ -e "${LIGHTTPDFILE}" ]; then
|
||||
while read -r line; do
|
||||
if [ ! -z "${line}" ]; then
|
||||
|
@ -303,9 +290,10 @@ debugLighttpd() {
|
|||
fi
|
||||
|
||||
if [ -e "${LIGHTTPDERRFILE}" ]; then
|
||||
log_write "#######################################"
|
||||
log_write "######### lighttpd error.log ##########"
|
||||
log_write "#######################################"
|
||||
log_write ""
|
||||
log_write "::: lighttpd error.log"
|
||||
log_write ""
|
||||
|
||||
cat "${LIGHTTPDERRFILE}" >> ${DEBUG_LOG}
|
||||
else
|
||||
log_write "No lighttpd error.log file found!"
|
||||
|
@ -327,9 +315,7 @@ testResolver
|
|||
debugLighttpd
|
||||
|
||||
echo "::: Writing dnsmasq.conf to debug log..."
|
||||
log_write "#######################################"
|
||||
log_write "############### Dnsmasq ###############"
|
||||
log_write "#######################################"
|
||||
header_write "Dnsmasq configuration"
|
||||
if [ -e "${DNSMASQFILE}" ]; then
|
||||
#cat $DNSMASQFILE >> $DEBUG_LOG
|
||||
while read -r line; do
|
||||
|
@ -345,9 +331,8 @@ else
|
|||
fi
|
||||
|
||||
echo "::: Writing 01-pihole.conf to debug log..."
|
||||
log_write "#######################################"
|
||||
log_write "########### 01-pihole.conf ############"
|
||||
log_write "#######################################"
|
||||
header_write "01-pihole.conf"
|
||||
|
||||
if [ -e "${PIHOLECONFFILE}" ]; then
|
||||
while read -r line; do
|
||||
if [ ! -z "${line}" ]; then
|
||||
|
@ -362,9 +347,8 @@ else
|
|||
fi
|
||||
|
||||
echo "::: Writing size of gravity.list to debug log..."
|
||||
log_write "#######################################"
|
||||
log_write "############ gravity.list #############"
|
||||
log_write "#######################################"
|
||||
header_write "gravity.list"
|
||||
|
||||
if [ -e "${GRAVITYFILE}" ]; then
|
||||
wc -l "${GRAVITYFILE}" >> ${DEBUG_LOG}
|
||||
log_write ""
|
||||
|
@ -376,9 +360,7 @@ fi
|
|||
|
||||
### Pi-hole application specific logging ###
|
||||
echo "::: Writing whitelist to debug log..."
|
||||
log_write "#######################################"
|
||||
log_write "############## Whitelist ##############"
|
||||
log_write "#######################################"
|
||||
header_write "Whitelist"
|
||||
if [ -e "${WHITELISTFILE}" ]; then
|
||||
cat "${WHITELISTFILE}" >> ${DEBUG_LOG}
|
||||
log_write
|
||||
|
@ -388,9 +370,7 @@ else
|
|||
fi
|
||||
|
||||
echo "::: Writing blacklist to debug log..."
|
||||
log_write "#######################################"
|
||||
log_write "############## Blacklist ##############"
|
||||
log_write "#######################################"
|
||||
header_write "Blacklist"
|
||||
if [ -e "${BLACKLISTFILE}" ]; then
|
||||
cat "${BLACKLISTFILE}" >> ${DEBUG_LOG}
|
||||
log_write
|
||||
|
@ -400,9 +380,7 @@ else
|
|||
fi
|
||||
|
||||
echo "::: Writing adlists.list to debug log..."
|
||||
log_write "#######################################"
|
||||
log_write "############ adlists.list #############"
|
||||
log_write "#######################################"
|
||||
header_write "adlists.list"
|
||||
if [ -e "${ADLISTSFILE}" ]; then
|
||||
while read -r line; do
|
||||
if [ ! -z "${line}" ]; then
|
||||
|
@ -421,9 +399,7 @@ fi
|
|||
dumpPiHoleLog() {
|
||||
trap '{ echo -e "\n::: Finishing debug write from interrupt... Quitting!" ; exit 1; }' INT
|
||||
echo -e "::: Writing current Pi-hole traffic to debug log...\n:::\tTry loading any/all sites that you are having trouble with now... \n:::\t(Press ctrl+C to finish)"
|
||||
log_write "#######################################"
|
||||
log_write "############# pihole.log ##############"
|
||||
log_write "#######################################"
|
||||
header_write "pihole.log"
|
||||
if [ -e "${PIHOLELOG}" ]; then
|
||||
while true; do
|
||||
tail -f "${PIHOLELOG}" >> ${DEBUG_LOG}
|
||||
|
|
Loading…
Reference in a new issue