Merge branch 'main' of https://git.schroedercity.com/voltron/my-pihole-sync into main
This commit is contained in:
32
.gitignore
vendored
32
.gitignore
vendored
@@ -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
|
.apdisk
|
||||||
.DS_Store
|
|
||||||
.DS_Store
|
|
||||||
.DS_Store
|
|
||||||
.DS_Store
|
|
||||||
.DS_Store
|
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
server=/scity.us/172.18.0.10
|
server=/scity.us/10.10.1.1
|
||||||
server=/schroedercity.com/172.18.0.10
|
server=/scity.us/10.10.10.11
|
||||||
server=/misfitsmc.com/172.18.0.10
|
server=/schroedercity.com/10.10.1.1
|
||||||
server=/scity.xyz/172.18.0.10
|
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
|
||||||
|
|||||||
52
pihole-sync
52
pihole-sync
@@ -34,6 +34,8 @@ update='December 26, 2020'
|
|||||||
# CONSTANTS
|
# CONSTANTS
|
||||||
if [ -f "/opt/my-pihole-sync/pihole-sync" ]; then
|
if [ -f "/opt/my-pihole-sync/pihole-sync" ]; then
|
||||||
personal_git_dir='/opt/my-pihole-sync'
|
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
|
else
|
||||||
personal_git_dir='/usr/local/bin/my-pihole-sync'
|
personal_git_dir='/usr/local/bin/my-pihole-sync'
|
||||||
fi
|
fi
|
||||||
@@ -105,9 +107,12 @@ pull_initialize () {
|
|||||||
# Overwrite local files
|
# Overwrite local files
|
||||||
cp $custom_list $pihole_dir
|
cp $custom_list $pihole_dir
|
||||||
cp $cname_list $dnsmasq_dir
|
cp $cname_list $dnsmasq_dir
|
||||||
# if [ ! -f "/opt/pihole-docker" ]; 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
|
# cp $localdomains_list $dnsmasq_dir
|
||||||
# fi
|
echo "copying"
|
||||||
|
else
|
||||||
|
echo "not copying"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Overwrite local database tables
|
# Overwrite local database tables
|
||||||
@@ -165,28 +170,33 @@ pull () {
|
|||||||
# Update local Git repo from remote Git repo
|
# Update local Git repo from remote Git repo
|
||||||
git remote update > /dev/null
|
git remote update > /dev/null
|
||||||
CHANGED=$(git log HEAD..origin/main --oneline)
|
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...';
|
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
|
# Remove -q option if you don't want to run in "quiet" mode
|
||||||
git fetch --all -q
|
# git fetch --all -q
|
||||||
git reset --hard origin/main -q
|
# git reset --hard origin/main -q
|
||||||
$SUDO service pihole-FTL stop
|
# $SUDO service pihole-FTL stop
|
||||||
cp $custom_list $pihole_dir
|
# cp $custom_list $pihole_dir
|
||||||
cp $cname_list $dnsmasq_dir
|
# cp $cname_list $dnsmasq_dir
|
||||||
# if [ ! -f "/opt/pihole-docker" ]; 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
|
# cp $localdomains_list $dnsmasq_dir
|
||||||
# fi
|
echo "copying"
|
||||||
sqlite3 $gravity_db "DROP TABLE adlist;"
|
else
|
||||||
sqlite3 $gravity_db -header -csv ".import adlist.csv adlist"
|
echo "not copying"
|
||||||
sqlite3 $gravity_db "DROP TABLE domainlist;"
|
fi
|
||||||
sqlite3 $gravity_db -header -csv ".import domainlist.csv domainlist"
|
echo $(/sbin/ip -o -4 addr list br0 | awk '{print $4}' | cut -d/ -f1)
|
||||||
$SUDO pihole -g
|
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!';
|
echo 'Done!';
|
||||||
exit 0
|
exit 0
|
||||||
else
|
# else
|
||||||
echo 'Local Pi-hole lists match remote Git repo. No further action required.';
|
# echo 'Local Pi-hole lists match remote Git repo. No further action required.';
|
||||||
exit 0
|
# exit 0
|
||||||
fi
|
# fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user