mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
Compare custom.list
This commit is contained in:
parent
d6c40328dd
commit
e1adcd1105
@ -30,6 +30,7 @@ VERIFY_PASS='0' # replace in gravity-sync.conf to overwrite
|
|||||||
# Pi-hole Folder/File Locations
|
# Pi-hole Folder/File Locations
|
||||||
PIHOLE_DIR='/etc/pihole' # default Pi-hole data directory
|
PIHOLE_DIR='/etc/pihole' # default Pi-hole data directory
|
||||||
GRAVITY_FI='gravity.db' # default Pi-hole database file
|
GRAVITY_FI='gravity.db' # default Pi-hole database file
|
||||||
|
CUSTOM_DNS='custom.list' # default Pi-hole local DNS lookups
|
||||||
PIHOLE_BIN='/usr/local/bin/pihole' # default Pi-hole binary directory
|
PIHOLE_BIN='/usr/local/bin/pihole' # default Pi-hole binary directory
|
||||||
|
|
||||||
# OS Settings
|
# OS Settings
|
||||||
@ -456,24 +457,62 @@ function md5_compare {
|
|||||||
MESSAGE="Comparing ${GRAVITY_FI} Changes"
|
MESSAGE="Comparing ${GRAVITY_FI} Changes"
|
||||||
echo_info
|
echo_info
|
||||||
|
|
||||||
|
HASHMARK='0'
|
||||||
|
|
||||||
MESSAGE="Analyzing Remote ${GRAVITY_FI}"
|
MESSAGE="Analyzing Remote ${GRAVITY_FI}"
|
||||||
echo_stat
|
echo_stat
|
||||||
primaryMD5=$(${SSHPASSWORD} ssh -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST} "md5sum ${PIHOLE_DIR}/${GRAVITY_FI}")
|
primaryDBMD5=$(${SSHPASSWORD} ssh -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST} "md5sum ${PIHOLE_DIR}/${GRAVITY_FI}")
|
||||||
error_validate
|
error_validate
|
||||||
|
|
||||||
MESSAGE="Analyzing Local ${GRAVITY_FI}"
|
MESSAGE="Analyzing Local ${GRAVITY_FI}"
|
||||||
echo_stat
|
echo_stat
|
||||||
secondMD5=$(md5sum ${PIHOLE_DIR}/${GRAVITY_FI})
|
secondDBMD5=$(md5sum ${PIHOLE_DIR}/${GRAVITY_FI})
|
||||||
error_validate
|
error_validate
|
||||||
|
|
||||||
if [ "$primaryMD5" == "$secondMD5" ]
|
if [ "$primaryDBMD5" == "$secondDBMD5" ]
|
||||||
then
|
then
|
||||||
MESSAGE="No Differences in ${GRAVITY_FI}"
|
MESSAGE="No Differences in ${GRAVITY_FI}"
|
||||||
echo_info
|
echo_info
|
||||||
exit_nochange
|
HASHMARK=$((HASHMARK+0))
|
||||||
else
|
else
|
||||||
MESSAGE="Changes Detected in ${GRAVITY_FI}"
|
MESSAGE="Changes Detected in ${GRAVITY_FI}"
|
||||||
echo_info
|
echo_info
|
||||||
|
HASHMARK=$((HASHMARK+1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
MESSAGE="Comparing ${CUSTOM_DNS} Changes"
|
||||||
|
echo_info
|
||||||
|
|
||||||
|
MESSAGE="Analyzing Remote ${CUSTOM_DNS}"
|
||||||
|
echo_stat
|
||||||
|
primaryCLMD5=$(${SSHPASSWORD} ssh -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST} "md5sum ${PIHOLE_DIR}/${CUSTOM_DNS}")
|
||||||
|
error_validate
|
||||||
|
|
||||||
|
MESSAGE="Analyzing Local ${CUSTOM_DNS}"
|
||||||
|
echo_stat
|
||||||
|
secondCLMD5=$(md5sum ${PIHOLE_DIR}/${CUSTOM_DNS})
|
||||||
|
error_validate
|
||||||
|
|
||||||
|
if [ "$primaryCLMD5" == "$secondCLMD5" ]
|
||||||
|
then
|
||||||
|
MESSAGE="No Differences in ${CUSTOM_DNS}"
|
||||||
|
echo_info
|
||||||
|
HASHMARK=$((HASHMARK+0))
|
||||||
|
else
|
||||||
|
MESSAGE="Changes Detected in ${CUSTOM_DNS}"
|
||||||
|
echo_info
|
||||||
|
HASHMARK=$((HASHMARK+1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$HASHMARK" != "0" ]
|
||||||
|
then
|
||||||
|
MESSAGE="Replication Required"
|
||||||
|
echo_info
|
||||||
|
HASHMARK=$((HASHMARK+0))
|
||||||
|
else
|
||||||
|
MESSAGE="No Replication Required"
|
||||||
|
echo_info
|
||||||
|
exit_nochange
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user