* start 3.6

* Remove backup retention reference

* dbclient_warning removed

* remove extra linebreaks

* remove backup task

* Increased backup and integrity timeouts to 240

* Remove brackets from message codes

* Arrow for info

* Different arrow

* Ain't gonna restore no more

* Abortion aborted

* format change for config test

* All kinds of yes and no

* echo_grav

* Move advanced to the end

* removed custom ssh, ping check and port options from wizard

* primary address changes

* rework user input

* good clean fun

* smaller version text

* less info

* Set push commands to default 240 second timeout

* Remove reference to backup and restore tasks from log output

* Remove backup refs

* Move UI elements over to gs-ui

* Move ICMP to UI

* More UI

* More UI

* UI changes

* Add end config

* Spaces and such

* MOre UI

* UI

* UI UI UI

* UI UI

* echo_blue

* echo_blue too

* switch

* fip flop

* Too blue

* Fix path being run

* =

* Remove ()

* continued cleaning

* Almost done rewriting config

* switch CNAME defaults

* Add CNAME function
This commit is contained in:
Michael Stanclift 2022-03-01 09:47:22 -06:00 committed by GitHub
parent 3a125a2e30
commit c7a825970a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 270 additions and 483 deletions

View File

@ -1 +1 @@
3.5.0
3.6.0

View File

@ -1,5 +1,5 @@
Your backup files will be stored here.
They will be ignored by any git updates.
They will be wiped out by Git.
This file is required for Git to create the folder.
It serves no other purpose.
Live long and prosper.

View File

@ -3,7 +3,7 @@ SCRIPT_START=$SECONDS
# GRAVITY SYNC BY VMSTAN #####################
PROGRAM='Gravity Sync'
VERSION='3.5.0'
VERSION='3.6.0'
# 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
@ -91,7 +91,6 @@ source ${LOCAL_FOLDR}/includes/gs-core.sh
source ${LOCAL_FOLDR}/includes/gs-pull.sh
source ${LOCAL_FOLDR}/includes/gs-push.sh
source ${LOCAL_FOLDR}/includes/gs-smart.sh
source ${LOCAL_FOLDR}/includes/gs-restore.sh
source ${LOCAL_FOLDR}/includes/gs-backup.sh
# Hashing & SSH Functions
@ -165,6 +164,9 @@ case $# in
info)
start_gs
task_info ;;
cname)
start_gs
task_cname ;;
*)
start_gs
task_invalid ;;

View File

@ -5,23 +5,6 @@
# 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!
## Backup Task
function task_backup() {
TASKTYPE='BACKUP'
MESSAGE="${MESSAGE}: ${TASKTYPE}"
echo_good
backup_settime
backup_local_gravity
backup_local_gravity_integrity
backup_local_custom
backup_local_cname
# backup_cleanup
logs_export
exit_withchange
}
function backup_settime() {
BACKUPTIMESTAMP=$(date +%F-%H%M%S)
}
@ -116,7 +99,7 @@ function backup_remote_gravity_integrity() {
MESSAGE="{UI_BACKUP_INTEGRITY_DELETE} ${UI_GRAVITY_NAME}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="sudo rm ${RIHOLE_DIR}/${GRAVITY_FI}.backup"
create_sshcmd
@ -130,7 +113,7 @@ function backup_remote_custom() {
MESSAGE="${UI_BACKUP_PRIMARY} ${UI_CUSTOM_NAME}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="sudo cp ${RIHOLE_DIR}/${CUSTOM_DNS} ${RIHOLE_DIR}/${CUSTOM_DNS}.backup"
create_sshcmd
fi
@ -142,7 +125,7 @@ function backup_remote_cname() {
MESSAGE="${UI_BACKUP_PRIMARY} ${UI_CNAME_NAME}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="sudo cp ${RNSMAQ_DIR}/${CNAME_CONF} ${RIHOLE_DIR}/dnsmasq.d-${CNAME_CONF}.backup"
create_sshcmd
fi
@ -151,7 +134,6 @@ function backup_remote_cname() {
function backup_cleanup() {
MESSAGE="${UI_BACKUP_PURGE}"
echo_stat
git clean -fq
error_validate
}

View File

@ -15,13 +15,14 @@ BOLD='\033[1m'
NC='\033[0m'
## Message Codes
FAIL="[${RED}${NC}]"
WARN="[${PURPLE}!${NC}]"
GOOD="[${GREEN}${NC}]"
STAT="[${CYAN}e${NC}]"
INFO="[${YELLOW}i${NC}]"
NEED="[${BLUE}?${NC}]"
LOGO="[${PURPLE}${NC}]"
FAIL="${RED}${NC}"
WARN="${PURPLE}!${NC}"
GOOD="${GREEN}${NC}"
STAT="${CYAN}${NC}"
INFO="${YELLOW}»${NC}"
INF1="${CYAN}${NC}"
NEED="${BLUE}?${NC}"
LOGO="${PURPLE}${NC}"
## Echo Stack
### Informative
@ -29,6 +30,10 @@ function echo_info {
echo -e "${INFO} ${YELLOW}${MESSAGE}${NC}"
}
function echo_inf1 {
echo -e "${INF1} ${CYAN}${MESSAGE}${NC}"
}
### Warning
function echo_warn {
echo -e "${WARN} ${PURPLE}${MESSAGE}${NC}"
@ -44,6 +49,11 @@ function echo_good {
echo -e "\r${GOOD} ${MESSAGE}"
}
### Success
function echo_good_clean {
echo -e "\r${GOOD} ${MESSAGE}"
}
### Success
function echo_sameline {
echo -en " "

View File

@ -20,13 +20,12 @@ function task_configure {
fi
create_alias
exit_withchange
}
## Generate New Configuration
function config_generate {
MESSAGE="Creating New ${CONFIG_FILE} from Template"
MESSAGE="${UI_CONFIG_CREATING} ${CONFIG_FILE}"
echo_stat
cp ${LOCAL_FOLDR}/templates/${CONFIG_FILE}.example ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
@ -35,98 +34,120 @@ function config_generate {
echo -e "Welcome to the ${PURPLE}Gravity Sync${NC} Configuration Wizard"
echo -e "Please read through ${BLUE}https://github.com/vmstan/gravity-sync/wiki${NC} before you continue!"
echo_blank
echo -e "If the installer detects that you have a supported container engine (Docker or Podman) installed,"
echo -e "you will be directed to the advanced installation options. Otherwise you can manually enable this"
echo -e "to adjust settings such as custom Pi-hole binary or configuration directories, SSH options, CNAME"
echo -e "replication, and backup retention."
echo -e "If the installer detects that you have a supported container engine (Docker or Podman) installed"
echo -e "on your local Pi-hole, you will be directed to the advanced installation options. If you using "
echo -e "containers on your remote Pi-hole, you'll need to select this option manually to adjust settings"
echo -e "such as custom Pi-hole binary or configuration directories, CNAME replication, etc."
echo_blank
echo -e "Gravity Sync uses a primary/secondary model for replication, and normally syncs changes from the "
echo -e "primary to the secondary. The LOCAL Pi-hole where you are running this configuration script is"
echo -e "considered the SECONDARY Pi-hole! The REMOTE Pi-hole where you will normally make configuration"
echo -e "changes is considered the PRIMARY Pi-hole."
echo -e "considered the SECONDARY Pi-hole! The REMOTE Pi-hole where you normally make Gravity Database"
echo -e "changes, and is considered the PRIMARY Pi-hole."
echo_blank
echo -e "Confused? Please refer back to the documentation."
echo_lines
docker_detect
podman_detect
if [ "${DOCKERREADY}" == "1" ] || [ "${PODMANREADY}" == "1" ]
then
MESSAGE="Container Engine Detected"
echo_good
MESSAGE="Advanced Configuration Required"
echo_info
advanced_config_generate
else
MESSAGE="Use Advanced Installation Options? (Y/N, default N)"
echo_need
read INPUT_ADVANCED_INSTALL
INPUT_ADVANCED_INSTALL="${INPUT_ADVANCED_INSTALL:-N}"
if [ "${INPUT_ADVANCED_INSTALL}" == "Y" ]
then
MESSAGE="Advanced Configuration Selected"
echo_info
advanced_config_generate
elif [ "${INPUT_ADVANCED_INSTALL}" == "N" ]
then
MESSAGE="Standard Configuration Selected"
echo_info
else
MESSAGE="Invalid Selection"
echo_warn
exit_nochange
fi
fi
MESSAGE="Required Gravity Sync Settings"
MESSAGE="${PROGRAM} ${UI_CONFIG_REQUIRED}"
echo_info
MESSAGE="Primary/Remote Pi-hole Host Address (IP or DNS)"
MESSAGE="${UI_CORE_APP} ${UI_CONFIG_REMOTE} ${UI_CONFIG_HOSTREQ}"
echo_inf1
MESSAGE="IP"
echo_need
read INPUT_REMOTE_HOST
if [ "${PING_AVOID}" != "1" ]
then
MESSAGE="Testing Network Connection (ICMP)"
echo_stat
ping -c 3 ${INPUT_REMOTE_HOST} >/dev/null 2>&1
error_validate
else
MESSAGE="Bypassing Network Testing (ICMP)"
echo_warn
fi
MESSAGE="Saving Primary/Remote Host to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_ICMP_TEST} ${INPUT_REMOTE_HOST}"
echo_stat
ping -c 3 ${INPUT_REMOTE_HOST} >/dev/null 2>&1
error_validate
MESSAGE="${UI_CONFIG_SAVING} ${INPUT_REMOTE_HOST} host to ${CONFIG_FILE}"
echo_stat
sed -i "/REMOTE_HOST='192.168.1.10'/c\REMOTE_HOST='${INPUT_REMOTE_HOST}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
MESSAGE="Existing SSH User for ${INPUT_REMOTE_HOST}"
MESSAGE="${UI_CORE_APP} ${UI_CONFIG_REMOTE} ${UI_CONFIG_USERREQ} for ${INPUT_REMOTE_HOST}"
echo_inf1
MESSAGE="User"
echo_need
read INPUT_REMOTE_USER
MESSAGE="Saving User "${INPUT_REMOTE_USER}" to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${INPUT_REMOTE_USER}@${INPUT_REMOTE_HOST} user to ${CONFIG_FILE}"
echo_stat
sed -i "/REMOTE_USER='pi'/c\REMOTE_USER='${INPUT_REMOTE_USER}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
generate_sshkey
MESSAGE="Importing New ${CONFIG_FILE}"
MESSAGE="${UI_CORE_LOADING} ${CONFIG_FILE}"
echo_stat
source ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
export_sshkey
echo_lines
export_sshkey
echo_lines
MESSAGE="${UI_CONFIG_SSH_KEYPAIR} ${INPUT_REMOTE_HOST}"
echo_good_clean
MESSAGE="${UI_CONFIG_CONT_LOOKUP}"
echo_stat
docker_detect
podman_detect
if [ "${DOCKERREADY}" == "1" ] || [ "${PODMANREADY}" == "1" ]
then
MESSAGE="${UI_CONFIG_CONT_DETECT} ${UI_CONFIG_CONT_DETECTED}"
echo_good
MESSAGE="${UI_CORE_LOADING} ${UI_CONFIG_ADVANCED}"
echo_info
advanced_config_generate
else
MESSAGE="${UI_CONFIG_CONT_DETECT} ${UI_CONFIG_CONT_DETECTNA}"
echo_good
MESSAGE="${UI_CONFIG_DOADVANCED}"
echo_inf1
MESSAGE="${UI_CONFIG_YESNON}"
echo_need
read INPUT_ADVANCED_INSTALL
INPUT_ADVANCED_INSTALL="${INPUT_ADVANCED_INSTALL:-N}"
if [ "${INPUT_ADVANCED_INSTALL}" == "Yes" ] || [ "${INPUT_ADVANCED_INSTALL}" == "yes" ] || [ "${INPUT_ADVANCED_INSTALL}" == "Y" ] || [ "${INPUT_ADVANCED_INSTALL}" == "y" ]
then
MESSAGE="${UI_CORE_LOADING} ${UI_CONFIG_ADVANCED}"
echo_info
advanced_config_generate
else
end_config
fi
fi
}
function end_config(){
echo_lines
echo -e "Configuration has been completed successfully, if you've still not read the instructions"
echo -e "please read through ${BLUE}https://github.com/vmstan/gravity-sync/wiki${NC} before you continue!"
echo_blank
echo -e "Your next step is to complete a sync of data from your remote Pi-hole to this local Pi-hole."
echo -e "ex: gravity-sync pull"
echo_blank
echo -e "If this completes successfully you can automate future sync jobs to run at a regular interval."
echo -e "ex: gravity-sync automate"
echo_blank
echo -e "Still confused? Please refer back to the documentation."
echo_lines
}
## Advanced Configuration Options
function advanced_config_generate {
MESSAGE="Local/Secondary Pi-hole Instance Type? (Allowed: 'docker' or 'podman' or 'default')"
MESSAGE="${UI_CONFIG_LOCALSEC} ${UI_CORE_APP} ${UI_CONFIG_INSTANCEREQ}"
echo_inf1
MESSAGE="${UI_CONFIG_INSTANCETYPE}"
echo_need
read INPUT_PH_IN_TYPE
INPUT_PH_IN_TYPE="${INPUT_PH_IN_TYPE:-default}"
@ -135,20 +156,18 @@ function advanced_config_generate {
then
if [ "${INPUT_PH_IN_TYPE}" != "docker" ] && [ "${INPUT_PH_IN_TYPE}" != "podman" ]
then
MESSAGE="Local/Secondary Container Type must either be 'docker' or 'podman'"
MESSAGE="${UI_CONFIG_LOCALSEC} ${UI_CONFIG_INSTANCE_ERROR}"
echo_warn
exit_withchanges
exit_withchange
fi
MESSAGE="Saving Local/Secondary Container Type Setting to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_LOCAL} ${UI_CONFIG_CONTAINER_TYPE} to ${CONFIG_FILE}"
echo_stat
sed -i "/# PH_IN_TYPE=''/c\PH_IN_TYPE='${INPUT_PH_IN_TYPE}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
MESSAGE="Displaying Currently Running Container Images"
MESSAGE="${UI_CONFIG_CONT_DETECT} ${UI_CONFIG_IMAGES}"
echo_info
echo_lines
if [ "${INPUT_PH_IN_TYPE}" == "docker" ]
then
@ -159,60 +178,68 @@ function advanced_config_generate {
fi
echo_lines
MESSAGE="Local/Secondary Container Name? (Leave blank for default 'pihole')"
MESSAGE="${UI_CONFIG_LOCALSEC} ${UI_CORE_APP} ${UI_CONFIG_INSTANCENAME}"
echo_inf1
MESSAGE="${UI_CONFIG_PIHOLE_DEFAULT}"
echo_need
read INPUT_DOCKER_CON
INPUT_DOCKER_CON="${INPUT_DOCKER_CON:-pihole}"
if [ "${INPUT_DOCKER_CON}" != "pihole" ]
then
MESSAGE="Saving Local/Secondary Container Name to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_LOCAL} ${UI_CONFIG_CONTAINER_NAME} to ${CONFIG_FILE}"
echo_stat
sed -i "/# DOCKER_CON=''/c\DOCKER_CON='${INPUT_DOCKER_CON}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
fi
MESSAGE="Local/Secondary Pi-hole 'etc' Volume Path? (Required, no trailing slash)"
MESSAGE="${UI_CONFIG_LOCALSEC} ${UI_CORE_APP} ${UI_CONFIG_ETC_VOLPATH}"
echo_inf1
MESSAGE="${UI_CONFIG_ETC_VOLPATH_EXAMPLE}"
echo_need
read INPUT_PIHOLE_DIR
if [ "${INPUT_PIHOLE_DIR}" != "" ]
then
MESSAGE="Saving Local/Secondary Pi-hole Volume to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_LOCAL} ${UI_CORE_APP} ${UI_CONFIG_ETC_VOLPATH} to ${CONFIG_FILE}"
echo_stat
sed -i "/# PIHOLE_DIR=''/c\PIHOLE_DIR='${INPUT_PIHOLE_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
SKIP_PIHOLE_DIR="1"
else
MESSAGE="This setting is required!"
MESSAGE="${UI_CONFIG_SETTING_REQUIRED}"
echo_warn
exit_withchanges
exit_withchange
fi
MESSAGE="Local/Secondary DNSMASQ 'etc' Volume Path? (Required, no trailing slash)"
MESSAGE="${UI_CONFIG_LOCALSEC} ${UI_CORE_APP_DNS} ${UI_CONFIG_ETC_VOLPATH}"
echo_inf1
MESSAGE="${UI_CONFIG_ETC_VOLDNSQ_EXAMPLE}"
echo_need
read INPUT_DNSMAQ_DIR
if [ "${INPUT_DNSMAQ_DIR}" != "" ]
then
MESSAGE="Saving Local/Secondary DNSMASQ Volume to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_LOCAL} ${UI_CORE_APP_DNS} ${UI_CONFIG_ETC_VOLPATH} to ${CONFIG_FILE}"
echo_stat
sed -i "/# DNSMAQ_DIR=''/c\DNSMAQ_DIR='${INPUT_DNSMAQ_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
SKIP_DNSMASQ_DIR="1"
else
MESSAGE="This setting is required!"
MESSAGE="${UI_CONFIG_SETTING_REQUIRED}"
echo_warn
exit_withchanges
exit_withchange
fi
MESSAGE="Saving Local/Secondary Volume Ownership to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_LOCAL} ${UI_CONFIG_VOLUME_OWNER} to ${CONFIG_FILE}"
echo_stat
sed -i "/# FILE_OWNER=''/c\FILE_OWNER='999:999'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
fi
MESSAGE="Primary/Remote Pi-hole Instance Type? (Allowed: 'docker' or 'podman' or 'default')"
MESSAGE="${UI_CONFIG_REMOTEPRI} ${UI_CORE_APP} ${UI_CONFIG_INSTANCEREQ}"
echo_inf1
MESSAGE="${UI_CONFIG_INSTANCETYPE}"
echo_need
read INPUT_RH_IN_TYPE
INPUT_RH_IN_TYPE="${INPUT_RH_IN_TYPE:-default}"
@ -221,63 +248,69 @@ function advanced_config_generate {
then
if [ "${INPUT_RH_IN_TYPE}" != "docker" ] && [ "${INPUT_RH_IN_TYPE}" != "podman" ]
then
MESSAGE="Primary/Remote Container Type must either be 'docker' or 'podman'"
MESSAGE="${UI_CONFIG_REMOTEPRI} ${UI_CONFIG_INSTANCE_ERROR}"
echo_warn
exit_withchanges
exit_withchange
fi
MESSAGE="Saving Primary/Remote Container Type Setting to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_REMOTE} ${UI_CONFIG_CONTAINER_TYPE} to ${CONFIG_FILE}"
echo_stat
sed -i "/# RH_IN_TYPE=''/c\RH_IN_TYPE='${INPUT_RH_IN_TYPE}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
MESSAGE="Primary/Remote Container Name? (Leave blank for default 'pihole')"
MESSAGE="${UI_CONFIG_REMOTEPRI} ${UI_CONFIG_CONTAINER_NAME}"
echo_inf1
MESSAGE="${UI_CONFIG_DEFAULT_LEAVE} 'pihole'"
echo_need
read INPUT_ROCKER_CON
INPUT_ROCKER_CON="${INPUT_ROCKER_CON:-pihole}"
if [ "${INPUT_ROCKER_CON}" != "pihole" ]
then
MESSAGE="Saving Primary/Remote Container Name to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_REMOTE} ${UI_CONFIG_CONTAINER_NAME} to ${CONFIG_FILE}"
echo_stat
sed -i "/# ROCKER_CON=''/c\ROCKER_CON='${INPUT_ROCKER_CON}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
fi
MESSAGE="Primary/Remote Pi-hole 'etc' Volume Path? (Required, no trailing slash)"
MESSAGE="${UI_CONFIG_REMOTEPRI} ${UI_CORE_APP} ${UI_CONFIG_ETC_VOLPATH}"
echo_inf1
MESSAGE="${UI_CONFIG_ETC_VOLPATH_EXAMPLE}"
echo_need
read INPUT_RIHOLE_DIR
if [ "${INPUT_RIHOLE_DIR}" != "" ]
then
MESSAGE="Saving Primary/Remote Pi-hole Volume to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_REMOTE} ${UI_CORE_APP} ${UI_CONFIG_ETC_VOLPATH} to ${CONFIG_FILE}"
echo_stat
sed -i "/# RIHOLE_DIR=''/c\RIHOLE_DIR='${INPUT_RIHOLE_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
SKIP_RIHOLE_DIR="1"
else
MESSAGE="This setting is required!"
MESSAGE="${UI_CONFIG_SETTING_REQUIRED}"
echo_warn
exit_withchanges
exit_withchange
fi
MESSAGE="Primary/Remote DNSMASQ 'etc' Volume Path? (Required, no trailing slash)"
MESSAGE="${UI_CONFIG_REMOTEPRI} ${UI_CORE_APP_DNS} ${UI_CONFIG_ETC_VOLPATH}"
echo_inf1
MESSAGE="${UI_CONFIG_ETC_VOLDNSQ_EXAMPLE}"
echo_need
read INPUT_RNSMAQ_DIR
if [ "${INPUT_RNSMAQ_DIR}" != "" ]
then
MESSAGE="Saving Primary/Remote DNSMASQ Volume to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_REMOTE} ${UI_CORE_APP_DNS} ${UI_CONFIG_ETC_VOLPATH} to ${CONFIG_FILE}"
echo_stat
sed -i "/# RNSMAQ_DIR=''/c\RNSMAQ_DIR='${INPUT_RNSMAQ_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
SKIP_RNSMASQ_DIR="1"
else
MESSAGE="This setting is required!"
MESSAGE="${UI_CONFIG_SETTING_REQUIRED}"
echo_warn
exit_withchanges
exit_withchange
fi
MESSAGE="Saving Primary/Remote Volume Ownership to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_REMOTE} ${UI_CONFIG_VOLUME_OWNER} to ${CONFIG_FILE}"
echo_stat
sed -i "/# RILE_OWNER=''/c\RILE_OWNER='999:999'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
@ -286,14 +319,16 @@ function advanced_config_generate {
if [ "$SKIP_PIHOLE_DIR" != "1" ]
then
MESSAGE="Local/Secondary Pi-hole Settings Directory Path? (Leave blank for default '/etc/pihole')"
MESSAGE="${UI_CONFIG_LOCALSEC} ${UI_CORE_APP} ${UI_CONFIG_SETTING_DIR_PATH}"
echo_inf1
MESSAGE="${UI_CONFIG_DEFAULT_LEAVE} ${UI_CONFIG_DEFAULT_PIHOLE_ETC}"
echo_need
read INPUT_PIHOLE_DIR
INPUT_PIHOLE_DIR="${INPUT_PIHOLE_DIR:-/etc/pihole}"
if [ "${INPUT_PIHOLE_DIR}" != "/etc/pihole" ]
then
MESSAGE="Saving Local/Secondary Pi-hole Settings Directory Path to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_LOCAL} ${UI_CORE_APP} ${UI_CONFIG_SETTING_DIR_PATH} to ${CONFIG_FILE}"
echo_stat
sed -i "/# PIHOLE_DIR=''/c\PIHOLE_DIR='${INPUT_PIHOLE_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
@ -302,14 +337,16 @@ function advanced_config_generate {
if [ "$SKIP_RIHOLE_DIR" != "1" ]
then
MESSAGE="Primary/Remote Pi-hole Settings Directory Path? (Leave blank for default '/etc/pihole')"
MESSAGE="${UI_CONFIG_REMOTEPRI} ${UI_CORE_APP} ${UI_CONFIG_SETTING_DIR_PATH}"
echo_inf1
MESSAGE="${UI_CONFIG_DEFAULT_LEAVE} ${UI_CONFIG_DEFAULT_PIHOLE_ETC}"
echo_need
read INPUT_RIHOLE_DIR
INPUT_RIHOLE_DIR="${INPUT_RIHOLE_DIR:-/etc/pihole}"
if [ "${INPUT_RIHOLE_DIR}" != "/etc/pihole" ]
then
MESSAGE="Saving Primary/Remote Pi-hole Settings Directory Path to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_REMOTE} ${UI_CORE_APP} ${UI_CONFIG_SETTING_DIR_PATH} to ${CONFIG_FILE}"
echo_stat
sed -i "/# RIHOLE_DIR=''/c\RIHOLE_DIR='${INPUT_RIHOLE_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
@ -318,14 +355,16 @@ function advanced_config_generate {
if [ "$SKIP_DNSMASQ_DIR" != "1" ]
then
MESSAGE="Local/Secondary DNSMASQ Settings Directory Path? (Leave blank for default '/etc/dnsmasq.d')"
MESSAGE="${UI_CONFIG_LOCALSEC} ${UI_CORE_APP_DNS} ${UI_CONFIG_SETTING_DIR_PATH}"
echo_inf1
MESSAGE="${UI_CONFIG_DEFAULT_LEAVE} '/etc/dnsmasq.d'"
echo_need
read INPUT_DNSMASQ_DIR
INPUT_DNSMASQ_DIR="${INPUT_DNSMASQ_DIR:-/etc/dnsmasq.d}"
if [ "${INPUT_DNSMASQ_DIR}" != "/etc/dnsmasq.d" ]
then
MESSAGE="Saving Local/Secondary DNSMASQ Settings Directory Path to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_LOCAL} ${UI_CORE_APP_DNS} ${UI_CONFIG_SETTING_DIR_PATH} to ${CONFIG_FILE}"
echo_stat
sed -i "/# DNSMASQ_DIR=''/c\DNSMASQ_DIR='${INPUT_DNSMASQ_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
@ -334,69 +373,32 @@ function advanced_config_generate {
if [ "$SKIP_RNSMASQ_DIR" != "1" ]
then
MESSAGE="Primary/Remote DNSMASQ Settings Directory Path? (Leave blank for default '/etc/dnsmasq.d')"
MESSAGE="${UI_CONFIG_REMOTEPRI} ${UI_CORE_APP_DNS} ${UI_CONFIG_SETTING_DIR_PATH}"
echo_inf1
MESSAGE="${UI_CONFIG_DEFAULT_LEAVE} ${UI_CONFIG_DEFAULT_DNSMASQ_ETC}"
echo_need
read INPUT_RNSMASQ_DIR
INPUT_RNSMASQ_DIR="${INPUT_RNSMASQ_DIR:-/etc/dnsmasq.d}"
if [ "${INPUT_RNSMASQ_DIR}" != "/etc/dnsmasq.d" ]
then
MESSAGE="Saving Primary/Remote DNSMASQ Settings Directory Path to ${CONFIG_FILE}"
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_REMOTE} ${UI_CORE_APP_DNS} ${UI_CONFIG_SETTING_DIR_PATH} to ${CONFIG_FILE}"
echo_stat
sed -i "/# RNSMASQ_DIR=''/c\RNSMASQ_DIR='${INPUT_RNSMASQ_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
fi
fi
MESSAGE="Custom SSH Port to Connect to Primary/Remote host? (Leave blank for default '22')"
echo_need
read INPUT_SSH_PORT
INPUT_SSH_PORT="${INPUT_SSH_PORT:-22}"
SSH_PORT="${INPUT_SSH_PORT}"
if [ "${INPUT_SSH_PORT}" != "22" ]
then
MESSAGE="Saving Custom SSH Port to ${CONFIG_FILE}"
echo_stat
sed -i "/# SSH_PORT=''/c\SSH_PORT='${INPUT_SSH_PORT}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
fi
MESSAGE="Enable Ping/ICMP Check of Primary/Remote? (Y/N, default 'Y')"
echo_need
read INPUT_PING_AVOID
INPUT_PING_AVOID="${INPUT_PING_AVOID:-Y}"
if [ "${INPUT_PING_AVOID}" != "Y" ]
then
MESSAGE="Saving ICMP Avoidance to ${CONFIG_FILE}"
echo_stat
sed -i "/# PING_AVOID=''/c\PING_AVOID='1'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
PING_AVOID=1
fi
MESSAGE="Custom SSH PKIF Location? (Leave blank for default '.ssh/id_rsa')"
echo_need
read INPUT_CUSTOM_PKIF
INPUT_CUSTOM_PKIF="${INPUT_CUSTOM_PKIF:-.ssh/id_rsa}"
if [ "${INPUT_CUSTOM_PKIF}" != ".ssh/id_rsa" ]
then
MESSAGE="Saving Custom PKIF to ${CONFIG_FILE}"
echo_stat
sed -i "/# SSH_PKIF=''/c\SSH_PKIF='${INPUT_CUSTOM_PKIF}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
fi
MESSAGE="Enable Replicate 'Local DNS Records' Feature? (Y/N, default 'Y')"
MESSAGE="${UI_ENABLE_REPLICATION_QUEST} ${UI_CUSTOM_NAME}"
echo_inf1
MESSAGE="${UI_CONFIG_YESNOY}"
echo_need
read INPUT_SKIP_CUSTOM
INPUT_SKIP_CUSTOM="${INPUT_SKIP_CUSTOM:-Y}"
if [ "${INPUT_SKIP_CUSTOM}" != "Y" ]
then
MESSAGE="Saving Local DNS Preference to ${CONFIG_FILE}"
MESSAGE="${UI_DNS_NAME} ${UI_CONFIG_PREF_SAVED} ${CONFIG_FILE}"
echo_stat
sed -i "/# SKIP_CUSTOM=''/c\SKIP_CUSTOM='1'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
@ -404,38 +406,50 @@ function advanced_config_generate {
if [ "${INPUT_SKIP_CUSTOM}" == "Y" ]
then
MESSAGE="Enable Replicate 'Local CNAME Records' Feature? (Y/N, default 'Y')"
MESSAGE="${UI_ENABLE_REPLICATION_QUEST} ${UI_CNAME_NAME}"
echo_inf1
MESSAGE="${UI_CONFIG_YESNON}"
echo_need
read INPUT_INCLUDE_CNAME
INPUT_INCLUDE_CNAME="${INPUT_INCLUDE_CNAME:-Y}"
INPUT_INCLUDE_CNAME="${INPUT_INCLUDE_CNAME:-N}"
if [ "${INPUT_INCLUDE_CNAME}" == "Y" ]
then
MESSAGE="Saving Local CNAME Preference to ${CONFIG_FILE}"
echo_stat
sed -i "/# INCLUDE_CNAME=''/c\INCLUDE_CNAME='1'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
config_enablecname
fi
fi
end_config
}
function task_cname {
TASKTYPE='CNAME'
MESSAGE="${MESSAGE}: ${TASKTYPE}"
echo_good
config_enablecname
exit_withchange
}
function config_enablecname {
MESSAGE="${UI_CNAME_NAME} ${UI_CONFIG_PREF_SAVED} ${CONFIG_FILE}"
echo_stat
sed -i "/# INCLUDE_CNAME=''/c\INCLUDE_CNAME='1'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
}
## Delete Existing Configuration
function config_delete {
source ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
MESSAGE="Configuration File Exists"
echo_warn
echo_lines
cat ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
echo_blank
echo_lines
MESSAGE="Are you sure you want to erase this configuration?"
echo_warn
MESSAGE="${CONFIG_FILE} ${UI_CONFIG_ALREADY}"
echo_info
MESSAGE="${UI_CONFIG_AREYOUSURE}"
echo_inf1
intent_validate
MESSAGE="Erasing Existing Configuration"
MESSAGE="${UI_CONFIG_ERASING} ${CONFIG_FILE}"
echo_stat
rm -f ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
error_validate
@ -469,9 +483,12 @@ function podman_detect {
## Create Bash Alias
function create_alias {
MESSAGE="Creating Bash Alias"
MESSAGE="${UI_CONFIG_BASH}"
echo_stat
echo -e "alias gravity-sync='${GS_FILEPATH}'" | sudo tee -a /etc/bash.bashrc > /dev/null
error_validate
MESSAGE="${UI_CONFIG_ALIAS}"
echo_info
}

View File

@ -30,7 +30,7 @@ function intent_validate {
if [ "${INPUT_INTENT}" != "${INTENT}" ]
then
MESSAGE="${TASKTYPE} aborted"
MESSAGE="${TASKTYPE} excited"
echo_info
exit_nochange
fi

View File

@ -9,7 +9,6 @@ function task_logs {
TASKTYPE='LOGS'
MESSAGE="${MESSAGE}: ${TASKTYPE}"
echo_good
logs_gs
}
@ -48,10 +47,6 @@ function logs_gs {
tail -n 7 "${LOG_PATH}/${SYNCING_LOG}" | grep PULL
echo -e "${UI_LOGGING_RECENT_COMPLETE} ${YELLOW}PUSH${NC}"
tail -n 7 "${LOG_PATH}/${SYNCING_LOG}" | grep PUSH
echo -e "${UI_LOGGING_RECENT_COMPLETE} ${YELLOW}BACKUP${NC}"
tail -n 7 "${LOG_PATH}/${SYNCING_LOG}" | grep BACKUP
echo -e "${UI_LOGGING_RECENT_COMPLETE} ${YELLOW}RESTORE${NC}"
tail -n 7 "${LOG_PATH}/${SYNCING_LOG}" | grep RESTORE
echo_lines
exit_nochange

View File

@ -132,4 +132,4 @@ function pull_gs {
logs_export
exit_withchange
}
}

View File

@ -13,7 +13,6 @@ function task_purge {
echo_lines
echo -e "THIS WILL RESET YOUR ENTIRE GRAVITY SYNC INSTALLATION"
echo -e "This will remove:"
echo -e "- All backups files."
echo -e "- Your ${CONFIG_FILE} file."
if [ -f "${LOCAL_FOLDR}/dev" ]

View File

@ -48,13 +48,13 @@ function push_gs_grav {
MESSAGE="${UI_SET_FILE_OWNERSHIP} ${UI_GRAVITY_NAME}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="sudo chown ${RILE_OWNER} ${RIHOLE_DIR}/${GRAVITY_FI}"
create_sshcmd
MESSAGE="${UI_SET_FILE_PERMISSION} ${UI_GRAVITY_NAME}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="sudo chmod 664 ${RIHOLE_DIR}/${GRAVITY_FI}"
create_sshcmd
}
@ -84,13 +84,13 @@ function push_gs_cust {
MESSAGE="${UI_SET_FILE_OWNERSHIP} ${UI_CUSTOM_NAME}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="sudo chown root:root ${RIHOLE_DIR}/${CUSTOM_DNS}"
create_sshcmd
MESSAGE="${UI_SET_FILE_PERMISSIONS} ${UI_CUSTOM_NAME}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="sudo chmod 644 ${RIHOLE_DIR}/${CUSTOM_DNS}"
create_sshcmd
fi
@ -122,14 +122,14 @@ function push_gs_cname {
MESSAGE="${UI_SET_FILE_OWNERSHIP} ${UI_CNAME_NAME}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="sudo chown root:root ${RNSMAQ_DIR}/${CNAME_CONF}"
create_sshcmd
MESSAGE="${UI_SET_FILE_PERMISSIONS} ${UI_CNAME_NAME}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="sudo chmod 644 ${RNSMAQ_DIR}/${CNAME_CONF}"
create_sshcmd
fi
@ -144,13 +144,13 @@ function push_gs_reload {
MESSAGE="${UI_FTLDNS_CONFIG_PUSH_UPDATE}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="${RH_EXEC} restartdns reload-lists"
create_sshcmd
MESSAGE="${UI_FTLDNS_CONFIG_PUSH_RELOAD}"
echo_stat
CMD_TIMEOUT='15'
CMD_TIMEOUT=$BACKUP_TIMEOUT
CMD_REQUESTED="${RH_EXEC} restartdns"
create_sshcmd
}
@ -172,4 +172,4 @@ function push_gs {
logs_export
exit_withchange
}
}

View File

@ -1,238 +0,0 @@
# GRAVITY SYNC BY VMSTAN #####################
# gs-restore.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!
## Restore Task
function task_restore {
TASKTYPE='RESTORE'
MESSAGE="${MESSAGE}: ${TASKTYPE}"
echo_good
show_target
validate_gs_folders
validate_ph_folders
if [ "${INCLUDE_CNAME}" == "1" ]
then
validate_dns_folders
fi
validate_sqlite3
restore_gs
exit
}
## Restore Gravity
function restore_gs {
MESSAGE=""
echo_warn
GRAVITY_DATE_LIST=$(ls ${LOCAL_FOLDR}/${BACKUP_FOLD} | grep $(date +%Y) | grep ${GRAVITY_FI} | colrm 18)
if [ "${GRAVITY_DATE_LIST}" != "" ]
then
MESSAGE="${UI_RESTORE_WARNING}"
echo_info
echo_lines
ls ${LOCAL_FOLDR}/${BACKUP_FOLD} | grep $(date +%Y) | grep ${GRAVITY_FI} | colrm 18
echo -e "IGNORE-GRAVITY"
echo_lines
MESSAGE="${UI_RESTORE_SELECT_DATE} ${UI_GRAVITY_NAME}"
echo_need
read INPUT_BACKUP_DATE
if [ "$INPUT_BACKUP_DATE" == "IGNORE-GRAVITY" ]
then
MESSAGE="${UI_RESTORE_SKIPPING} ${UI_GRAVITY_NAME}"
echo_warn
elif [ -f ${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_BACKUP_DATE}-${GRAVITY_FI}.backup ]
then
MESSAGE="${UI_GRAVITY_NAME} ${UI_RESTORE_BACKUP_SELECTED}"
echo_good
DO_GRAVITY_RESTORE='1'
else
MESSAGE="${UI_RESTORE_INVALID}"
echo_info
exit_nochange
fi
fi
if [ "$SKIP_CUSTOM" != '1' ]
then
if [ -f ${PIHOLE_DIR}/${CUSTOM_DNS} ]
then
CUSTOM_DATE_LIST=$(ls ${LOCAL_FOLDR}/${BACKUP_FOLD} | grep $(date +%Y) | grep ${CUSTOM_DNS} | colrm 18)
if [ "${CUSTOM_DATE_LIST}" != "" ]
then
echo_lines
ls ${LOCAL_FOLDR}/${BACKUP_FOLD} | grep $(date +%Y) | grep ${CUSTOM_DNS} | colrm 18
echo -e "IGNORE-CUSTOM"
echo_lines
MESSAGE="${UI_RESTORE_SELECT_DATE} ${UI_CUSTOM_NAME}"
echo_need
read INPUT_DNSBACKUP_DATE
if [ "$INPUT_DNSBACKUP_DATE" == "IGNORE-CUSTOM" ]
then
MESSAGE="${UI_RESTORE_SKIPPING} ${UI_CUSTOM_NAME}"
echo_warn
elif [ -f ${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_DNSBACKUP_DATE}-${CUSTOM_DNS}.backup ]
then
MESSAGE="${UI_CUSTOM_NAME} ${UI_RESTORE_BACKUP_SELECTED}"
echo_good
DO_CUSTOM_RESTORE='1'
else
MESSAGE="${UI_RESTORE_INVALID}"
echo_fail
exit_nochange
fi
else
MESSAGE="${UI_CUSTOM_NAME} ${UI_RESTORE_BACKUP_UNAVAILABLE}"
echo_info
fi
fi
fi
if [ "$INCLUDE_CNAME" == '1' ]
then
if [ -f ${DNSMAQ_DIR}/${CNAME_CONF} ]
then
CNAME_DATE_LIST=$(ls ${LOCAL_FOLDR}/${BACKUP_FOLD} | grep $(date +%Y) | grep ${CNAME_CONF} | colrm 18)
if [ "${CNAME_DATE_LIST}" != "" ]
then
echo_lines
ls ${LOCAL_FOLDR}/${BACKUP_FOLD} | grep $(date +%Y) | grep ${CNAME_CONF} | colrm 18
echo -e "IGNORE-CNAME"
echo_lines
MESSAGE="${UI_RESTORE_SELECT_DATE} ${UI_CNAME_NAME}"
echo_need
read INPUT_CNAMEBACKUP_DATE
if [ "$INPUT_CNAMEBACKUP_DATE" == "IGNORE-CNAME" ]
then
MESSAGE="${UI_RESTORE_SKIPPING} ${UI_CNAME_NAME}"
echo_warn
elif [ -f ${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_CNAMEBACKUP_DATE}-${CNAME_CONF}.backup ]
then
MESSAGE="${UI_CNAME_NAME} ${UI_RESTORE_BACKUP_SELECTED}"
echo_good
DO_CNAME_RESTORE='1'
else
MESSAGE="${UI_RESTORE_INVALID}"
echo_fail
exit_nochange
fi
else
MESSAGE="${UI_CNAME_NAME} ${UI_RESTORE_BACKUP_UNAVAILABLE}"
echo_info
fi
fi
fi
if [ "$DO_GRAVITY_RESTORE" == "1" ]
then
MESSAGE="${UI_GRAVITY_NAME} ${UI_RESTORE_FROM} ${INPUT_BACKUP_DATE}"
echo_info
else
MESSAGE="${UI_GRAVITY_NAME} ${UI_RESTORE_BACKUP_UNAVAILABLE}"
echo_info
fi
if [ "$DO_CUSTOM_RESTORE" == "1" ]
then
MESSAGE="${UI_CUSTOM_NAME} ${UI_RESTORE_FROM} ${INPUT_DNSBACKUP_DATE}"
echo_info
else
MESSAGE="${UI_CUSTOM_NAME} ${UI_RESTORE_BACKUP_UNAVAILABLE}"
echo_info
fi
if [ "$DO_CNAME_RESTORE" == "1" ]
then
MESSAGE="${UI_CNAME_NAME} ${UI_RESTORE_FROM} ${INPUT_CNAMEBACKUP_DATE}"
echo_info
else
MESSAGE="${UI_CNAME_NAME} ${UI_RESTORE_BACKUP_UNAVAILABLE}"
echo_info
fi
intent_validate
MESSAGE="${UI_RESTORE_TIME_TRAVEL}"
echo_info
if [ "$DO_GRAVITY_RESTORE" == "1" ]
then
MESSAGE="${UI_RESTORE_SECONDARY} ${UI_GRAVITY_NAME}"
echo_stat
sudo cp ${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_BACKUP_DATE}-${GRAVITY_FI}.backup ${PIHOLE_DIR}/${GRAVITY_FI} >/dev/null 2>&1
error_validate
validate_gravity_permissions
fi
if [ "$DO_CUSTOM_RESTORE" == '1' ]
then
if [ -f ${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_DNSBACKUP_DATE}-${CUSTOM_DNS}.backup ]
then
MESSAGE="${UI_RESTORE_SECONDARY} ${UI_CUSTOM_NAME}"
echo_stat
sudo cp ${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_DNSBACKUP_DATE}-${CUSTOM_DNS}.backup ${PIHOLE_DIR}/${CUSTOM_DNS} >/dev/null 2>&1
error_validate
validate_custom_permissions
fi
fi
if [ "$DO_CNAME_RESTORE" == '1' ]
then
if [ -f ${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_CNAMEBACKUP_DATE}-${CNAME_CONF}.backup ]
then
MESSAGE="${UI_RESTORE_SECONDARY} ${UI_CNAME_NAME}"
echo_stat
sudo cp ${LOCAL_FOLDR}/${BACKUP_FOLD}/${INPUT_CNAMEBACKUP_DATE}-${CNAME_CONF}.backup ${DNSMAQ_DIR}/${CNAME_CONF} >/dev/null 2>&1
error_validate
validate_cname_permissions
fi
fi
pull_gs_reload
MESSAGE="${UI_RESTORE_PUSH_PROMPT}"
echo_need
read PUSH_TO_PRIMARY
if [ "${PUSH_TO_PRIMARY}" == "Yes" ] || [ "${PUSH_TO_PRIMARY}" == "yes" ] || [ "${PUSH_TO_PRIMARY}" == "Y" ] || [ "${PUSH_TO_PRIMARY}" == "y" ]
then
push_gs
elif [ "${PUSH_TO_PRIMARY}" == "No" ] || [ "${PUSH_TO_PRIMARY}" == "no" ] || [ "${PUSH_TO_PRIMARY}" == "N" ] || [ "${PUSH_TO_PRIMARY}" == "n" ]
then
MESSAGE="${UI_RESTORE_PUSH_NOPUSH}"
echo_info
logs_export
exit_withchange
else
MESSAGE="${UI_INVALID_SELECTION} - ${UI_RESTORE_PUSH_NOPUSH}"
echo_warn
logs_export
exit_withchange
fi
}

View File

@ -39,7 +39,7 @@ function generate_sshkey {
if [ -f $HOME/${SSH_PKIF} ]
then
MESSAGE="Using existing ~/${SSH_PKIF} file"
echo_info
echo_good_clean
else
if hash ssh-keygen >/dev/null 2>&1
then

View File

@ -22,12 +22,14 @@ UI_CORE_APP_DNS='DNSMASQ'
UI_CORE_APP_SQL='SQLITE3'
UI_CORE_OPENSSH='OpenSSH'
UI_CORE_RSYNC='RSYNC'
UI_CORE_DOCKER='Docker'
UI_CORE_PODMAN='Podman'
UI_CORE_UC_PRIMARY='Primary'
UI_CORE_UC_SECONDARY='Secondary'
# Exit
UI_EXIT_CALC_END='after'
UI_EXIT_ABORT='aborted'
UI_EXIT_ABORT='exited'
UI_EXIT_COMPLETE='completed'
UI_EXIT_CALC_TIMER='seconds'
@ -114,4 +116,49 @@ 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'
# Configuration
UI_CONFIG_YESNOY="'Yes' or 'No', blank is default 'Yes'"
UI_CONFIG_YESNON="'Yes' or 'No', blank is default 'No'"
UI_CONFIG_ALREADY='already exists'
UI_ENABLE_REPLICATION_QUEST='Enable replication of'
UI_CONFIG_PREF_SAVED='preference saved to'
UI_CONFIG_AREYOUSURE='Proceeding will wipe out your existing configuration'
UI_CONFIG_DOADVANCED='Do you want to enable advanced installation options'
UI_CONFIG_ERASING='Erasing existing'
UI_CONFIG_CREATING='Creating new'
UI_CONFIG_BASH='Creating gravity-sync alias in Bash config'
UI_CONFIG_ALIAS="You must reload your session for 'gravity-sync' alias to function"
UI_CONFIG_ICMP_TEST='Testing network connection to'
UI_CONFIG_REQUIRED='required settings'
UI_CONFIG_ADVANCED='advanced settings'
UI_CONFIG_REMOTE='remote host'
UI_CONFIG_LOCAL='local host'
UI_CONFIG_HOSTREQ='address required'
UI_CONFIG_USERREQ='SSH user required'
UI_CONFIG_CONT_LOOKUP='Looking for container engines'
UI_CONFIG_CONT_DETECT='Docker or Podman container engine'
UI_CONFIG_CONT_DETECTED='detected'
UI_CONFIG_CONT_DETECTNA='not detected'
UI_CONFIG_SSH_KEYPAIR='Key-pair registered to'
UI_CONFIG_LOCALSEC='Local/secondary'
UI_CONFIG_REMOTEPRI='Remote/primary'
UI_CONFIG_INSTANCEREQ='instance type required'
UI_CONFIG_INSTANCENAME='instance name required'
UI_CONFIG_INSTANCETYPE="'docker' or 'podman' container, or blank for default install"
UI_CONFIG_CONTAINER_TYPE='container type'
UI_CONFIG_CONTAINER_NAME='container name'
UI_CONFIG_INSTANCE_ERROR="${UI_CONFIG_CONTAINER_TYPE} must either be 'docker' or 'podman'"
UI_CONFIG_IMAGES='running instances'
UI_CONFIG_SAVING='Saving'
UI_CONFIG_PIHOLE_DEFAULT="Container name or blank for default 'pihole'"
UI_CONFIG_ETC_VOLPATH="'etc' volume path"
UI_CONFIG_ETC_VOLPATH_EXAMPLE="Example, '/opt/pihole/etc-pihole'"
UI_CONFIG_ETC_VOLDNSQ_EXAMPLE="Example, '/opt/pihole/etc-dnsmasq.d'"
UI_CONFIG_SETTING_REQUIRED='This setting is required!'
UI_CONFIG_SETTING_DIR_PATH='settings directory path'
UI_CONFIG_VOLUME_OWNER='volume ownership'
UI_CONFIG_DEFAULT_LEAVE="Leave blank for default"
UI_CONFIG_DEFAULT_DNSMASQ_ETC="'/etc/dnsmasq.d'"
UI_CONFIG_DEFAULT_PIHOLE_ETC="'/etc/pihole'"

View File

@ -43,24 +43,17 @@ function update_gs {
## Show Version
function show_version {
echo_lines
MESSAGE="${PURPLE}${PROGRAM}${NC} for Pi-hole"
echo_info
MESSAGE="${BLUE}https://github.com/vmstan/gravity-sync${NC}"
echo_info
if [ -f ${LOCAL_FOLDR}/dev ]
then
DEVVERSION="dev"
DEVVERSION="-dev"
elif [ -f ${LOCAL_FOLDR}/beta ]
then
DEVVERSION="beta"
DEVVERSION="-beta"
else
DEVVERSION=""
fi
MESSAGE="Running version: ${GREEN}${VERSION}${NC} ${DEVVERSION}"
MESSAGE="Running version: ${GREEN}${VERSION}${NC}${DEVVERSION}"
echo_info
GITVERSION=$(curl -sf https://raw.githubusercontent.com/vmstan/gravity-sync/master/VERSION)
@ -76,7 +69,6 @@ function show_version {
fi
fi
echo_info
echo_lines
}
function show_info() {
@ -187,16 +179,6 @@ function show_info() {
else
echo -e "Ping Test: Invalid Configuration"
fi
if [ ${BACKUP_RETAIN} == '7' ]
then
echo -e "Backup Retention: 7 days (default)"
elif [ ${BACKUP_RETAIN} == '1' ]
then
echo -e "Backup Retention: 1 day (custom)"
else
echo -e "Backup Retention: ${BACKUP_RETAIN} days (custom)"
fi
BACKUP_FOLDER_SIZE=$(du -h ${LOCAL_FOLDR}/${BACKUP_FOLD} | sed 's/\s.*$//')
echo -e "Backup Folder Size: ${BACKUP_FOLDER_SIZE}"
@ -270,7 +252,6 @@ function task_devmode {
fi
update_gs
exit_withchange
}
@ -279,11 +260,7 @@ function task_update {
TASKTYPE='UPDATE'
MESSAGE="${MESSAGE}: ${TASKTYPE}"
echo_good
dbclient_warning
update_gs
exit_withchange
}
@ -292,7 +269,6 @@ function task_version {
TASKTYPE='VERSION'
MESSAGE="${MESSAGE}: ${TASKTYPE}"
echo_good
show_version
exit_nochange
}
@ -303,8 +279,6 @@ function task_info() {
TASKTYPE='INFO'
MESSAGE="${MESSAGE}: ${TASKTYPE}"
echo_good
show_info
exit_nochange
}

View File

@ -261,5 +261,4 @@ function validate_cname_permissions() {
sudo chmod 644 ${DNSMAQ_DIR}/${CNAME_CONF} >/dev/null 2>&1
error_validate
fi
}
}