diff --git a/VERSION b/VERSION index 4b4ea1b..81f1b89 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.4.6 \ No newline at end of file +3.4.7 \ No newline at end of file diff --git a/gravity-sync.sh b/gravity-sync.sh index 240d90f..733e2ec 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -3,7 +3,7 @@ SCRIPT_START=$SECONDS # GRAVITY SYNC BY VMSTAN ##################### PROGRAM='Gravity Sync' -VERSION='3.4.6' +VERSION='3.4.7' # For documentation or downloading updates visit https://github.com/vmstan/gravity-sync # Requires Pi-Hole 5.x or higher already be installed, for help visit https://pi-hole.net @@ -89,7 +89,6 @@ source ${LOCAL_FOLDR}/includes/gs-colors.sh source ${LOCAL_FOLDR}/includes/gs-core.sh # Gravity Replication Functions -source ${LOCAL_FOLDR}/includes/gs-compare.sh source ${LOCAL_FOLDR}/includes/gs-pull.sh source ${LOCAL_FOLDR}/includes/gs-push.sh source ${LOCAL_FOLDR}/includes/gs-smart.sh diff --git a/includes/gs-automate.sh b/includes/gs-automate.sh index 1c273cb..ebfb1f1 100644 --- a/includes/gs-automate.sh +++ b/includes/gs-automate.sh @@ -55,9 +55,6 @@ function task_automate { if [ $CRON_EXIST == 1 ] then clear_cron - - # MESSAGE="Synchronization automation has been disabled" - # echo_warn else MESSAGE="${UI_AUTO_CRON_DISABLED}" echo_warn diff --git a/includes/gs-compare.sh b/includes/gs-compare.sh deleted file mode 100644 index 8ab8dbc..0000000 --- a/includes/gs-compare.sh +++ /dev/null @@ -1,29 +0,0 @@ -# GRAVITY SYNC BY VMSTAN ##################### -# gs-compare.sh ############################## - -# For documentation or downloading updates visit https://github.com/vmstan/gravity-sync -# This code is called from the main gravity-sync.sh file and should not execute directly! - -## Compare Task -function task_compare { - TASKTYPE='COMPARE' - MESSAGE="${MESSAGE}: ${TASKTYPE}" - echo_good - - show_target - validate_gs_folders - validate_ph_folders - - if [ "${INCLUDE_CNAME}" == "1" ] - then - validate_dns_folders - fi - - validate_os_sshpass - - previous_md5 - md5_compare - backup_cleanup - - exit_withchange -} \ No newline at end of file diff --git a/includes/gs-config.sh b/includes/gs-config.sh index b7d7e6e..5a4be8e 100644 --- a/includes/gs-config.sh +++ b/includes/gs-config.sh @@ -18,11 +18,6 @@ function task_configure { else config_generate fi - - # backup_settime - # backup_local_gravity - # backup_local_custom - # backup_cleanup create_alias @@ -30,9 +25,7 @@ function task_configure { } ## Generate New Configuration -function config_generate { - # detect_ssh - +function config_generate { MESSAGE="Creating New ${CONFIG_FILE} from Template" echo_stat cp ${LOCAL_FOLDR}/templates/${CONFIG_FILE}.example ${LOCAL_FOLDR}/settings/${CONFIG_FILE} @@ -129,14 +122,6 @@ function config_generate { error_validate export_sshkey - - # MESSAGE="Testing Configuration" - # echo_info - - # validate_os_sshpass - # validate_sqlite3 - - # detect_remotersync } ## Advanced Configuration Options diff --git a/includes/gs-core.sh b/includes/gs-core.sh index 8b57928..a12afba 100644 --- a/includes/gs-core.sh +++ b/includes/gs-core.sh @@ -50,11 +50,6 @@ function import_gs { then source ${LOCAL_FOLDR}/settings/${CONFIG_FILE} error_validate - - # MESSAGE="Targeting ${REMOTE_USER}@${REMOTE_HOST}" - # echo_info - - # detect_ssh else echo_fail @@ -155,3 +150,27 @@ function ph_type { RH_EXEC="sudo ${RODMAN_BIN} exec ${ROCKER_CON} pihole" fi } + +## Compare Task +function task_compare { + TASKTYPE='COMPARE' + MESSAGE="${MESSAGE}: ${TASKTYPE}" + echo_good + + show_target + validate_gs_folders + validate_ph_folders + + if [ "${INCLUDE_CNAME}" == "1" ] + then + validate_dns_folders + fi + + validate_os_sshpass + + previous_md5 + md5_compare + backup_cleanup + + exit_withchange +} \ No newline at end of file diff --git a/includes/gs-logging.sh b/includes/gs-logging.sh index 5d7e60d..b7b74fc 100644 --- a/includes/gs-logging.sh +++ b/includes/gs-logging.sh @@ -68,9 +68,6 @@ function show_crontab { if [ -s ${LOG_PATH}/${CRONJOB_LOG} ] echo_good - # MESSAGE="Tailing ${LOG_PATH}/${CRONJOB_LOG}" - # echo_info - echo_lines date -r ${LOG_PATH}/${CRONJOB_LOG} cat ${LOG_PATH}/${CRONJOB_LOG} diff --git a/includes/gs-purge.sh b/includes/gs-purge.sh index 35910dd..560f826 100644 --- a/includes/gs-purge.sh +++ b/includes/gs-purge.sh @@ -59,8 +59,5 @@ function task_purge { sleep 1 - # MESSAGE="Realigning Dilithium Matrix" - # echo_good - update_gs } \ No newline at end of file diff --git a/includes/gs-restore.sh b/includes/gs-restore.sh index f99ac54..c44d65a 100644 --- a/includes/gs-restore.sh +++ b/includes/gs-restore.sh @@ -72,9 +72,6 @@ function restore_gs { if [ "${CUSTOM_DATE_LIST}" != "" ] then - # MESSAGE="${UI_RESTORE_SELECT_DATE} ${UI_CUSTOM_NAME}" - # echo_info - echo_lines ls ${LOCAL_FOLDR}/${BACKUP_FOLD} | grep $(date +%Y) | grep ${CUSTOM_DNS} | colrm 18 echo -e "IGNORE-CUSTOM" @@ -115,9 +112,6 @@ function restore_gs { if [ "${CNAME_DATE_LIST}" != "" ] then - # MESSAGE="${UI_RESTORE_SELECT_DATE} ${UI_CNAME_NAME}" - # echo_info - echo_lines ls ${LOCAL_FOLDR}/${BACKUP_FOLD} | grep $(date +%Y) | grep ${CNAME_CONF} | colrm 18 echo -e "IGNORE-CNAME" @@ -182,12 +176,6 @@ function restore_gs { MESSAGE="${UI_RESTORE_TIME_TRAVEL}" echo_info - # MESSAGE="Stopping FTLDNS services on $HOSTNAME" - # echo_stat - - # ${PH_EXEC} stop >/dev/null 2>&1 - # error_validate - if [ "$DO_GRAVITY_RESTORE" == "1" ] then MESSAGE="${UI_RESTORE_SECONDARY} ${UI_GRAVITY_NAME}" diff --git a/includes/gs-ssh.sh b/includes/gs-ssh.sh index 03a676a..796deba 100644 --- a/includes/gs-ssh.sh +++ b/includes/gs-ssh.sh @@ -6,32 +6,14 @@ ## Determine SSH Pathways function create_sshcmd { - # if hash ssh 2>/dev/null - # then - # if [ -z "$SSHPASSWORD" ] - # then timeout --preserve-status ${CMD_TIMEOUT} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} "${CMD_REQUESTED}" error_validate - # else - # timeout --preserve-status ${CMD_TIMEOUT} ${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} "${CMD_REQUESTED}" - # error_validate - # fi - # fi } ## Determine SSH Pathways function create_rsynccmd { - # if hash ssh 2>/dev/null - # then - # if [ -z "$SSHPASSWORD" ] - # then rsync --rsync-path="${RSYNC_REPATH}" -e "${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${RSYNC_SOURCE} ${RSYNC_TARGET} >/dev/null 2>&1 error_validate - # else - # rsync --rsync-path="${RSYNC_REPATH}" -e "${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${RSYNC_SOURCE} ${RSYNC_TARGET} >/dev/null 2>&1 - # error_validate - # fi - # fi } ## Detect SSH-KEYGEN @@ -93,36 +75,26 @@ function export_sshkey { ## Detect SSH & RSYNC function detect_ssh { - MESSAGE="Validating OpenSSH client" + MESSAGE="${UI_VALIDATING} ${UI_CORE_OPENSSH}" echo_stat if hash ssh 2>/dev/null then - MESSAGE="${MESSAGE} (OpenSSH)" echo_good SSH_CMD='ssh' elif hash dbclient 2>/dev/null then - MESSAGE="${MESSAGE} (Dropbear)" echo_fail - MESSAGE="Dropbear is not supported in ${PROGRAM} ${VERSION}" + MESSAGE="${UI_DROPBEAR_DEP}" echo_warn exit_nochange else echo_fail exit_nochange - - # MESSAGE="Attempting to Compensate" - # echo_warn - # MESSAGE="Installing SSH Client with ${PKG_MANAGER}" - # echo_stat - - # ${PKG_INSTALL} ssh-client >/dev/null 2>&1 - # error_validate fi - MESSAGE="Validating RSYNC client" + MESSAGE="${UI_VALIDATING} ${UI_CORE_RSYNC}" echo_stat if hash rsync 2>/dev/null @@ -131,19 +103,8 @@ function detect_ssh { else echo_fail - MESSAGE="RSYNC client install is required" echo_warn exit_nochange - - # distro_check - - # MESSAGE="Attempting to Compensate" - # echo_warn - - # MESSAGE="Installing RSYNC with ${PKG_MANAGER}" - # echo_stat - # ${PKG_INSTALL} rsync >/dev/null 2>&1 - # error_validate fi } @@ -181,7 +142,7 @@ function detect_remotersync { } function show_target { - MESSAGE="Remote Pi-hole: ${REMOTE_USER}@${REMOTE_HOST}" + MESSAGE="${UI_CORE_UC_PRIMARY} ${UI_CORE_APP}: ${REMOTE_USER}@${REMOTE_HOST}" echo_info detect_ssh diff --git a/includes/gs-ui.sh b/includes/gs-ui.sh index 5416cba..e424fb6 100644 --- a/includes/gs-ui.sh +++ b/includes/gs-ui.sh @@ -17,6 +17,13 @@ UI_CORE_LOADING='Loading' UI_CORE_EVALUATING='Evaluating arguments' UI_CORE_INIT="Initalizing ${PROGRAM} (${VERSION})" UI_CORE_RELOCATING='Relocating' +UI_CORE_APP='Pi-hole' +UI_CORE_APP_DNS='DNSMASQ' +UI_CORE_APP_SQL='SQLITE3' +UI_CORE_OPENSSH='OpenSSH' +UI_CORE_RSYNC='RSYNC' +UI_CORE_UC_PRIMARY='Primary' +UI_CORE_UC_SECONDARY='Secondary' # Exit UI_EXIT_CALC_END='after' @@ -43,9 +50,6 @@ UI_VALIDATING='Validating configuration of' UI_VALIDATING_FAIL_CONTAINER='Unable to validate running container instance of' UI_VALIDATING_FAIL_FOLDER='Unable to validate configuration folder for' UI_VALIDATING_FAIL_BINARY='Unable to validate the availibility of' -UI_CORE_APP='Pi-hole' -UI_CORE_APP_DNS='DNSMASQ' -UI_CORE_APP_SQL='SQLITE3' UI_COMPENSATE='Attempting to compensate' UI_SET_FILE_OWNERSHIP='Setting file ownership on' UI_SET_FILE_PERMISSION='Setting file permissions on' @@ -110,4 +114,4 @@ UI_AUTO_CRON_EXISTS='Automation task already exists in crontab' UI_AUTO_CRON_DISPLAY_FREQ='Select synchronization frequency (in minutes)' UI_AUTO_CRON_SELECT_FREQ='Valid options are 5, 10, 15, 30 or 0 to disable (default: 15)' UI_AUTO_CRON_SAVING='Saving new synchronization task to crontab' -UI_AUTO_CRON_DISABLED='Synchronization automation has been disabled' +UI_AUTO_CRON_DISABLED='Synchronization automation has been disabled' \ No newline at end of file diff --git a/includes/gs-validate.sh b/includes/gs-validate.sh index 997f785..c0f98c6 100644 --- a/includes/gs-validate.sh +++ b/includes/gs-validate.sh @@ -82,17 +82,10 @@ function validate_sqlite3 { echo_stat if hash sqlite3 2>/dev/null then - # MESSAGE="SQLITE3 Utility Detected" echo_good else MESSAGE="${UI_VALIDATING_FAIL_BINARY} ${UI_CORE_APP_SQL}" echo_warn - - #MESSAGE="Installing SQLLITE3 with ${PKG_MANAGER}" - #echo_stat - - #${PKG_INSTALL} sqllite3 >/dev/null 2>&1 - #error_validate fi }