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
28
gravity-sync
28
gravity-sync
@ -4,7 +4,7 @@ GS_RUN_START=$SECONDS
|
|||||||
|
|
||||||
# GRAVITY SYNC BY VMSTAN #####################
|
# GRAVITY SYNC BY VMSTAN #####################
|
||||||
PROGRAM='Gravity Sync'
|
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
|
# 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
|
# Requires Pi-Hole 5.x or higher already be installed, for help visit https://pi-hole.net
|
||||||
@ -64,7 +64,7 @@ GS_CONFIG_FILE='gravity-sync.conf' # replace in gravity-sync.conf t
|
|||||||
GS_SYNCING_LOG='gs-sync.log' # 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_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_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_CNAME_CONF_MD5_LOG='05-pihole-custom-cname.conf.md5' # replace in gravity-sync.conf to overwrite
|
||||||
|
|
||||||
# SSH Customization
|
# SSH Customization
|
||||||
GS_SSH_PORT='22' # replace in gravity-sync.conf to overwrite
|
GS_SSH_PORT='22' # replace in gravity-sync.conf to overwrite
|
||||||
@ -1507,6 +1507,12 @@ function config_generate {
|
|||||||
echo_need
|
echo_need
|
||||||
read -r INPUT_REMOTE_HOST
|
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}"
|
MESSAGE="${UI_CONFIG_SAVING} ${INPUT_REMOTE_HOST} host to ${GS_CONFIG_FILE}"
|
||||||
echo_stat
|
echo_stat
|
||||||
sudo sed -i "/REMOTE_HOST=''/c\REMOTE_HOST='${INPUT_REMOTE_HOST}'" ${GS_ETC_PATH}/${GS_CONFIG_FILE}
|
sudo sed -i "/REMOTE_HOST=''/c\REMOTE_HOST='${INPUT_REMOTE_HOST}'" ${GS_ETC_PATH}/${GS_CONFIG_FILE}
|
||||||
@ -1519,6 +1525,12 @@ function config_generate {
|
|||||||
echo_need
|
echo_need
|
||||||
read -r INPUT_REMOTE_USER
|
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}"
|
MESSAGE="${UI_CONFIG_SAVING} ${INPUT_REMOTE_USER}@${INPUT_REMOTE_HOST} to ${GS_CONFIG_FILE}"
|
||||||
echo_stat
|
echo_stat
|
||||||
sudo sed -i "/REMOTE_USER=''/c\REMOTE_USER='${INPUT_REMOTE_USER}'" ${GS_ETC_PATH}/${GS_CONFIG_FILE}
|
sudo sed -i "/REMOTE_USER=''/c\REMOTE_USER='${INPUT_REMOTE_USER}'" ${GS_ETC_PATH}/${GS_CONFIG_FILE}
|
||||||
@ -1631,6 +1643,12 @@ function advanced_config_generate {
|
|||||||
echo_need
|
echo_need
|
||||||
read -r INPUT_LOCAL_DOCKER_CONTAINER
|
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}"
|
MESSAGE="${UI_CONFIG_SAVING} ${UI_CONFIG_LOCAL} ${UI_CONFIG_CONTAINER_NAME} to ${GS_CONFIG_FILE}"
|
||||||
echo_stat
|
echo_stat
|
||||||
sudo sed -i "/# LOCAL_DOCKER_CONTAINER=''/c\LOCAL_DOCKER_CONTAINER='${INPUT_LOCAL_DOCKER_CONTAINER}'" ${GS_ETC_PATH}/${GS_CONFIG_FILE}
|
sudo sed -i "/# LOCAL_DOCKER_CONTAINER=''/c\LOCAL_DOCKER_CONTAINER='${INPUT_LOCAL_DOCKER_CONTAINER}'" ${GS_ETC_PATH}/${GS_CONFIG_FILE}
|
||||||
@ -1699,6 +1717,12 @@ function advanced_config_generate {
|
|||||||
echo_need
|
echo_need
|
||||||
read -r INPUT_REMOTE_DOCKER_CONTAINER
|
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}"
|
MESSAGE="${UI_CONFIG_SAVING} remote host ${UI_CONFIG_CONTAINER_NAME} to ${GS_CONFIG_FILE}"
|
||||||
echo_stat
|
echo_stat
|
||||||
sudo sed -i "/# REMOTE_DOCKER_CONTAINER=''/c\REMOTE_DOCKER_CONTAINER='${INPUT_REMOTE_DOCKER_CONTAINER}'" ${GS_ETC_PATH}/${GS_CONFIG_FILE}
|
sudo sed -i "/# REMOTE_DOCKER_CONTAINER=''/c\REMOTE_DOCKER_CONTAINER='${INPUT_REMOTE_DOCKER_CONTAINER}'" ${GS_ETC_PATH}/${GS_CONFIG_FILE}
|
||||||
|
@ -12,7 +12,7 @@ LOCAL_FOLDR=$(dirname $GS_FILEPATH)
|
|||||||
GS_ETC_PATH="/etc/gravity-sync"
|
GS_ETC_PATH="/etc/gravity-sync"
|
||||||
GS_GRAVITY_FI_MD5_LOG='gs-gravity.md5'
|
GS_GRAVITY_FI_MD5_LOG='gs-gravity.md5'
|
||||||
GS_CUSTOM_DNS_MD5_LOG='gs-clist.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'
|
OS_DAEMON_PATH='/etc/systemd/system'
|
||||||
|
|
||||||
@ -167,19 +167,6 @@ function upgrade_to_4 {
|
|||||||
MESSAGE="Migrating Previous Configuration"
|
MESSAGE="Migrating Previous Configuration"
|
||||||
echo_info
|
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_HOST=''
|
||||||
REMOTE_USER=''
|
REMOTE_USER=''
|
||||||
|
|
||||||
@ -193,6 +180,7 @@ function upgrade_to_4 {
|
|||||||
ROCKER_CON=''
|
ROCKER_CON=''
|
||||||
|
|
||||||
SSH_PORT=''
|
SSH_PORT=''
|
||||||
|
SSH_PKIF=''
|
||||||
|
|
||||||
MESSAGE="Reviewing old configuration file settings"
|
MESSAGE="Reviewing old configuration file settings"
|
||||||
echo_stat
|
echo_stat
|
||||||
@ -213,6 +201,24 @@ function upgrade_to_4 {
|
|||||||
LOCAL_DOCKER_CONTAINER=${DOCKER_CON}
|
LOCAL_DOCKER_CONTAINER=${DOCKER_CON}
|
||||||
REMOTE_DOCKER_CONTAINER=${ROCKER_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"
|
MESSAGE="Migrating remote host settings"
|
||||||
echo_stat
|
echo_stat
|
||||||
sudo sed -i "/REMOTE_HOST=''/c\REMOTE_HOST='${REMOTE_HOST}'" /etc/gravity-sync/gravity-sync.conf
|
sudo sed -i "/REMOTE_HOST=''/c\REMOTE_HOST='${REMOTE_HOST}'" /etc/gravity-sync/gravity-sync.conf
|
||||||
|
Loading…
Reference in New Issue
Block a user