Flesh out compare

This commit is contained in:
Michael Stanclift 2020-05-24 20:48:18 -05:00
parent 20a2cb88fe
commit 68aa883c5f

View File

@ -312,17 +312,26 @@ function show_version {
# Look for Changes # Look for Changes
function md5_compare { function md5_compare {
echo -e "${INFO} Looking for Changes"
MESSAGE="Analyzing Remote ${GRAVITY_FI}"
echo -e "${STAT} ${MESSAGE}"
primaryMD5=$(ssh ${REMOTE_USER}@${REMOTE_HOST} 'md5sum /etc/pihole/gravity.db') primaryMD5=$(ssh ${REMOTE_USER}@${REMOTE_HOST} 'md5sum /etc/pihole/gravity.db')
error_validate
MESSAGE="Analyzing Local ${GRAVITY_FI}"
echo -e "${STAT} ${MESSAGE}"
secondMD5=$(md5sum ${PIHOLE_DIR}/${GRAVITY_FI}) secondMD5=$(md5sum ${PIHOLE_DIR}/${GRAVITY_FI})
error_validate
if [ "$primaryMD5" == "$secondMD5" ] if [ "$primaryMD5" == "$secondMD5" ]
then then
echo "MD5 Match" echo -e "${INFO} No Changes in ${GRAVITY_FI}"
exit_nochange
else else
echo "MD5 Changed" echo -e "${INFO} Changes Detected in ${GRAVITY_FI}"
fi fi
exit_nochange
} }
# SCRIPT EXECUTION ########################### # SCRIPT EXECUTION ###########################
@ -376,14 +385,18 @@ case $# in
update) update)
# TASKTYPE='UPDATE' # TASKTYPE='UPDATE'
echo -e "[${GREEN}GOOD${NC}] Update Requested" echo -e "${GOOD} ${MESSAGE}"
echo -e "${INFO} Update Requested"
update_gs update_gs
exit_nochange exit_nochange
;; ;;
beta) beta)
# TASKTYPE='BETA' # TASKTYPE='BETA'
echo -e "[${GREEN}GOOD${NC}] Beta Update Requested" echo -e "${GOOD} ${MESSAGE}"
echo -e "${INFO} Beta Update Requested"
beta_gs beta_gs
exit_nochange exit_nochange
;; ;;
@ -398,9 +411,8 @@ case $# in
compare) compare)
TASKTYPE='COMPARE' TASKTYPE='COMPARE'
import_gs
echo -e "${GOOD} ${MESSAGE}" echo -e "${GOOD} ${MESSAGE}"
import_gs
md5_compare md5_compare
;; ;;