mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-15 03:49:10 +00:00
Imbue gravity.sh with some consistency
Mish-mash of tabs and spaces used for indentation. Mostly tabs though, so going with those. Also indenting blocks and enforcing the loop statement; do done style over the newline for do since it seemed to be more common.
This commit is contained in:
parent
5ebfa5ecf7
commit
aac8e45397
1 changed files with 64 additions and 69 deletions
15
gravity.sh
15
gravity.sh
|
@ -151,8 +151,7 @@ gravity_transport() {
|
|||
gravity_spinup() {
|
||||
echo ":::"
|
||||
# Loop through domain list. Download each one and remove commented lines (lines beginning with '# 'or '/') and # blank lines
|
||||
for ((i = 0; i < "${#sources[@]}"; i++))
|
||||
do
|
||||
for ((i = 0; i < "${#sources[@]}"; i++)); do
|
||||
url=${sources[$i]}
|
||||
# Get just the domain from the URL
|
||||
domain=$(echo "$url" | cut -d'/' -f3)
|
||||
|
@ -190,8 +189,7 @@ gravity_Schwarzchild() {
|
|||
# Find all active domains and compile them into one file and remove CRs
|
||||
echo -n "::: Aggregating list of domains..."
|
||||
truncate -s 0 ${piholeDir}/${matterAndLight}
|
||||
for i in "${activeDomains[@]}"
|
||||
do
|
||||
for i in "${activeDomains[@]}"; do
|
||||
cat "$i" | tr -d '\r' >> ${piholeDir}/${matterAndLight}
|
||||
done
|
||||
echo " done!"
|
||||
|
@ -214,8 +212,7 @@ gravity_Whitelist() {
|
|||
echo -n "::: Adding ${#sources[@]} adlist source${plural} to the whitelist..."
|
||||
|
||||
urls=()
|
||||
for url in "${sources[@]}"
|
||||
do
|
||||
for url in "${sources[@]}"; do
|
||||
tmp=$(echo "$url" | awk -F '/' '{print $3}')
|
||||
urls=("${urls[@]}" ${tmp})
|
||||
done
|
||||
|
@ -266,8 +263,7 @@ gravity_hostFormat() {
|
|||
# blackbody - remove any remnant files from script processes
|
||||
gravity_blackbody() {
|
||||
# Loop through list files
|
||||
for file in ${piholeDir}/*.${justDomainsExtension}
|
||||
do
|
||||
for file in ${piholeDir}/*.${justDomainsExtension}; do
|
||||
# If list is in active array then leave it (noop) else rm the list
|
||||
if [[ " ${activeDomains[@]} " =~ ${file} ]]; then
|
||||
:
|
||||
|
@ -333,8 +329,7 @@ gravity_reload() {
|
|||
}
|
||||
|
||||
|
||||
for var in "$@"
|
||||
do
|
||||
for var in "$@"; do
|
||||
case "$var" in
|
||||
"-f" | "--force" ) forceGrav=true;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
|
|
Loading…
Add table
Reference in a new issue