From 8d3884fbfa3bffce3fa7bc1b5f98f3c26a9e5a5d Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Tue, 26 May 2020 14:01:01 -0500 Subject: [PATCH] Starting config creator --- gravity-sync.sh | 53 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index d329f65..8707301 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -2,7 +2,7 @@ # GRAVITY SYNC BY VMSTAN ##################### PROGRAM='Gravity Sync' -VERSION='1.3.4' +VERSION='1.4.0' # Must execute from a location in the home folder of the user who own's it (ex: /home/pi/gravity-sync) # Configure certificate based SSH authentication between the Pi-hole HA nodes - it does not use passwords @@ -539,6 +539,57 @@ case $# in show_crontab ;; + + config) + TASKTYPE='CONFIG' + echo -e "\r${GOOD} ${MESSAGE}" + echo -e "${INFO} Entering ${TASKTYPE} Mode" + + if [ -f $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} ] + then + source $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} + MESSAGE="Configuration File Exists" + echo -e "${WARN} ${MESSAGE}" + + echo -e "========================================================" + echo -e "========================================================" + echo -e "" + cat $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} + echo -e "" + echo -e "========================================================" + echo -e "========================================================" + + MESSAGE="Are you sure you want to erase this configuration?" + echo -e "${WARN} ${MESSAGE}" + + select yn in "Yes" "No"; do + case $yn in + Yes ) + MESSAGE="Erasing Existing Configuration" + echo -en "${STAT} ${MESSAGE}" + rm -f $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} + error_validate + + exit_withchange + ;; + + No ) + exit_nochange + ;; + esac + done + + else + echo -e "\r${FAIL} ${MESSAGE}" + + MESSAGE="${CONFIG_FILE} Missing" + echo -e "${INFO} ${MESSAGE}" + + exit_nochange + fi + + ;; + *) echo -e "\r${FAIL} ${MESSAGE}"