Merge pull request #60 from vmstan/development

2.1.5 beta
This commit is contained in:
Michael Stanclift 2020-07-11 21:17:16 -05:00 committed by GitHub
commit f2dacc1581
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 108 additions and 36 deletions

View File

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

View File

@ -108,6 +108,9 @@ function update_gs {
if [ -f "$HOME/${LOCAL_FOLDR}/dev" ]
then
BRANCH='development'
elif [ -f "$HOME/${LOCAL_FOLDR}/beta" ]
then
BRANCH='beta'
else
BRANCH='master'
fi
@ -299,12 +302,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,7 +406,9 @@ function push_gs_reload {
## Push Function
function push_gs {
previous_md5
md5_compare
backup_settime
intent_validate
@ -409,15 +416,12 @@ function push_gs {
push_gs_cust
push_gs_reload
md5_recheck
logs_export
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 +434,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 +1126,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 +1143,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 +1170,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
@ -1209,14 +1225,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
@ -1236,16 +1252,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
@ -1255,7 +1271,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"
@ -1263,14 +1279,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
@ -1479,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
@ -1500,8 +1519,6 @@ function show_version {
fi
echo_info
echo -e "========================================================"
dbclient_warning
}
function dbclient_warning {
@ -1634,6 +1651,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 +1675,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'
@ -1687,7 +1751,8 @@ function task_compare {
validate_gs_folders
validate_ph_folders
validate_os_sshpass
previous_md5
md5_compare
}
@ -1763,7 +1828,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
@ -1936,6 +2001,10 @@ case $# in
task_devmode
;;
beta)
task_betamode
;;
devmode)
task_devmode
;;