Standardize function declaration

There were no fewer than three styles of function declaration going
on in these files, so I attempted to standardize them to the typical

myfucn() {
}

style.
pull/818/head
Marcus Hildum 8 years ago
parent 16e4f79f09
commit 28eeaf201b

@ -10,8 +10,7 @@
# the Free Software Foundation, either version 2 of the License, or # the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
helpFunc() helpFunc() {
{
echo "::: Immediately blacklists one or more domains in the hosts file" echo "::: Immediately blacklists one or more domains in the hosts file"
echo ":::" echo ":::"
echo ":::" echo ":::"

@ -1,4 +1,4 @@
#!/usr/bin/env bash #/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2015, 2016 by Jacob Salmela
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your Raspberry Pi
@ -61,11 +61,11 @@ else
fi fi
### Private functions exist here ### ### Private functions exist here ###
function log_write { log_write() {
echo "$1" >> "${DEBUG_LOG}" echo "$1" >> "${DEBUG_LOG}"
} }
function version_check { version_check() {
log_write "############################################################" log_write "############################################################"
log_write "########## Installed Versions ##########" log_write "########## Installed Versions ##########"
log_write "############################################################" log_write "############################################################"
@ -83,7 +83,7 @@ function version_check {
php_ver="$(php -v |& head -n1)" && log_write "${php_ver}" || log_write "PHP not installed." php_ver="$(php -v |& head -n1)" && log_write "${php_ver}" || log_write "PHP not installed."
} }
function distro_check { distro_check() {
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
echo "######## Installed OS Distribution #########" >> ${DEBUG_LOG} echo "######## Installed OS Distribution #########" >> ${DEBUG_LOG}
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
@ -96,7 +96,7 @@ function distro_check {
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
} }
function ip_check { ip_check() {
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
echo "######## IP Address Information #########" >> ${DEBUG_LOG} echo "######## IP Address Information #########" >> ${DEBUG_LOG}
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
@ -166,7 +166,7 @@ function ip_check {
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
} }
function hostnameCheck { hostnameCheck() {
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
echo "######## Hostname Information #########" >> ${DEBUG_LOG} echo "######## Hostname Information #########" >> ${DEBUG_LOG}
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
@ -188,7 +188,7 @@ function hostnameCheck {
fi fi
} }
function portCheck { portCheck() {
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
echo "######## Open Port Information #########" >> ${DEBUG_LOG} echo "######## Open Port Information #########" >> ${DEBUG_LOG}
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
@ -200,7 +200,7 @@ function portCheck {
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
} }
function testResolver { testResolver() {
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
echo "############ Resolver Functions Check ############" >> ${DEBUG_LOG} echo "############ Resolver Functions Check ############" >> ${DEBUG_LOG}
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
@ -262,7 +262,7 @@ function testResolver {
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
} }
function checkProcesses { checkProcesses() {
echo "#######################################" >> ${DEBUG_LOG} echo "#######################################" >> ${DEBUG_LOG}
echo "########### Processes Check ###########" >> ${DEBUG_LOG} echo "########### Processes Check ###########" >> ${DEBUG_LOG}
echo "#######################################" >> ${DEBUG_LOG} echo "#######################################" >> ${DEBUG_LOG}
@ -279,7 +279,7 @@ function checkProcesses {
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
} }
function debugLighttpd { debugLighttpd() {
echo "::: Writing lighttpd to debug log..." echo "::: Writing lighttpd to debug log..."
echo "#######################################" >> ${DEBUG_LOG} echo "#######################################" >> ${DEBUG_LOG}
echo "############ lighttpd.conf ############" >> ${DEBUG_LOG} echo "############ lighttpd.conf ############" >> ${DEBUG_LOG}
@ -420,7 +420,7 @@ fi
# Continuously append the pihole.log file to the pihole_debug.log file # Continuously append the pihole.log file to the pihole_debug.log file
function dumpPiHoleLog { dumpPiHoleLog() {
trap '{ echo -e "\n::: Finishing debug write from interrupt... Quitting!" ; exit 1; }' INT 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)" 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)"
echo "#######################################" >> ${DEBUG_LOG} echo "#######################################" >> ${DEBUG_LOG}
@ -439,7 +439,7 @@ function dumpPiHoleLog {
} }
# Anything to be done after capturing of pihole.log terminates # Anything to be done after capturing of pihole.log terminates
function finalWork { finalWork() {
echo "::: Finshed debugging!" echo "::: Finshed debugging!"
echo "::: The debug 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 read -r -p "::: Would you like to upload the log? [y/N] " response

@ -17,8 +17,7 @@ webInterfaceDir="/var/www/html/admin"
piholeGitUrl="https://github.com/pi-hole/pi-hole.git" piholeGitUrl="https://github.com/pi-hole/pi-hole.git"
piholeFilesDir="/etc/.pihole" piholeFilesDir="/etc/.pihole"
spinner() spinner() {
{
local pid=$1 local pid=$1
local delay=0.50 local delay=0.50
local spinstr='/-\|' local spinstr='/-\|'

@ -71,8 +71,7 @@ coreOutput(){
fi fi
} }
helpFunc() helpFunc() {
{
echo ":::" echo ":::"
echo "::: Show Pi-hole/Web Admin versions" echo "::: Show Pi-hole/Web Admin versions"
echo ":::" echo ":::"

@ -11,8 +11,7 @@
# (at your option) any later version. # (at your option) any later version.
helpFunc() helpFunc() {
{
echo "::: Immediately whitelists one or more domains in the hosts file" echo "::: Immediately whitelists one or more domains in the hosts file"
echo ":::" echo ":::"
echo "::: Usage: pihole -w domain1 [domain2 ...]" echo "::: Usage: pihole -w domain1 [domain2 ...]"

@ -121,8 +121,7 @@ else
fi fi
####### FUNCTIONS ########## ####### FUNCTIONS ##########
spinner() spinner() {
{
local pid=$1 local pid=$1
local delay=0.50 local delay=0.50
local spinstr='/-\|' local spinstr='/-\|'
@ -389,8 +388,7 @@ setStaticIPv4() {
fi fi
} }
function valid_ip() valid_ip() {
{
local ip=$1 local ip=$1
local stat=1 local stat=1

@ -58,8 +58,7 @@ else
exit exit
fi fi
spinner() spinner() {
{
local pid=$1 local pid=$1
local delay=0.50 local delay=0.50
local spinstr='/-\|' local spinstr='/-\|'
@ -73,7 +72,7 @@ spinner()
printf " \b\b\b\b" printf " \b\b\b\b"
} }
function removeAndPurge { removeAndPurge() {
# Purge dependencies # Purge dependencies
echo ":::" echo ":::"
for i in "${PIHOLE_DEPS[@]}"; do for i in "${PIHOLE_DEPS[@]}"; do
@ -104,7 +103,7 @@ echo ":::"
removeNoPurge removeNoPurge
} }
function removeNoPurge { removeNoPurge() {
echo ":::" echo ":::"
# Only web directories/files that are created by pihole should be removed. # Only web directories/files that are created by pihole should be removed.
echo "::: Removing the Pi-hole Web server files..." echo "::: Removing the Pi-hole Web server files..."

@ -13,8 +13,7 @@
# Run this script as root or under sudo # Run this script as root or under sudo
echo ":::" echo ":::"
helpFunc() helpFunc() {
{
echo "::: Pull in domains from adlists" echo "::: Pull in domains from adlists"
echo ":::" echo ":::"
echo "::: Usage: pihole -g" echo "::: Usage: pihole -g"

Loading…
Cancel
Save