From e14588add54c319f56677fd45c19df8c27cc6549 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 14:42:52 -0500 Subject: [PATCH 01/13] breakup into functions --- ADVANCED.md | 4 ++-- CHANGELOG.md | 3 +++ VERSION | 2 +- gravity-sync.sh | 33 +++++++++++++++++++++++++-------- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/ADVANCED.md b/ADVANCED.md index 0e46f01..3c63b5a 100644 --- a/ADVANCED.md +++ b/ADVANCED.md @@ -14,8 +14,8 @@ Download the latest release from [GitHub](https://github.com/vmstan/gravity-sync ```bash cd ~ -wget https://github.com/vmstan/gravity-sync/archive/v2.1.2.zip -unzip v2.1.2.zip -d gravity-sync +wget https://github.com/vmstan/gravity-sync/archive/v2.1.5.zip +unzip v2.1.5.zip -d gravity-sync cd gravity-sync ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a10d90..7a813c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ The `./gravity-sync.sh update` and `version` functions will look for the `dbclie #### 2.1.2 - Corrects a bug in `backup` automation that causes the backup to run every minute during the hour selected. +#### 2.1.5 +Skipping a few digits because what does it really matter? + ## 2.0 ### The Smart Release diff --git a/VERSION b/VERSION index 8f9174b..c5864dc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.2 \ No newline at end of file +2.1.5 \ No newline at end of file diff --git a/gravity-sync.sh b/gravity-sync.sh index b0980ea..ea27732 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -3,7 +3,7 @@ SCRIPT_START=$SECONDS # GRAVITY SYNC BY VMSTAN ##################### PROGRAM='Gravity Sync' -VERSION='2.1.2' +VERSION='2.1.5' # Execute from the home folder of the user who owns it (ex: 'cd ~/gravity-sync') # For documentation or downloading updates visit https://github.com/vmstan/gravity-sync @@ -141,10 +141,13 @@ function update_gs { # Gravity Core Functions ## Pull Gravity function pull_gs_grav { - MESSAGE="Backing Up ${GRAVITY_FI} on $HOSTNAME" - echo_stat - cp ${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.backup >/dev/null 2>&1 - error_validate + + backup_local_gravity + + # MESSAGE="Backing Up ${GRAVITY_FI} on $HOSTNAME" + # echo_stat + # cp ${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.backup >/dev/null 2>&1 + # error_validate MESSAGE="Pulling ${GRAVITY_FI} from ${REMOTE_HOST}" echo_stat @@ -291,6 +294,7 @@ function pull_gs_reload { function pull_gs { md5_compare + backup_settime pull_gs_grav pull_gs_cust pull_gs_reload @@ -1693,14 +1697,27 @@ function task_backup { MESSAGE="${MESSAGE}: ${TASKTYPE} Requested" echo_good - BACKUPTIMESTAMP=$(date +%F-%H%M%S) + backup_settime + backup_local_gravity + backup_local_custom + backup_cleanup + + exit_withchange +} +function backup_settime { + BACKUPTIMESTAMP=$(date +%F-%H%M%S) +} + +function backup_local_gravity { MESSAGE="Performing Backup of ${GRAVITY_FI}" echo_stat sqlite3 ${PIHOLE_DIR}/${GRAVITY_FI} ".backup '$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${BACKUPTIMESTAMP}-${GRAVITY_FI}.backup'" error_validate +} +function backup_local_custom { if [ "$SKIP_CUSTOM" != '1' ] then if [ -f ${PIHOLE_DIR}/${CUSTOM_DNS} ] @@ -1712,14 +1729,14 @@ function task_backup { error_validate fi fi +} +function backup_cleanup { MESSAGE="Cleaning Up Old Backups" echo_stat find $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/$(date +%Y)*.backup -mtime +${BACKUP_RETAIN} -type f -delete error_validate - - exit_withchange } # Echo Stack From 9b7d536977c4a4ed83d48df2d16090d9085acc5d Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 14:55:03 -0500 Subject: [PATCH 02/13] Updates --- gravity-sync.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index ea27732..190d1fd 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -205,17 +205,19 @@ function pull_gs_grav { ## Pull Custom function pull_gs_cust { + backup_local_custom + if [ "$SKIP_CUSTOM" != '1' ] then if [ "$REMOTE_CUSTOM_DNS" == "1" ] then - if [ -f ${PIHOLE_DIR}/${CUSTOM_DNS} ] - then - MESSAGE="Backing Up ${CUSTOM_DNS} on $HOSTNAME" - echo_stat - cp ${PIHOLE_DIR}/${CUSTOM_DNS} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${CUSTOM_DNS}.backup >/dev/null 2>&1 - error_validate - fi + # if [ -f ${PIHOLE_DIR}/${CUSTOM_DNS} ] + # then + # MESSAGE="Backing Up ${CUSTOM_DNS} on $HOSTNAME" + # echo_stat + # cp ${PIHOLE_DIR}/${CUSTOM_DNS} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${CUSTOM_DNS}.backup >/dev/null 2>&1 + # error_validate + # fi MESSAGE="Pulling ${CUSTOM_DNS} from ${REMOTE_HOST}" echo_stat @@ -403,6 +405,7 @@ function push_gs { ## Smart Sync Function function smart_gs { md5_compare + backup_settime if [ -f "${LOG_PATH}/${HISTORY_MD5}" ] then From 78f97716a857eb9cd170860d58c798e21ca3fcc5 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 15:17:27 -0500 Subject: [PATCH 03/13] backup remote grav --- gravity-sync.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gravity-sync.sh b/gravity-sync.sh index 190d1fd..8f2585b 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -148,6 +148,8 @@ function pull_gs_grav { # echo_stat # cp ${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.backup >/dev/null 2>&1 # error_validate + + MESSAGE="Pulling ${GRAVITY_FI} from ${REMOTE_HOST}" echo_stat @@ -205,6 +207,7 @@ function pull_gs_grav { ## Pull Custom function pull_gs_cust { + backup_local_custom if [ "$SKIP_CUSTOM" != '1' ] @@ -307,6 +310,8 @@ function pull_gs { ## Push Gravity function push_gs_grav { + backup_remote_gravity + MESSAGE="Backing Up ${GRAVITY_FI} from ${REMOTE_HOST}" echo_stat RSYNC_REPATH="rsync" @@ -1734,6 +1739,16 @@ function backup_local_custom { fi } +function backup_remote_gravity { + CMD_TIMEOUT='15' + CMD_REQUESTED="sqlite3 ${PIHOLE_DIR}/${GRAVITY_FI} \".backup '${PIHOLE_DIR}/${GRAVITY_FI}.backup'\"" + create_sshcmd +} + +function backup_remote_custom { + +} + function backup_cleanup { MESSAGE="Cleaning Up Old Backups" echo_stat From 624ab9aab70fbc86da8bf80a5b165110fbabddb2 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 15:33:35 -0500 Subject: [PATCH 04/13] New backup and copy method --- gravity-sync.sh | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 8f2585b..e4fb55d 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -143,6 +143,7 @@ function update_gs { function pull_gs_grav { backup_local_gravity + backup_remote_gravity # MESSAGE="Backing Up ${GRAVITY_FI} on $HOSTNAME" # echo_stat @@ -154,7 +155,7 @@ function pull_gs_grav { MESSAGE="Pulling ${GRAVITY_FI} from ${REMOTE_HOST}" echo_stat RSYNC_REPATH="rsync" - RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI}" + RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI}.backup" RSYNC_TARGET="$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull" create_rsynccmd @@ -209,6 +210,7 @@ function pull_gs_grav { function pull_gs_cust { backup_local_custom + backup_remote_custom if [ "$SKIP_CUSTOM" != '1' ] then @@ -225,7 +227,7 @@ function pull_gs_cust { MESSAGE="Pulling ${CUSTOM_DNS} from ${REMOTE_HOST}" echo_stat RSYNC_REPATH="rsync" - RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${CUSTOM_DNS}" + RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${CUSTOM_DNS}.backup" RSYNC_TARGET="$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${CUSTOM_DNS}.pull" create_rsynccmd @@ -311,18 +313,19 @@ function pull_gs { ## Push Gravity function push_gs_grav { backup_remote_gravity + backup_local_gravity - MESSAGE="Backing Up ${GRAVITY_FI} from ${REMOTE_HOST}" + MESSAGE="Copying ${GRAVITY_FI} from ${REMOTE_HOST}" echo_stat RSYNC_REPATH="rsync" - RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI}" + RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI}.backup" RSYNC_TARGET="$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.push" create_rsynccmd MESSAGE="Pushing ${GRAVITY_FI} to ${REMOTE_HOST}" echo_stat RSYNC_REPATH="sudo rsync" - RSYNC_SOURCE="${PIHOLE_DIR}/${GRAVITY_FI}" + RSYNC_SOURCE="$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${BACKUPTIMESTAMP}-${GRAVITY_FI}.backup" RSYNC_TARGET="${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI}" create_rsynccmd @@ -341,21 +344,24 @@ function push_gs_grav { ## Push Custom function push_gs_cust { + backup_remote_custom + backup_local_custom + if [ "$SKIP_CUSTOM" != '1' ] then if [ "$REMOTE_CUSTOM_DNS" == "1" ] then - MESSAGE="Backing Up ${CUSTOM_DNS} from ${REMOTE_HOST}" + MESSAGE="Copying ${CUSTOM_DNS} from ${REMOTE_HOST}" echo_stat RSYNC_REPATH="rsync" - RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${CUSTOM_DNS}" + RSYNC_SOURCE="${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${CUSTOM_DNS}.backup" RSYNC_TARGET="$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${CUSTOM_DNS}.push" create_rsynccmd MESSAGE="Pushing ${CUSTOM_DNS} to ${REMOTE_HOST}" echo_stat RSYNC_REPATH="sudo rsync" - RSYNC_SOURCE="${PIHOLE_DIR}/${CUSTOM_DNS}" + RSYNC_SOURCE="$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${BACKUPTIMESTAMP}-${CUSTOM_DNS}.backup" RSYNC_TARGET="${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${CUSTOM_DNS}" create_rsynccmd @@ -1718,7 +1724,7 @@ function backup_settime { } function backup_local_gravity { - MESSAGE="Performing Backup of ${GRAVITY_FI}" + MESSAGE="Performing Backup of Local ${GRAVITY_FI}" echo_stat sqlite3 ${PIHOLE_DIR}/${GRAVITY_FI} ".backup '$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${BACKUPTIMESTAMP}-${GRAVITY_FI}.backup'" @@ -1730,7 +1736,7 @@ function backup_local_custom { then if [ -f ${PIHOLE_DIR}/${CUSTOM_DNS} ] then - MESSAGE="Performing Backup Up ${CUSTOM_DNS}" + MESSAGE="Performing Backup Up Local ${CUSTOM_DNS}" echo_stat cp ${PIHOLE_DIR}/${CUSTOM_DNS} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${BACKUPTIMESTAMP}-${CUSTOM_DNS}.backup @@ -1740,13 +1746,27 @@ function backup_local_custom { } function backup_remote_gravity { + MESSAGE="Performing Backup of Remote ${GRAVITY_FI}" + echo_stat + CMD_TIMEOUT='15' - CMD_REQUESTED="sqlite3 ${PIHOLE_DIR}/${GRAVITY_FI} \".backup '${PIHOLE_DIR}/${GRAVITY_FI}.backup'\"" + CMD_REQUESTED="sudo sqlite3 ${PIHOLE_DIR}/${GRAVITY_FI} \".backup '${PIHOLE_DIR}/${GRAVITY_FI}.backup'\"" create_sshcmd } function backup_remote_custom { - + if [ "$SKIP_CUSTOM" != '1' ] + then + if [ -f ${PIHOLE_DIR}/${CUSTOM_DNS} ] + then + MESSAGE="Performing Backup of Remote ${CUSTOM_DNS}" + echo_stat + + CMD_TIMEOUT='15' + CMD_REQUESTED="sudo cp ${PIHOLE_DIR}/${CUSTOM_DNS} ${PIHOLE_DIR}/${CUSTOM_DNS}.backup'\"" + create_sshcmd + fi + fi } function backup_cleanup { From a158a2d0426f69941575178887ae07d22fd4ec19 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 18:34:22 -0500 Subject: [PATCH 05/13] betamode --- gravity-sync.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/gravity-sync.sh b/gravity-sync.sh index e4fb55d..04d6ad9 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1634,6 +1634,17 @@ function task_devmode { echo_stat rm -f $HOME/${LOCAL_FOLDR}/dev error_validate + elif [ -f $HOME/${LOCAL_FOLDR}/beta ] + then + MESSAGE="Disabling BETA" + echo_stat + rm -f $HOME/${LOCAL_FOLDR}/beta + error_validate + + MESSAGE="Enabling ${TASKTYPE}" + echo_stat + touch $HOME/${LOCAL_FOLDR}/dev + error_validate else MESSAGE="Enabling ${TASKTYPE}" echo_stat @@ -1647,6 +1658,42 @@ function task_devmode { exit_withchange } +## Devmode Task +function task_betamode { + TASKTYPE='BETA' + MESSAGE="${MESSAGE}: ${TASKTYPE} Requested" + echo_good + + if [ -f $HOME/${LOCAL_FOLDR}/beta ] + then + MESSAGE="Disabling ${TASKTYPE}" + echo_stat + rm -f $HOME/${LOCAL_FOLDR}/beta + error_validate + elif [ -f $HOME/${LOCAL_FOLDR}/dev ] + then + MESSAGE="Disabling DEV" + echo_stat + rm -f $HOME/${LOCAL_FOLDR}/dev + error_validate + + MESSAGE="Enabling ${TASKTYPE}" + echo_stat + touch $HOME/${LOCAL_FOLDR}/beta + error_validate + else + MESSAGE="Enabling ${TASKTYPE}" + echo_stat + touch $HOME/${LOCAL_FOLDR}/beta + error_validate + fi + + MESSAGE="Run UPDATE to apply changes" + echo_info + + exit_withchange +} + ## Update Task function task_update { TASKTYPE='UPDATE' @@ -1936,6 +1983,9 @@ case $# in task_devmode ;; + beta) + task_betamode + devmode) task_devmode ;; From 668475c103bf5854ac1722690543fbc0bfea280e Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 18:42:22 -0500 Subject: [PATCH 06/13] beta mode in changelog --- CHANGELOG.md | 3 +++ gravity-sync.sh | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a813c6..7a505a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ The `./gravity-sync.sh update` and `version` functions will look for the `dbclie #### 2.1.5 Skipping a few digits because what does it really matter? +- Implements a new beta branch, and with it a new `./gravity-sync.sh beta` function to enable it. This will hopefully allow new features and such to be added for test users who can adopt them and provide feedback before rolling out to the main update branch. +- Uses new SQLITE3 backup methodology introduced in 2.1, for all push/pull sync operations. + ## 2.0 ### The Smart Release diff --git a/gravity-sync.sh b/gravity-sync.sh index 04d6ad9..b4e3737 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1985,6 +1985,7 @@ case $# in beta) task_betamode + ;; devmode) task_devmode From 0617525e64ad7e07b77c0f2c441c646643f60007 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 18:46:29 -0500 Subject: [PATCH 07/13] extra quotes --- gravity-sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index b4e3737..bbc57ed 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1810,7 +1810,7 @@ function backup_remote_custom { echo_stat CMD_TIMEOUT='15' - CMD_REQUESTED="sudo cp ${PIHOLE_DIR}/${CUSTOM_DNS} ${PIHOLE_DIR}/${CUSTOM_DNS}.backup'\"" + CMD_REQUESTED="sudo cp ${PIHOLE_DIR}/${CUSTOM_DNS} ${PIHOLE_DIR}/${CUSTOM_DNS}.backup" create_sshcmd fi fi From ac8e6389983aec64643b5051efb085eb4c7489f3 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 20:48:51 -0500 Subject: [PATCH 08/13] adjust md5 hash checking --- gravity-sync.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index bbc57ed..2a76be5 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -299,12 +299,14 @@ function pull_gs_reload { ## Pull Function function pull_gs { + previous_md5 md5_compare backup_settime pull_gs_grav pull_gs_cust pull_gs_reload + md5_recheck logs_export exit_withchange @@ -401,6 +403,7 @@ function push_gs_reload { ## Push Function function push_gs { + previous_md5 md5_compare intent_validate @@ -413,11 +416,7 @@ function push_gs { exit_withchange } -## Smart Sync Function -function smart_gs { - md5_compare - backup_settime - +function previous_md5 { if [ -f "${LOG_PATH}/${HISTORY_MD5}" ] then last_primaryDBMD5=$(sed "1q;d" ${LOG_PATH}/${HISTORY_MD5}) @@ -430,6 +429,13 @@ function smart_gs { last_primaryCLMD5="0" last_secondCLMD5="0" fi +} + +## Smart Sync Function +function smart_gs { + previous_md5 + md5_compare + backup_settime PRIDBCHANGE="0" SECDBCHANGE="0" @@ -1115,6 +1121,11 @@ function error_validate { ## Validate Sync Required function md5_compare { + # last_primaryDBMD5="0" + # last_secondDBMD5="0" + # last_primaryCLMD5="0" + # last_secondCLMD5="0" + HASHMARK='0' MESSAGE="Analyzing ${GRAVITY_FI} on ${REMOTE_HOST}" @@ -1127,7 +1138,7 @@ function md5_compare { secondDBMD5=$(md5sum ${PIHOLE_DIR}/${GRAVITY_FI} | sed 's/\s.*$//') error_validate - if [ "$primaryDBMD5" == "$secondDBMD5" ] + if [ "$primaryDBMD5" == "$last_primaryDBMD5" ] && [ "$secondDBMD5" == "$last_secondDBMD5" ] then HASHMARK=$((HASHMARK+0)) else @@ -1154,7 +1165,7 @@ function md5_compare { secondCLMD5=$(md5sum ${PIHOLE_DIR}/${CUSTOM_DNS} | sed 's/\s.*$//') error_validate - if [ "$primaryCLMD5" == "$secondCLMD5" ] + if [ "$primaryCLMD5" == "$last_primaryCLMD5" ] && [ "$secondCLMD5" == "$last_secondCLMD5" ] then # MESSAGE="${CUSTOM_DNS} Identical" # echo_info From 985ce623557bfcd76eaeb80fdbaeb3eb0cb70270 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 20:50:59 -0500 Subject: [PATCH 09/13] settime --- gravity-sync.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gravity-sync.sh b/gravity-sync.sh index 2a76be5..0279805 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -405,6 +405,7 @@ function push_gs_reload { function push_gs { previous_md5 md5_compare + backup_settime intent_validate @@ -412,6 +413,7 @@ function push_gs { push_gs_cust push_gs_reload + md5_recheck logs_export exit_withchange } From 90ea491d9ec0f7d221632818ec0af5ef5af5bfed Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 21:01:21 -0500 Subject: [PATCH 10/13] comment out warning on recheck --- gravity-sync.sh | 50 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 0279805..59e4dab 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1222,14 +1222,14 @@ function md5_recheck { secondDBMD5=$(md5sum ${PIHOLE_DIR}/${GRAVITY_FI} | sed 's/\s.*$//') error_validate - if [ "$primaryDBMD5" == "$secondDBMD5" ] - then - HASHMARK=$((HASHMARK+0)) - else - MESSAGE="Differenced ${GRAVITY_FI} Detected" - echo_warn - HASHMARK=$((HASHMARK+1)) - fi + # if [ "$primaryDBMD5" == "$secondDBMD5" ] + # then + # HASHMARK=$((HASHMARK+0)) + # else + # MESSAGE="Differenced ${GRAVITY_FI} Detected" + # echo_warn + # HASHMARK=$((HASHMARK+1)) + # fi if [ "$SKIP_CUSTOM" != '1' ] then @@ -1249,16 +1249,16 @@ function md5_recheck { secondCLMD5=$(md5sum ${PIHOLE_DIR}/${CUSTOM_DNS} | sed 's/\s.*$//') error_validate - if [ "$primaryCLMD5" == "$secondCLMD5" ] - then + # if [ "$primaryCLMD5" == "$secondCLMD5" ] + # then # MESSAGE="${CUSTOM_DNS} Identical" # echo_info - HASHMARK=$((HASHMARK+0)) - else - MESSAGE="Differenced ${CUSTOM_DNS} Detected" - echo_warn - HASHMARK=$((HASHMARK+1)) - fi + # HASHMARK=$((HASHMARK+0)) + # else + # MESSAGE="Differenced ${CUSTOM_DNS} Detected" + # echo_warn + # HASHMARK=$((HASHMARK+1)) + # fi else MESSAGE="No ${CUSTOM_DNS} Detected on ${REMOTE_HOST}" echo_info @@ -1268,7 +1268,7 @@ function md5_recheck { then REMOTE_CUSTOM_DNS="1" MESSAGE="${REMOTE_HOST} has ${CUSTOM_DNS}" - HASHMARK=$((HASHMARK+1)) + # HASHMARK=$((HASHMARK+1)) echo_info fi MESSAGE="No ${CUSTOM_DNS} Detected on $HOSTNAME" @@ -1276,14 +1276,14 @@ function md5_recheck { fi fi - if [ "$HASHMARK" != "0" ] - then - MESSAGE="Replication Checks Failed" - echo_warn - else - MESSAGE="Replication Was Successful" - echo_info - fi + # if [ "$HASHMARK" != "0" ] + # then + # MESSAGE="Replication Checks Failed" + # echo_warn + # else + # MESSAGE="Replication Was Successful" + # echo_info + # fi } ## Validate Intent From bc756641295f54a145423dcb876de8c64c6fabb0 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 21:06:06 -0500 Subject: [PATCH 11/13] load previous md5 for compare --- gravity-sync.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 59e4dab..be52d0b 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1747,7 +1747,8 @@ function task_compare { validate_gs_folders validate_ph_folders validate_os_sshpass - + + previous_md5 md5_compare } From 8e78bca575299674791b64419ac80a69868ab01d Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 21:12:21 -0500 Subject: [PATCH 12/13] beta updater --- gravity-sync.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index be52d0b..7e702f7 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -108,6 +108,9 @@ function update_gs { if [ -f "$HOME/${LOCAL_FOLDR}/dev" ] then BRANCH='development' + elif if [ -f "$HOME/${LOCAL_FOLDR}/beta" ] + then + BRANCH='beta' else BRANCH='master' fi @@ -1492,6 +1495,9 @@ function show_version { if [ -f $HOME/${LOCAL_FOLDR}/dev ] then DEVVERSION="dev" + elif [ -f $HOME/${LOCAL_FOLDR}/beta ] + then + DEVVERSION="beta" else DEVVERSION="" fi @@ -1513,8 +1519,6 @@ function show_version { fi echo_info echo -e "========================================================" - - dbclient_warning } function dbclient_warning { From ad1f758384af59e4c48bc42e8b27856c4afccb41 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 11 Jul 2020 21:15:01 -0500 Subject: [PATCH 13/13] if --- gravity-sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 7e702f7..fd22e34 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -108,7 +108,7 @@ function update_gs { if [ -f "$HOME/${LOCAL_FOLDR}/dev" ] then BRANCH='development' - elif if [ -f "$HOME/${LOCAL_FOLDR}/beta" ] + elif [ -f "$HOME/${LOCAL_FOLDR}/beta" ] then BRANCH='beta' else