mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
4.0.3 (#341)
* fix hard coded pkif file on import * 4.0.3 proper * rename cname log * added messages for blank values during config
This commit is contained in:
parent
d3bc40e549
commit
53bc721c50
38
gravity-sync
38
gravity-sync
@ -4,7 +4,7 @@ GS_RUN_START=$SECONDS
|
||||
|
||||
# GRAVITY SYNC BY VMSTAN #####################
|
||||
PROGRAM='Gravity Sync'
|
||||
GS_VERSION='4.0.2'
|
||||
GS_VERSION='4.0.3'
|
||||
|
||||
# For documentation or the changelog/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
|
||||
@ -59,12 +59,12 @@ GS_BACKUP_EXT='gsb' # replace in gravity-sync.conf t
|
||||
|
||||
# GS Folder/File Locations
|
||||
GS_FILEPATH='/usr/local/bin/gravity-sync'
|
||||
GS_ETC_PATH="/etc/gravity-sync" # replace in gravity-sync.conf to overwrite
|
||||
GS_CONFIG_FILE='gravity-sync.conf' # replace in gravity-sync.conf to overwrite
|
||||
GS_SYNCING_LOG='gs-sync.log' # replace in gravity-sync.conf to overwrite
|
||||
GS_GRAVITY_FI_MD5_LOG='gs-gravity.md5' # replace in gravity-sync.conf to overwrite
|
||||
GS_CUSTOM_DNS_MD5_LOG='gs-clist.md5' # replace in gravity-sync.conf to overwrite
|
||||
GS_CNAME_CONF_MD5_LOG='gs-cname.md5' # replace in gravity-sync.conf to overwrite
|
||||
GS_ETC_PATH="/etc/gravity-sync" # replace in gravity-sync.conf to overwrite
|
||||
GS_CONFIG_FILE='gravity-sync.conf' # replace in gravity-sync.conf to overwrite
|
||||
GS_SYNCING_LOG='gs-sync.log' # replace in gravity-sync.conf to overwrite
|
||||
GS_GRAVITY_FI_MD5_LOG='gs-gravity.md5' # replace in gravity-sync.conf to overwrite
|
||||
GS_CUSTOM_DNS_MD5_LOG='gs-clist.md5' # replace in gravity-sync.conf to overwrite
|
||||
GS_CNAME_CONF_MD5_LOG='05-pihole-custom-cname.conf.md5' # replace in gravity-sync.conf to overwrite
|
||||
|
||||
# SSH Customization
|
||||
GS_SSH_PORT='22' # replace in gravity-sync.conf to overwrite
|
||||
@ -1507,6 +1507,12 @@ function config_generate {
|
||||
echo_need
|
||||
read -r INPUT_REMOTE_HOST
|
||||
|
||||
if [ "${INPUT_REMOTE_HOST}" == "" ]; then
|
||||
MESSAGE="Remote host cannot be blank!"
|
||||
echo_fail
|
||||
exit_no_change
|
||||
fi
|
||||
|
||||
MESSAGE="${UI_CONFIG_SAVING} ${INPUT_REMOTE_HOST} host to ${GS_CONFIG_FILE}"
|
||||
echo_stat
|
||||
sudo sed -i "/REMOTE_HOST=''/c\REMOTE_HOST='${INPUT_REMOTE_HOST}'" ${GS_ETC_PATH}/${GS_CONFIG_FILE}
|
||||
@ -1518,6 +1524,12 @@ function config_generate {
|
||||
MESSAGE="User"
|
||||
echo_need
|
||||
read -r INPUT_REMOTE_USER
|
||||
|
||||
if [ "${INPUT_REMOTE_USER}" == "" ]; then
|
||||
MESSAGE="User name cannot be blank!"
|
||||
echo_fail
|
||||
exit_no_change
|
||||
fi
|
||||
|
||||
MESSAGE="${UI_CONFIG_SAVING} ${INPUT_REMOTE_USER}@${INPUT_REMOTE_HOST} to ${GS_CONFIG_FILE}"
|
||||
echo_stat
|
||||
@ -1631,6 +1643,12 @@ function advanced_config_generate {
|
||||
echo_need
|
||||
read -r INPUT_LOCAL_DOCKER_CONTAINER
|
||||
|
||||
if [ "${INPUT_LOCAL_DOCKER_CONTAINER}" == "" ]; then
|
||||
MESSAGE="Container name cannot be blank!"
|
||||
echo_fail
|
||||
exit_no_change
|
||||
fi
|
||||
|
||||
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_LOCAL} ${UI_CONFIG_CONTAINER_NAME} to ${GS_CONFIG_FILE}"
|
||||
echo_stat
|
||||
sudo sed -i "/# LOCAL_DOCKER_CONTAINER=''/c\LOCAL_DOCKER_CONTAINER='${INPUT_LOCAL_DOCKER_CONTAINER}'" ${GS_ETC_PATH}/${GS_CONFIG_FILE}
|
||||
@ -1698,6 +1716,12 @@ function advanced_config_generate {
|
||||
MESSAGE="ex, 'pihole'"
|
||||
echo_need
|
||||
read -r INPUT_REMOTE_DOCKER_CONTAINER
|
||||
|
||||
if [ "${INPUT_REMOTE_DOCKER_CONTAINER}" == "" ]; then
|
||||
MESSAGE="Container name cannot be blank!"
|
||||
echo_fail
|
||||
exit_no_change
|
||||
fi
|
||||
|
||||
MESSAGE="${UI_CONFIG_SAVING} remote host ${UI_CONFIG_CONTAINER_NAME} to ${GS_CONFIG_FILE}"
|
||||
echo_stat
|
||||
|
@ -12,7 +12,7 @@ LOCAL_FOLDR=$(dirname $GS_FILEPATH)
|
||||
GS_ETC_PATH="/etc/gravity-sync"
|
||||
GS_GRAVITY_FI_MD5_LOG='gs-gravity.md5'
|
||||
GS_CUSTOM_DNS_MD5_LOG='gs-clist.md5'
|
||||
GS_CNAME_CONF_MD5_LOG='gs-cname.md5'
|
||||
GS_CNAME_CONF_MD5_LOG='05-pihole-custom-cname.conf.md5'
|
||||
|
||||
OS_DAEMON_PATH='/etc/systemd/system'
|
||||
|
||||
@ -166,19 +166,6 @@ function install_new_gravity {
|
||||
function upgrade_to_4 {
|
||||
MESSAGE="Migrating Previous Configuration"
|
||||
echo_info
|
||||
|
||||
CURRENTUSER=$(whoami)
|
||||
MESSAGE="Transferring SSH keys"
|
||||
echo_stat
|
||||
sudo cp $HOME/.ssh/id_rsa /etc/gravity-sync/gravity-sync.rsa
|
||||
sudo cp $HOME/.ssh/id_rsa.pub /etc/gravity-sync/gravity-sync.rsa.pub
|
||||
error_validate
|
||||
|
||||
MESSAGE="Setting SSH key owner"
|
||||
echo_stat
|
||||
sudo chown ${CURRENTUSER}:${CURRENTUSER} /etc/gravity-sync/gravity-sync.rsa
|
||||
sudo chown ${CURRENTUSER}:${CURRENTUSER} /etc/gravity-sync/gravity-sync.rsa.pub
|
||||
error_validate
|
||||
|
||||
REMOTE_HOST=''
|
||||
REMOTE_USER=''
|
||||
@ -193,6 +180,7 @@ function upgrade_to_4 {
|
||||
ROCKER_CON=''
|
||||
|
||||
SSH_PORT=''
|
||||
SSH_PKIF=''
|
||||
|
||||
MESSAGE="Reviewing old configuration file settings"
|
||||
echo_stat
|
||||
@ -213,6 +201,24 @@ function upgrade_to_4 {
|
||||
LOCAL_DOCKER_CONTAINER=${DOCKER_CON}
|
||||
REMOTE_DOCKER_CONTAINER=${ROCKER_CON}
|
||||
|
||||
CURRENTUSER=$(whoami)
|
||||
MESSAGE="Transferring SSH keys"
|
||||
echo_stat
|
||||
if [ "${SSH_PKIF}" == "" ]; then
|
||||
sudo cp $HOME/.ssh/id_rsa /etc/gravity-sync/gravity-sync.rsa
|
||||
sudo cp $HOME/.ssh/id_rsa.pub /etc/gravity-sync/gravity-sync.rsa.pub
|
||||
else
|
||||
sudo cp ${SSH_PKIF} /etc/gravity-sync/gravity-sync.rsa
|
||||
sudo cp ${SSH_PKIF}.pub /etc/gravity-sync/gravity-sync.rsa.pub
|
||||
fi
|
||||
error_validate
|
||||
|
||||
MESSAGE="Setting SSH key owner"
|
||||
echo_stat
|
||||
sudo chown ${CURRENTUSER}:${CURRENTUSER} /etc/gravity-sync/gravity-sync.rsa
|
||||
sudo chown ${CURRENTUSER}:${CURRENTUSER} /etc/gravity-sync/gravity-sync.rsa.pub
|
||||
error_validate
|
||||
|
||||
MESSAGE="Migrating remote host settings"
|
||||
echo_stat
|
||||
sudo sed -i "/REMOTE_HOST=''/c\REMOTE_HOST='${REMOTE_HOST}'" /etc/gravity-sync/gravity-sync.conf
|
||||
|
Loading…
Reference in New Issue
Block a user