mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
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.
This commit is contained in:
parent
16e4f79f09
commit
28eeaf201b
@ -10,8 +10,7 @@
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
helpFunc()
|
||||
{
|
||||
helpFunc() {
|
||||
echo "::: Immediately blacklists one or more domains in the hosts file"
|
||||
echo ":::"
|
||||
echo ":::"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#/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
|
||||
@ -61,11 +61,11 @@ else
|
||||
fi
|
||||
|
||||
### Private functions exist here ###
|
||||
function log_write {
|
||||
log_write() {
|
||||
echo "$1" >> "${DEBUG_LOG}"
|
||||
}
|
||||
|
||||
function version_check {
|
||||
version_check() {
|
||||
log_write "############################################################"
|
||||
log_write "########## Installed Versions ##########"
|
||||
log_write "############################################################"
|
||||
@ -83,7 +83,7 @@ function version_check {
|
||||
php_ver="$(php -v |& head -n1)" && log_write "${php_ver}" || log_write "PHP not installed."
|
||||
}
|
||||
|
||||
function distro_check {
|
||||
distro_check() {
|
||||
echo "############################################################" >> ${DEBUG_LOG}
|
||||
echo "######## Installed OS Distribution #########" >> ${DEBUG_LOG}
|
||||
echo "############################################################" >> ${DEBUG_LOG}
|
||||
@ -96,7 +96,7 @@ function distro_check {
|
||||
echo >> ${DEBUG_LOG}
|
||||
}
|
||||
|
||||
function ip_check {
|
||||
ip_check() {
|
||||
echo "############################################################" >> ${DEBUG_LOG}
|
||||
echo "######## IP Address Information #########" >> ${DEBUG_LOG}
|
||||
echo "############################################################" >> ${DEBUG_LOG}
|
||||
@ -166,7 +166,7 @@ function ip_check {
|
||||
echo >> ${DEBUG_LOG}
|
||||
}
|
||||
|
||||
function hostnameCheck {
|
||||
hostnameCheck() {
|
||||
echo "############################################################" >> ${DEBUG_LOG}
|
||||
echo "######## Hostname Information #########" >> ${DEBUG_LOG}
|
||||
echo "############################################################" >> ${DEBUG_LOG}
|
||||
@ -188,7 +188,7 @@ function hostnameCheck {
|
||||
fi
|
||||
}
|
||||
|
||||
function portCheck {
|
||||
portCheck() {
|
||||
echo "############################################################" >> ${DEBUG_LOG}
|
||||
echo "######## Open Port Information #########" >> ${DEBUG_LOG}
|
||||
echo "############################################################" >> ${DEBUG_LOG}
|
||||
@ -200,7 +200,7 @@ function portCheck {
|
||||
echo >> ${DEBUG_LOG}
|
||||
}
|
||||
|
||||
function testResolver {
|
||||
testResolver() {
|
||||
echo "############################################################" >> ${DEBUG_LOG}
|
||||
echo "############ Resolver Functions Check ############" >> ${DEBUG_LOG}
|
||||
echo "############################################################" >> ${DEBUG_LOG}
|
||||
@ -262,7 +262,7 @@ function testResolver {
|
||||
echo >> ${DEBUG_LOG}
|
||||
}
|
||||
|
||||
function checkProcesses {
|
||||
checkProcesses() {
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "########### Processes Check ###########" >> ${DEBUG_LOG}
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
@ -279,7 +279,7 @@ function checkProcesses {
|
||||
echo >> ${DEBUG_LOG}
|
||||
}
|
||||
|
||||
function debugLighttpd {
|
||||
debugLighttpd() {
|
||||
echo "::: Writing lighttpd to debug log..."
|
||||
echo "#######################################" >> ${DEBUG_LOG}
|
||||
echo "############ lighttpd.conf ############" >> ${DEBUG_LOG}
|
||||
@ -420,7 +420,7 @@ fi
|
||||
|
||||
|
||||
# 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
|
||||
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}
|
||||
@ -439,7 +439,7 @@ function dumpPiHoleLog {
|
||||
}
|
||||
|
||||
# Anything to be done after capturing of pihole.log terminates
|
||||
function finalWork {
|
||||
finalWork() {
|
||||
echo "::: Finshed debugging!"
|
||||
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
|
||||
|
@ -17,8 +17,7 @@ webInterfaceDir="/var/www/html/admin"
|
||||
piholeGitUrl="https://github.com/pi-hole/pi-hole.git"
|
||||
piholeFilesDir="/etc/.pihole"
|
||||
|
||||
spinner()
|
||||
{
|
||||
spinner() {
|
||||
local pid=$1
|
||||
local delay=0.50
|
||||
local spinstr='/-\|'
|
||||
|
@ -71,8 +71,7 @@ coreOutput(){
|
||||
fi
|
||||
}
|
||||
|
||||
helpFunc()
|
||||
{
|
||||
helpFunc() {
|
||||
echo ":::"
|
||||
echo "::: Show Pi-hole/Web Admin versions"
|
||||
echo ":::"
|
||||
|
@ -11,8 +11,7 @@
|
||||
# (at your option) any later version.
|
||||
|
||||
|
||||
helpFunc()
|
||||
{
|
||||
helpFunc() {
|
||||
echo "::: Immediately whitelists one or more domains in the hosts file"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole -w domain1 [domain2 ...]"
|
||||
|
@ -121,8 +121,7 @@ else
|
||||
fi
|
||||
|
||||
####### FUNCTIONS ##########
|
||||
spinner()
|
||||
{
|
||||
spinner() {
|
||||
local pid=$1
|
||||
local delay=0.50
|
||||
local spinstr='/-\|'
|
||||
@ -389,8 +388,7 @@ setStaticIPv4() {
|
||||
fi
|
||||
}
|
||||
|
||||
function valid_ip()
|
||||
{
|
||||
valid_ip() {
|
||||
local ip=$1
|
||||
local stat=1
|
||||
|
||||
|
@ -58,8 +58,7 @@ else
|
||||
exit
|
||||
fi
|
||||
|
||||
spinner()
|
||||
{
|
||||
spinner() {
|
||||
local pid=$1
|
||||
local delay=0.50
|
||||
local spinstr='/-\|'
|
||||
@ -73,7 +72,7 @@ spinner()
|
||||
printf " \b\b\b\b"
|
||||
}
|
||||
|
||||
function removeAndPurge {
|
||||
removeAndPurge() {
|
||||
# Purge dependencies
|
||||
echo ":::"
|
||||
for i in "${PIHOLE_DEPS[@]}"; do
|
||||
@ -104,7 +103,7 @@ echo ":::"
|
||||
removeNoPurge
|
||||
}
|
||||
|
||||
function removeNoPurge {
|
||||
removeNoPurge() {
|
||||
echo ":::"
|
||||
# Only web directories/files that are created by pihole should be removed.
|
||||
echo "::: Removing the Pi-hole Web server files..."
|
||||
|
@ -13,8 +13,7 @@
|
||||
# Run this script as root or under sudo
|
||||
echo ":::"
|
||||
|
||||
helpFunc()
|
||||
{
|
||||
helpFunc() {
|
||||
echo "::: Pull in domains from adlists"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole -g"
|
||||
|
Loading…
Reference in New Issue
Block a user