This commit is contained in:
root
2022-11-29 20:31:05 -06:00
3 changed files with 66 additions and 30 deletions

32
.gitignore vendored
View File

@@ -1,6 +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

View File

@@ -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

View File

@@ -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'
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
@@ -105,9 +107,12 @@ pull_initialize () {
# 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
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
@@ -165,28 +170,33 @@ 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 eth0 | awk '{print $4}' | cut -d/ -f1) != *"10.10.10.11"* ]]; then
# cp $localdomains_list $dnsmasq_dir
echo "copying"
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;"
# 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
}