From 858bcb9caab096dde95912d002f6785fcdec973f Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 15 May 2022 21:23:35 -0500 Subject: [PATCH 01/15] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2ccfc89..2246320 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .DS_Store .DS_Store .DS_Store +.DS_Store From 085ea2a06c69a63af119d63b49d1924ce979cc5b Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 22 May 2022 10:38:00 -0500 Subject: [PATCH 02/15] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2246320..ba66fe4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ .DS_Store .DS_Store .DS_Store +.DS_Store From 8199062186a348433b326ec786bb8d6fcf916333 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 22 May 2022 15:38:30 -0500 Subject: [PATCH 03/15] Update .gitignore --- .gitignore | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index ba66fe4..d4777d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,28 @@ +# ---> macOS +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk -.DS_Store -.DS_Store -.DS_Store -.DS_Store -.DS_Store -.DS_Store -.DS_Store From c63e611eb8a078b479786531a280b086e3e48252 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 28 Nov 2022 21:14:15 -0600 Subject: [PATCH 04/15] Update pihole-sync --- pihole-sync | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pihole-sync b/pihole-sync index 3223516..d1c492b 100755 --- a/pihole-sync +++ b/pihole-sync @@ -34,6 +34,8 @@ update='December 26, 2020' # CONSTANTS if [ -f "/opt/my-pihole-sync/pihole-sync" ]; then personal_git_dir='/opt/my-pihole-sync' +else if [ -f "/mnt/data/etc-pihole/my-pihole-sync/pihole-sync" ]; then + personal_git_dir='/mnt/data/etc-pihole/my-pihole-sync' else personal_git_dir='/usr/local/bin/my-pihole-sync' fi From 49f611e470ec49e804432515699865e7ae011ca9 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 28 Nov 2022 21:15:55 -0600 Subject: [PATCH 05/15] Update pihole-sync --- pihole-sync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pihole-sync b/pihole-sync index d1c492b..2a3fb7d 100755 --- a/pihole-sync +++ b/pihole-sync @@ -34,7 +34,7 @@ update='December 26, 2020' # CONSTANTS if [ -f "/opt/my-pihole-sync/pihole-sync" ]; then personal_git_dir='/opt/my-pihole-sync' -else if [ -f "/mnt/data/etc-pihole/my-pihole-sync/pihole-sync" ]; then +elif [ -f "/mnt/data/etc-pihole/my-pihole-sync/pihole-sync" ]; then personal_git_dir='/mnt/data/etc-pihole/my-pihole-sync' else personal_git_dir='/usr/local/bin/my-pihole-sync' From 5fd03b30162b841375e3f3da6b88c04955cef8a0 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 28 Nov 2022 21:16:36 -0600 Subject: [PATCH 06/15] Update pihole-sync --- pihole-sync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pihole-sync b/pihole-sync index 2a3fb7d..fba34f7 100755 --- a/pihole-sync +++ b/pihole-sync @@ -34,8 +34,8 @@ update='December 26, 2020' # CONSTANTS if [ -f "/opt/my-pihole-sync/pihole-sync" ]; then personal_git_dir='/opt/my-pihole-sync' -elif [ -f "/mnt/data/etc-pihole/my-pihole-sync/pihole-sync" ]; then - personal_git_dir='/mnt/data/etc-pihole/my-pihole-sync' +elif [ -f "/etc/pihole/my-pihole-sync/pihole-sync" ]; then + personal_git_dir='/etc/pihole/my-pihole-sync' else personal_git_dir='/usr/local/bin/my-pihole-sync' fi From a1f384ebdc03a39fae5a3b3acbf1f1090517f3d7 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 29 Nov 2022 20:04:48 -0600 Subject: [PATCH 07/15] Update pihole-sync --- pihole-sync | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pihole-sync b/pihole-sync index fba34f7..837de75 100755 --- a/pihole-sync +++ b/pihole-sync @@ -102,24 +102,27 @@ pull_initialize () { git reset --hard origin/main -q # Stop DNS server - $SUDO service pihole-FTL stop + # $SUDO service pihole-FTL stop # Overwrite local files - cp $custom_list $pihole_dir - cp $cname_list $dnsmasq_dir - # if [ ! -f "/opt/pihole-docker" ]; then - cp $localdomains_list $dnsmasq_dir - # fi + # cp $custom_list $pihole_dir + # cp $cname_list $dnsmasq_dir + if [[ $(/sbin/ip -o -4 addr list br0 | awk '{print $4}' | cut -d/ -f1) != "10.5.1.1" ] && [ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != "10.10.10.10" ]]; then + # cp $localdomains_list $dnsmasq_dir + echo "copying" + else + echo "not copying" + fi # Overwrite local database tables - sqlite3 $gravity_db "DROP TABLE adlist;" - sqlite3 $gravity_db -header -csv ".import adlist.csv adlist" - sqlite3 $gravity_db "DROP TABLE domainlist;" - sqlite3 $gravity_db -header -csv ".import domainlist.csv domainlist" + # sqlite3 $gravity_db "DROP TABLE adlist;" + # sqlite3 $gravity_db -header -csv ".import adlist.csv adlist" + # sqlite3 $gravity_db "DROP TABLE domainlist;" + # sqlite3 $gravity_db -header -csv ".import domainlist.csv domainlist" # Restart Pi-hole to pick up changes - $SUDO pihole -g + # $SUDO pihole -g # Display success messages echo "Local Pi-hole initialized in Pull mode and first pull successfully completed."; From 1e70970225fb8f48ee95c9a1081ce6b013cb1883 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 29 Nov 2022 20:17:31 -0600 Subject: [PATCH 08/15] Update pihole-sync --- pihole-sync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pihole-sync b/pihole-sync index 837de75..87cadc2 100755 --- a/pihole-sync +++ b/pihole-sync @@ -107,7 +107,7 @@ pull_initialize () { # Overwrite local files # cp $custom_list $pihole_dir # cp $cname_list $dnsmasq_dir - if [[ $(/sbin/ip -o -4 addr list br0 | awk '{print $4}' | cut -d/ -f1) != "10.5.1.1" ] && [ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != "10.10.10.10" ]]; then + if [ $(/sbin/ip -o -4 addr list br0 | awk '{print $4}' | cut -d/ -f1) != "10.5.1.1" ] && [ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != "10.10.10.10" ]; then # cp $localdomains_list $dnsmasq_dir echo "copying" else From 60e7aac41127985bdef2bf51d64dc92060cab476 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 29 Nov 2022 20:18:02 -0600 Subject: [PATCH 09/15] Update pihole-sync --- pihole-sync | 1 - 1 file changed, 1 deletion(-) diff --git a/pihole-sync b/pihole-sync index 87cadc2..905e4db 100755 --- a/pihole-sync +++ b/pihole-sync @@ -114,7 +114,6 @@ pull_initialize () { echo "not copying" fi - # Overwrite local database tables # sqlite3 $gravity_db "DROP TABLE adlist;" # sqlite3 $gravity_db -header -csv ".import adlist.csv adlist" From 66706866e2f4072e7bb84953ad601423e90ee152 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 29 Nov 2022 20:19:47 -0600 Subject: [PATCH 10/15] Update pihole-sync --- pihole-sync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pihole-sync b/pihole-sync index 905e4db..9b8b674 100755 --- a/pihole-sync +++ b/pihole-sync @@ -226,7 +226,7 @@ do elif [ "$arg" == "--pull" ] || [ "$arg" == "--download" ] || [ "$arg" == "--down" ]|| [ "$arg" == "-d" ] then echo "$arg option detected. Running in Pull/Download mode." - pull + # pull exit 0 # Help - Displays help dialog elif [ "$arg" == "--help" ] || [ "$arg" == "-h" ] || [ "$arg" == "-?" ] From 403d5cc47231fec70640fd701127640f4e5ae105 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 29 Nov 2022 20:25:08 -0600 Subject: [PATCH 11/15] Update pihole-sync --- pihole-sync | 58 ++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/pihole-sync b/pihole-sync index 9b8b674..a041e1c 100755 --- a/pihole-sync +++ b/pihole-sync @@ -102,11 +102,11 @@ pull_initialize () { git reset --hard origin/main -q # Stop DNS server - # $SUDO service pihole-FTL stop + $SUDO service pihole-FTL stop # Overwrite local files - # cp $custom_list $pihole_dir - # cp $cname_list $dnsmasq_dir + cp $custom_list $pihole_dir + cp $cname_list $dnsmasq_dir if [ $(/sbin/ip -o -4 addr list br0 | awk '{print $4}' | cut -d/ -f1) != "10.5.1.1" ] && [ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != "10.10.10.10" ]; then # cp $localdomains_list $dnsmasq_dir echo "copying" @@ -114,14 +114,15 @@ pull_initialize () { echo "not copying" fi + # Overwrite local database tables - # sqlite3 $gravity_db "DROP TABLE adlist;" - # sqlite3 $gravity_db -header -csv ".import adlist.csv adlist" - # sqlite3 $gravity_db "DROP TABLE domainlist;" - # sqlite3 $gravity_db -header -csv ".import domainlist.csv domainlist" + sqlite3 $gravity_db "DROP TABLE adlist;" + sqlite3 $gravity_db -header -csv ".import adlist.csv adlist" + sqlite3 $gravity_db "DROP TABLE domainlist;" + sqlite3 $gravity_db -header -csv ".import domainlist.csv domainlist" # Restart Pi-hole to pick up changes - # $SUDO pihole -g + $SUDO pihole -g # Display success messages echo "Local Pi-hole initialized in Pull mode and first pull successfully completed."; @@ -169,28 +170,31 @@ pull () { # Update local Git repo from remote Git repo git remote update > /dev/null CHANGED=$(git log HEAD..origin/main --oneline) - if [ -n "${CHANGED}" ]; then + # if [ -n "${CHANGED}" ]; then echo 'Remote Git repo is different than local Pi-hole lists. Updating local lists...'; # Remove -q option if you don't want to run in "quiet" mode - git fetch --all -q - git reset --hard origin/main -q - $SUDO service pihole-FTL stop - cp $custom_list $pihole_dir - cp $cname_list $dnsmasq_dir - # if [ ! -f "/opt/pihole-docker" ]; then - cp $localdomains_list $dnsmasq_dir - # fi - sqlite3 $gravity_db "DROP TABLE adlist;" - sqlite3 $gravity_db -header -csv ".import adlist.csv adlist" - sqlite3 $gravity_db "DROP TABLE domainlist;" - sqlite3 $gravity_db -header -csv ".import domainlist.csv domainlist" - $SUDO pihole -g + # git fetch --all -q + # git reset --hard origin/main -q + # $SUDO service pihole-FTL stop + # cp $custom_list $pihole_dir + # cp $cname_list $dnsmasq_dir + if [ $(/sbin/ip -o -4 addr list br0 | awk '{print $4}' | cut -d/ -f1) != "10.5.1.1" ] && [ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != "10.10.10.10" ]; then + # cp $localdomains_list $dnsmasq_dir + echo "copying" + else + echo "not copying" + fi + # sqlite3 $gravity_db "DROP TABLE adlist;" + # sqlite3 $gravity_db -header -csv ".import adlist.csv adlist" + # sqlite3 $gravity_db "DROP TABLE domainlist;" + # sqlite3 $gravity_db -header -csv ".import domainlist.csv domainlist" + # $SUDO pihole -g echo 'Done!'; exit 0 - else - echo 'Local Pi-hole lists match remote Git repo. No further action required.'; - exit 0 - fi + # else + # echo 'Local Pi-hole lists match remote Git repo. No further action required.'; + # exit 0 + # fi } @@ -226,7 +230,7 @@ do elif [ "$arg" == "--pull" ] || [ "$arg" == "--download" ] || [ "$arg" == "--down" ]|| [ "$arg" == "-d" ] then echo "$arg option detected. Running in Pull/Download mode." - # pull + pull exit 0 # Help - Displays help dialog elif [ "$arg" == "--help" ] || [ "$arg" == "-h" ] || [ "$arg" == "-?" ] From 939e591a8ae74c161f1d85d30d54421ab351f23f Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 29 Nov 2022 20:26:56 -0600 Subject: [PATCH 12/15] Update pihole-sync --- pihole-sync | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pihole-sync b/pihole-sync index a041e1c..8b1d94e 100755 --- a/pihole-sync +++ b/pihole-sync @@ -184,6 +184,8 @@ pull () { else echo "not copying" fi + echo $(/sbin/ip -o -4 addr list br0 | awk '{print $4}' | cut -d/ -f1) + echo $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) # sqlite3 $gravity_db "DROP TABLE adlist;" # sqlite3 $gravity_db -header -csv ".import adlist.csv adlist" # sqlite3 $gravity_db "DROP TABLE domainlist;" From fb28d6af98072e0301d3337cf1b5dbf0597d3b87 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 29 Nov 2022 20:28:40 -0600 Subject: [PATCH 13/15] Update 02-local-domains.conf --- 02-local-domains.conf | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/02-local-domains.conf b/02-local-domains.conf index 8aca71c..d3666e5 100644 --- a/02-local-domains.conf +++ b/02-local-domains.conf @@ -1,4 +1,8 @@ -server=/scity.us/172.18.0.10 -server=/schroedercity.com/172.18.0.10 -server=/misfitsmc.com/172.18.0.10 -server=/scity.xyz/172.18.0.10 +server=/scity.us/10.10.1.1 +server=/scity.us/10.10.10.11 +server=/schroedercity.com/10.10.1.1 +server=/schroedercity.com/10.10.10.11 +server=/misfitsmc.com/10.10.1.1 +server=/misfitsmc.com/10.10.10.11 +server=/scity.xyz/10.10.1.1 +server=/scity.xyz/10.10.10.11 From e95c1bc825fbfa83fea4bb9119fae2a9b3bdb402 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 29 Nov 2022 20:29:38 -0600 Subject: [PATCH 14/15] Update pihole-sync --- pihole-sync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pihole-sync b/pihole-sync index 8b1d94e..26ed07f 100755 --- a/pihole-sync +++ b/pihole-sync @@ -178,7 +178,7 @@ pull () { # $SUDO service pihole-FTL stop # cp $custom_list $pihole_dir # cp $cname_list $dnsmasq_dir - if [ $(/sbin/ip -o -4 addr list br0 | awk '{print $4}' | cut -d/ -f1) != "10.5.1.1" ] && [ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != "10.10.10.10" ]; then + if [ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *"10.10.10.11"* ]; then # cp $localdomains_list $dnsmasq_dir echo "copying" else From fd0037d2b7d43ec23974e0155ba1cfa8957bad83 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 29 Nov 2022 20:30:16 -0600 Subject: [PATCH 15/15] Update pihole-sync --- pihole-sync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pihole-sync b/pihole-sync index 26ed07f..1748c6a 100755 --- a/pihole-sync +++ b/pihole-sync @@ -178,7 +178,7 @@ pull () { # $SUDO service pihole-FTL stop # cp $custom_list $pihole_dir # cp $cname_list $dnsmasq_dir - if [ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *"10.10.10.11"* ]; then + if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *"10.10.10.11"* ]]; then # cp $localdomains_list $dnsmasq_dir echo "copying" else