mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
3.3.0 (#161)
* Catch up 3.3 (#142) * 3.2.5 (#140) Co-authored-by: Michael Stanclift <vmstan@mstanclift-a03.vmware.com> * Adds backup cleanup back to process * Add backup cleanup to compare script when no changes are detected. * Trek reference * Redundant * 3.2.6 * 3.2.6 Co-authored-by: Michael Stanclift <vmstan@mstanclift-a03.vmware.com> Co-authored-by: Michael Stanclift <vmstan@mstanclift-a03.local> * Beginning 3.3.0 work * Podman support * Support for pihole running in a podman container (#138) * add support for pihole running in a podman container * revert renaming of DOCKER_CON to CON_NAME to avoid breaking existing installations Co-authored-by: Michael Stanclift <mstanclift@vmware.com> * Add sudo to call of Pihole container version * Use dev branch pipe * Without origin * ascii * rotate logo * Move config files to settings folder * MIssed an important one * Relocate logs files * Filling empty directory * Regression of sudo fix * Logs * More words * Change sync frequency options * Remove backup automation * Bold questions * name * elif * BACKUP_RETAIN=3 * Remove automation flag * == not != * Rearrange * IF * Default to 0 * 15 default * More words! * ELSE * tighter columns * Instance type * Y/N Co-authored-by: Michael Stanclift <vmstan@mstanclift-a03.vmware.com> Co-authored-by: Michael Stanclift <vmstan@mstanclift-a03.local> Co-authored-by: Martin F. Schumann <mfs@mfs.name>
This commit is contained in:
parent
21893687e2
commit
97735f19f1
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,12 +1,13 @@
|
||||
gravity-sync.log
|
||||
gravity-sync.cron
|
||||
gravity.db.last
|
||||
gravity-sync.conf
|
||||
gravity-sync.md5
|
||||
backup/*.last
|
||||
backup/*.backup
|
||||
backup/*.push
|
||||
backup/*.pull
|
||||
logs/*
|
||||
settings/gravity-sync.conf
|
||||
dev
|
||||
.vscode
|
||||
.DS_Store
|
||||
|
20
CHANGELOG.md
20
CHANGELOG.md
@ -1,5 +1,25 @@
|
||||
# The Changelog
|
||||
|
||||
## 3.3
|
||||
|
||||
### The Podman Release
|
||||
|
||||
For this release, "beta" support for [Podman](https://podman.io) based container deployments has been added. (Thanks to work by [@mfschumann](https://github.com/vmstan/gravity-sync/pull/138)) This is marked as beta because at the moment, Gravity Sync may not be regularly tested with this container engine and so regular support may be limited. Use of the official Pi-hole container image is still required.
|
||||
|
||||
This release also removes automated nightly backups as a function of the automation script. You can still execute a manual `./gravity-sync.sh backup` anytime. Automating this function was made redundant by the primary synchronization functions backing up the database files prior to execution in later versions, resulting in multiple backups or backing up unchanged data. Existing users will continue to backup each night unless you run `./gravity-sync.sh automate` again to configure a new schedule, at which time the existing backup job will be deleted.
|
||||
|
||||
Additionally, this release focuses on making some of the prompts and messages in Gravity Sync easier to understand. Starting with the initial install and configuration wizard. As the script has grown, added features, and become more complex... more options are necessary during install and it wasn't always clear what to do. This release adds some clarification to various components and will change over time.
|
||||
|
||||
#### Configuration Changes
|
||||
|
||||
- The first time you execute Gravity Sync after upgrading to 3.3, your `gravity-sync.conf` file will be moved into a `settings` folder in the same directory.
|
||||
- The first time you execute Gravity Sync after upgrading to 3.3, your existing `gravity-sync.md5`, `gravity-sync.log`, and `gravity-sync.cron` files will be moved into a `logs` folder in the same directory.
|
||||
- The default number days for which backups are retained has been reduced from 7 to 3.
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- Docker Swarm use for the Pi-hole container should be supported by a change in the execution command.
|
||||
|
||||
## 3.2
|
||||
|
||||
### The Alias Release
|
||||
|
@ -3,7 +3,8 @@ SCRIPT_START=$SECONDS
|
||||
|
||||
# GRAVITY SYNC BY VMSTAN #####################
|
||||
PROGRAM='Gravity Sync'
|
||||
VERSION='3.2.6'
|
||||
VERSION='3.3.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
|
||||
@ -17,8 +18,8 @@ VERSION='3.2.6'
|
||||
# STANDARD VARIABLES #########################
|
||||
|
||||
# Installation Types
|
||||
PH_IN_TYPE='default' # Pi-hole install type, `default` or `docker` (local)
|
||||
RH_IN_TYPE='default' # Pi-hole install type, `default` or `docker` (remote)
|
||||
PH_IN_TYPE='default' # Pi-hole install type, `default`, `docker`, or `podman` (local)
|
||||
RH_IN_TYPE='default' # Pi-hole install type, `default`, `docker`, or `podman` (remote)
|
||||
|
||||
# Pi-hole Folder/File Customization
|
||||
PIHOLE_DIR='/etc/pihole' # default Pi-hole data directory (local)
|
||||
@ -29,10 +30,12 @@ PIHOLE_BIN='/usr/local/bin/pihole' # default Pi-hole binary directory (local)
|
||||
RIHOLE_BIN='/usr/local/bin/pihole' # default Pi-hole binary directory (remote)
|
||||
DOCKER_BIN='/usr/bin/docker' # default Docker binary directory (local)
|
||||
ROCKER_BIN='/usr/bin/docker' # default Docker binary directory (remote)
|
||||
PODMAN_BIN='/usr/bin/podman' # default Podman binary directory (local)
|
||||
RODMAN_BIN='/usr/bin/podman' # default Podman binary directory (remote)
|
||||
FILE_OWNER='pihole:pihole' # default Pi-hole file owner and group (local)
|
||||
RILE_OWNER='pihole:pihole' # default Pi-hole file owner and group (remote)
|
||||
DOCKER_CON='pihole' # default Pi-hole Docker container name (local)
|
||||
ROCKER_CON='pihole' # default Pi-hole Docker container name (remote)
|
||||
DOCKER_CON='pihole' # default Pi-hole container name (local)
|
||||
ROCKER_CON='pihole' # default Pi-hole container name (remote)
|
||||
|
||||
GRAVITY_FI='gravity.db' # default Pi-hole database file
|
||||
CUSTOM_DNS='custom.list' # default Pi-hole local DNS lookups
|
||||
@ -48,7 +51,7 @@ PING_AVOID='0' # replace in gravity-sync.conf to overwrite
|
||||
ROOT_CHECK_AVOID='0' # replace in gravity-sync.conf to overwrite
|
||||
|
||||
# Backup Customization
|
||||
BACKUP_RETAIN='7' # replace in gravity-sync.conf to overwrite
|
||||
BACKUP_RETAIN='3' # replace in gravity-sync.conf to overwrite
|
||||
|
||||
# SSH Customization
|
||||
SSH_PORT='22' # default SSH port
|
||||
@ -60,7 +63,7 @@ LOCAL_FOLDR=$(dirname $GS_FILEPATH) # auto determined - do not change!
|
||||
CONFIG_FILE='gravity-sync.conf' # must exist with primary host/user configured
|
||||
GS_FILENAME='gravity-sync.sh' # must exist because it's this script
|
||||
BACKUP_FOLD='backup' # must exist as subdirectory in LOCAL_FOLDR
|
||||
LOG_PATH="${LOCAL_FOLDR}" # replace in gravity-sync.conf to overwrite
|
||||
LOG_PATH="${LOCAL_FOLDR}/logs" # replace in gravity-sync.conf to overwrite
|
||||
SYNCING_LOG='gravity-sync.log' # replace in gravity-sync.conf to overwrite
|
||||
CRONJOB_LOG='gravity-sync.cron' # replace in gravity-sync.conf to overwrite
|
||||
HISTORY_MD5='gravity-sync.md5' # replace in gravity-sync.conf to overwrite
|
||||
@ -183,7 +186,7 @@ case $# in
|
||||
case $1 in
|
||||
auto|automate)
|
||||
start_gs
|
||||
task_automate $2 $3 ;;
|
||||
task_automate $2 ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
|
@ -19,75 +19,76 @@ function task_automate {
|
||||
CRON_EXIST='1'
|
||||
fi
|
||||
|
||||
MESSAGE="Configuring Hourly Smart Sync"
|
||||
MESSAGE="Configuring Automated Synchronization"
|
||||
echo_info
|
||||
|
||||
if [[ $1 =~ ^[0-9][0-9]?$ ]]
|
||||
then
|
||||
INPUT_AUTO_FREQ=$1
|
||||
else
|
||||
MESSAGE="Sync Frequency in Minutes (1-30) or 0 to Disable"
|
||||
MESSAGE="Synchronization Frequency in Minutes (5, 10, 15, 30) or 0 to Disable (default 15)"
|
||||
echo_need
|
||||
read INPUT_AUTO_FREQ
|
||||
INPUT_AUTO_FREQ="${INPUT_AUTO_FREQ:-15}"
|
||||
fi
|
||||
|
||||
if [ $INPUT_AUTO_FREQ -gt 30 ]
|
||||
if [ $INPUT_AUTO_FREQ == 5 ] || [ $INPUT_AUTO_FREQ == 10 ] || [ $INPUT_AUTO_FREQ == 15 ] || [ $INPUT_AUTO_FREQ == 30 ]
|
||||
then
|
||||
MESSAGE="Invalid Frequency Range"
|
||||
echo_fail
|
||||
exit_nochange
|
||||
elif [ $INPUT_AUTO_FREQ -lt 1 ]
|
||||
then
|
||||
if [ $CRON_EXIST == 1 ]
|
||||
then
|
||||
clear_cron
|
||||
|
||||
MESSAGE="Sync Automation Disabled"
|
||||
echo_warn
|
||||
else
|
||||
MESSAGE="No Sync Automation Scheduled"
|
||||
echo_warn
|
||||
fi
|
||||
else
|
||||
if [ $CRON_EXIST == 1 ]
|
||||
then
|
||||
clear_cron
|
||||
fi
|
||||
|
||||
MESSAGE="Saving New Sync Automation"
|
||||
MESSAGE="Saving New Synchronization Automation"
|
||||
echo_stat
|
||||
(crontab -l 2>/dev/null; echo "*/${INPUT_AUTO_FREQ} * * * * ${BASH_PATH} ${LOCAL_FOLDR}/${GS_FILENAME} smart > ${LOG_PATH}/${CRONJOB_LOG}") | crontab -
|
||||
error_validate
|
||||
fi
|
||||
|
||||
MESSAGE="Configuring Daily Backup Frequency"
|
||||
echo_info
|
||||
|
||||
if [[ $2 =~ ^[0-9][0-9]?$ ]]
|
||||
elif [ $INPUT_AUTO_FREQ == 0 ]
|
||||
then
|
||||
INPUT_AUTO_BACKUP=$2
|
||||
if [ $CRON_EXIST == 1 ]
|
||||
then
|
||||
clear_cron
|
||||
|
||||
MESSAGE="Synchronization Automation Disabled"
|
||||
echo_warn
|
||||
else
|
||||
MESSAGE="No Synchronization Automation Scheduled"
|
||||
echo_warn
|
||||
fi
|
||||
else
|
||||
MESSAGE="Hour of Day to Backup (1-24) or 0 to Disable"
|
||||
echo_need
|
||||
read INPUT_AUTO_BACKUP
|
||||
fi
|
||||
|
||||
if [ $INPUT_AUTO_BACKUP -gt 24 ]
|
||||
then
|
||||
MESSAGE="Invalid Frequency Range"
|
||||
echo_fail
|
||||
exit_nochange
|
||||
elif [ $INPUT_AUTO_BACKUP -lt 1 ]
|
||||
then
|
||||
MESSAGE="No Backup Automation Scheduled"
|
||||
echo_warn
|
||||
else
|
||||
MESSAGE="Saving New Backup Automation"
|
||||
echo_stat
|
||||
(crontab -l 2>/dev/null; echo "0 ${INPUT_AUTO_BACKUP} * * * ${BASH_PATH} ${LOCAL_FOLDR}/${GS_FILENAME} backup >/dev/null 2>&1") | crontab -
|
||||
error_validate
|
||||
fi
|
||||
|
||||
# MESSAGE="Configuring Daily Backup Frequency"
|
||||
# echo_info
|
||||
|
||||
# if [[ $2 =~ ^[0-9][0-9]?$ ]]
|
||||
# then
|
||||
# INPUT_AUTO_BACKUP=$2
|
||||
# else
|
||||
# MESSAGE="Hour of Day to Backup (1-24) or 0 to Disable"
|
||||
# echo_need
|
||||
# read INPUT_AUTO_BACKUP
|
||||
# fi
|
||||
|
||||
# if [ $INPUT_AUTO_BACKUP -gt 24 ]
|
||||
# then
|
||||
# MESSAGE="Invalid Frequency Range"
|
||||
# echo_fail
|
||||
# exit_nochange
|
||||
# elif [ $INPUT_AUTO_BACKUP -lt 1 ]
|
||||
# then
|
||||
# MESSAGE="No Backup Automation Scheduled"
|
||||
# echo_warn
|
||||
# else
|
||||
# MESSAGE="Saving New Backup Automation"
|
||||
# echo_stat
|
||||
# (crontab -l 2>/dev/null; echo "0 ${INPUT_AUTO_BACKUP} * * * ${BASH_PATH} ${LOCAL_FOLDR}/${GS_FILENAME} backup >/dev/null 2>&1") | crontab -
|
||||
# error_validate
|
||||
# fi
|
||||
|
||||
exit_withchange
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ function echo_fail {
|
||||
|
||||
### Request
|
||||
function echo_need {
|
||||
echo -en "${NEED} ${MESSAGE}: "
|
||||
echo -en "${NEED} ${BOLD}${MESSAGE}:${NC} "
|
||||
}
|
||||
|
||||
### Gravity Sync Logo
|
||||
|
@ -10,7 +10,9 @@ function task_configure {
|
||||
MESSAGE="${MESSAGE}: ${TASKTYPE} Requested"
|
||||
echo_good
|
||||
|
||||
if [ -f ${LOCAL_FOLDR}/${CONFIG_FILE} ]
|
||||
relocate_config_gs
|
||||
|
||||
if [ -f ${LOCAL_FOLDR}/settings/${CONFIG_FILE} ]
|
||||
then
|
||||
config_delete
|
||||
else
|
||||
@ -33,34 +35,64 @@ function config_generate {
|
||||
|
||||
MESSAGE="Creating New ${CONFIG_FILE} from Template"
|
||||
echo_stat
|
||||
cp ${LOCAL_FOLDR}/${CONFIG_FILE}.example ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
cp ${LOCAL_FOLDR}/settings/${CONFIG_FILE}.example ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
|
||||
echo_lines
|
||||
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_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 the SECONDARY Pi-hole! The REMOTE Pi-hole where you will normally make configuration"
|
||||
echo -e "changes is considered the PRIMARY Pi-hole."
|
||||
echo_blank
|
||||
echo -e "Confused? Refer back to the documentation."
|
||||
echo_lines
|
||||
|
||||
docker_detect
|
||||
if [ "${DOCKERREADY}" == "1" ]
|
||||
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? (Leave blank for default 'No')"
|
||||
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}" != "N" ]
|
||||
if [ "${INPUT_ADVANCED_INSTALL}" == "N" ]
|
||||
then
|
||||
MESSAGE="Advanced Configuration Selected"
|
||||
echo_info
|
||||
|
||||
advanced_config_generate
|
||||
elif [ "${INPUT_ADVANCED_INSTALL}" == "Y" ]
|
||||
then
|
||||
MESSAGE="Standard Configuration Selected"
|
||||
echo_info
|
||||
else
|
||||
MESSAGE="Invalid Selection"
|
||||
echo_warn
|
||||
|
||||
exit_nochange
|
||||
fi
|
||||
fi
|
||||
|
||||
MESSAGE="Standard Settings"
|
||||
MESSAGE="Required Gravity Sync Settings"
|
||||
echo_info
|
||||
|
||||
MESSAGE="Primary Pi-hole Address (IP or DNS)"
|
||||
MESSAGE="Primary/Remote Pi-hole Address (IP or DNS)"
|
||||
echo_need
|
||||
read INPUT_REMOTE_HOST
|
||||
|
||||
@ -75,25 +107,25 @@ function config_generate {
|
||||
echo_warn
|
||||
fi
|
||||
|
||||
MESSAGE="SSH User for ${INPUT_REMOTE_HOST}"
|
||||
MESSAGE="Saving Primary/Remote 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}"
|
||||
echo_need
|
||||
read INPUT_REMOTE_USER
|
||||
|
||||
MESSAGE="Saving Host to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving User "${INPUT_REMOTE_USER}" to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/REMOTE_HOST='192.168.1.10'/c\REMOTE_HOST='${INPUT_REMOTE_HOST}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
error_validate
|
||||
|
||||
MESSAGE="Saving User to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/REMOTE_USER='pi'/c\REMOTE_USER='${INPUT_REMOTE_USER}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
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}"
|
||||
echo_stat
|
||||
source ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
source ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
|
||||
export_sshkey
|
||||
@ -109,40 +141,61 @@ function config_generate {
|
||||
|
||||
## Advanced Configuration Options
|
||||
function advanced_config_generate {
|
||||
MESSAGE="Local Pi-hole in Docker Container? (Leave blank for default 'No')"
|
||||
MESSAGE="Local/Secondary Pi-hole Instance Type? (Allowed: 'docker' or 'podman' or 'default')"
|
||||
echo_need
|
||||
read INPUT_PH_IN_TYPE
|
||||
INPUT_PH_IN_TYPE="${INPUT_PH_IN_TYPE:-N}"
|
||||
INPUT_PH_IN_TYPE="${INPUT_PH_IN_TYPE:-default}"
|
||||
|
||||
if [ "${INPUT_PH_IN_TYPE}" != "N" ]
|
||||
if [ "${INPUT_PH_IN_TYPE}" != "default" ]
|
||||
then
|
||||
MESSAGE="Saving Local Docker Setting to ${CONFIG_FILE}"
|
||||
if [ "${INPUT_PH_IN_TYPE}" != "docker" ] && [ "${INPUT_PH_IN_TYPE}" != "podman" ]
|
||||
then
|
||||
MESSAGE="Local/Secondary Container Type must either be 'docker' or 'podman'"
|
||||
echo_warn
|
||||
exit_withchanges
|
||||
fi
|
||||
|
||||
MESSAGE="Saving Local/Secondary Container Type Setting to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# PH_IN_TYPE=''/c\PH_IN_TYPE='docker'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# PH_IN_TYPE=''/c\PH_IN_TYPE='${INPUT_PH_IN_TYPE}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
|
||||
MESSAGE="Local Docker Container Name? (Leave blank for default 'pihole')"
|
||||
|
||||
MESSAGE="Displaying Currently Running Container Images"
|
||||
echo_info
|
||||
|
||||
echo_lines
|
||||
if [ "${INPUT_PH_IN_TYPE}" == "docker" ]
|
||||
then
|
||||
sudo docker container ls
|
||||
elif [ "${INPUT_PH_IN_TYPE}" == "podman" ]
|
||||
then
|
||||
sudo podman container ls
|
||||
fi
|
||||
echo_lines
|
||||
|
||||
MESSAGE="Local/Secondary Container Name? (Leave blank for default 'pihole')"
|
||||
echo_need
|
||||
read INPUT_DOCKER_CON
|
||||
INPUT_DOCKER_CON="${INPUT_DOCKER_CON:-pihole}"
|
||||
|
||||
if [ "${INPUT_DOCKER_CON}" != "pihole" ]
|
||||
then
|
||||
MESSAGE="Saving Local Container Name to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Local/Secondary Container Name to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# DOCKER_CON=''/c\DOCKER_CON='${INPUT_DOCKER_CON}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# DOCKER_CON=''/c\DOCKER_CON='${INPUT_DOCKER_CON}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
|
||||
MESSAGE="Local Pi-hole 'etc' Volume Path? (Required, no trailing slash)"
|
||||
MESSAGE="Local/Secondary Pi-hole 'etc' Volume Path? (Required, no trailing slash)"
|
||||
echo_need
|
||||
read INPUT_PIHOLE_DIR
|
||||
|
||||
if [ "${INPUT_PIHOLE_DIR}" != "" ]
|
||||
then
|
||||
MESSAGE="Saving Local Pi-hole Volume to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Local/Secondary Pi-hole Volume to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# PIHOLE_DIR=''/c\PIHOLE_DIR='${INPUT_PIHOLE_DIR}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# PIHOLE_DIR=''/c\PIHOLE_DIR='${INPUT_PIHOLE_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
SKIP_PIHOLE_DIR="1"
|
||||
else
|
||||
@ -151,15 +204,15 @@ function advanced_config_generate {
|
||||
exit_withchanges
|
||||
fi
|
||||
|
||||
MESSAGE="Local DNSMASQ 'etc' Volume Path? (Required, no trailing slash)"
|
||||
MESSAGE="Local/Secondary DNSMASQ 'etc' Volume Path? (Required, no trailing slash)"
|
||||
echo_need
|
||||
read INPUT_DNSMAQ_DIR
|
||||
|
||||
if [ "${INPUT_DNSMAQ_DIR}" != "" ]
|
||||
then
|
||||
MESSAGE="Saving Local DNSMASQ Volume to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Local/Secondary DNSMASQ Volume to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# DNSMAQ_DIR=''/c\DNSMAQ_DIR='${INPUT_DNSMAQ_DIR}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# DNSMAQ_DIR=''/c\DNSMAQ_DIR='${INPUT_DNSMAQ_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
SKIP_DNSMASQ_DIR="1"
|
||||
else
|
||||
@ -168,46 +221,52 @@ function advanced_config_generate {
|
||||
exit_withchanges
|
||||
fi
|
||||
|
||||
MESSAGE="Saving Local Volume Ownership to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Local/Secondary Volume Ownership to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# FILE_OWNER=''/c\FILE_OWNER='999:999'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# FILE_OWNER=''/c\FILE_OWNER='999:999'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
|
||||
MESSAGE="Remote Pi-hole in Docker Container? (Leave blank for default 'No')"
|
||||
MESSAGE="Primary/Remote Pi-hole Instance Type? (Allowed: 'docker' or 'podman' or 'default')"
|
||||
echo_need
|
||||
read INPUT_RH_IN_TYPE
|
||||
INPUT_RH_IN_TYPE="${INPUT_RH_IN_TYPE:-N}"
|
||||
INPUT_RH_IN_TYPE="${INPUT_RH_IN_TYPE:-default}"
|
||||
|
||||
if [ "${INPUT_RH_IN_TYPE}" != "N" ]
|
||||
if [ "${INPUT_RH_IN_TYPE}" != "default" ]
|
||||
then
|
||||
MESSAGE="Saving Remote Docker Setting to ${CONFIG_FILE}"
|
||||
if [ "${INPUT_RH_IN_TYPE}" != "docker" ] && [ "${INPUT_RH_IN_TYPE}" != "podman" ]
|
||||
then
|
||||
MESSAGE="Primary/Remote Container Type must either be 'docker' or 'podman'"
|
||||
echo_warn
|
||||
exit_withchanges
|
||||
fi
|
||||
MESSAGE="Saving Primary/Remote Container Type Setting to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# RH_IN_TYPE=''/c\RH_IN_TYPE='docker'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# RH_IN_TYPE=''/c\RH_IN_TYPE='${INPUT_RH_IN_TYPE}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
|
||||
MESSAGE="Remote Docker Container Name? (Leave blank for default 'pihole')"
|
||||
MESSAGE="Primary/Remote Container Name? (Leave blank for default 'pihole')"
|
||||
echo_need
|
||||
read INPUT_ROCKER_CON
|
||||
INPUT_ROCKER_CON="${INPUT_ROCKER_CON:-pihole}"
|
||||
|
||||
if [ "${INPUT_ROCKER_CON}" != "pihole" ]
|
||||
then
|
||||
MESSAGE="Saving Remote Container Name to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Primary/Remote Container Name to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# ROCKER_CON=''/c\ROCKER_CON='${INPUT_ROCKER_CON}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# ROCKER_CON=''/c\ROCKER_CON='${INPUT_ROCKER_CON}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
|
||||
MESSAGE="Remote Pi-hole 'etc' Volume Path? (Required, no trailing slash)"
|
||||
MESSAGE="Primary/Remote Pi-hole 'etc' Volume Path? (Required, no trailing slash)"
|
||||
echo_need
|
||||
read INPUT_RIHOLE_DIR
|
||||
|
||||
if [ "${INPUT_RIHOLE_DIR}" != "" ]
|
||||
then
|
||||
MESSAGE="Saving Remote Pi-hole Volume to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Primary/Remote Pi-hole Volume to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# RIHOLE_DIR=''/c\RIHOLE_DIR='${INPUT_RIHOLE_DIR}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# RIHOLE_DIR=''/c\RIHOLE_DIR='${INPUT_RIHOLE_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
SKIP_RIHOLE_DIR="1"
|
||||
else
|
||||
@ -216,15 +275,15 @@ function advanced_config_generate {
|
||||
exit_withchanges
|
||||
fi
|
||||
|
||||
MESSAGE="Remote DNSMASQ 'etc' Volume Path? (Required, no trailing slash)"
|
||||
MESSAGE="Primary/Remote DNSMASQ 'etc' Volume Path? (Required, no trailing slash)"
|
||||
echo_need
|
||||
read INPUT_RNSMAQ_DIR
|
||||
|
||||
if [ "${INPUT_RNSMAQ_DIR}" != "" ]
|
||||
then
|
||||
MESSAGE="Saving Remote DNSMASQ Volume to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Primary/Remote DNSMASQ Volume to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# RNSMAQ_DIR=''/c\RNSMAQ_DIR='${INPUT_RNSMAQ_DIR}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# RNSMAQ_DIR=''/c\RNSMAQ_DIR='${INPUT_RNSMAQ_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
SKIP_RNSMASQ_DIR="1"
|
||||
else
|
||||
@ -233,78 +292,78 @@ function advanced_config_generate {
|
||||
exit_withchanges
|
||||
fi
|
||||
|
||||
MESSAGE="Saving Remote Volume Ownership to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Primary/Remote Volume Ownership to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# RILE_OWNER=''/c\RILE_OWNER='999:999'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# RILE_OWNER=''/c\RILE_OWNER='999:999'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
|
||||
|
||||
if [ "$SKIP_PIHOLE_DIR" != "1" ]
|
||||
then
|
||||
MESSAGE="Local Pi-hole Settings Directory Path? (Leave blank for default '/etc/pihole')"
|
||||
MESSAGE="Local/Secondary Pi-hole Settings Directory Path? (Leave blank for default '/etc/pihole')"
|
||||
echo_need
|
||||
read INPUT_PIHOLE_DIR
|
||||
INPUT_PIHOLE_DIR="${INPUT_PIHOLE_DIR:-/etc/pihole}"
|
||||
|
||||
if [ "${INPUT_PIHOLE_DIR}" != "/etc/pihole" ]
|
||||
then
|
||||
MESSAGE="Saving Local Pi-hole Settings Directory Path to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Local/Secondary Pi-hole Settings Directory Path to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# PIHOLE_DIR=''/c\PIHOLE_DIR='${INPUT_PIHOLE_DIR}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# PIHOLE_DIR=''/c\PIHOLE_DIR='${INPUT_PIHOLE_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$SKIP_RIHOLE_DIR" != "1" ]
|
||||
then
|
||||
MESSAGE="Remote Pi-hole Settings Directory Path? (Leave blank for default '/etc/pihole')"
|
||||
MESSAGE="Primary/Remote Pi-hole Settings Directory Path? (Leave blank for default '/etc/pihole')"
|
||||
echo_need
|
||||
read INPUT_RIHOLE_DIR
|
||||
INPUT_RIHOLE_DIR="${INPUT_RIHOLE_DIR:-/etc/pihole}"
|
||||
|
||||
if [ "${INPUT_RIHOLE_DIR}" != "/etc/pihole" ]
|
||||
then
|
||||
MESSAGE="Saving Remote Pi-hole Settings Directory Path to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Primary/Remote Pi-hole Settings Directory Path to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# RIHOLE_DIR=''/c\RIHOLE_DIR='${INPUT_RIHOLE_DIR}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# RIHOLE_DIR=''/c\RIHOLE_DIR='${INPUT_RIHOLE_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$SKIP_DNSMASQ_DIR" != "1" ]
|
||||
then
|
||||
MESSAGE="Local DNSMASQ Settings Directory Path? (Leave blank for default '/etc/dnsmasq.d')"
|
||||
MESSAGE="Local/Secondary DNSMASQ Settings Directory Path? (Leave blank for default '/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 DNSMASQ Settings Directory Path to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Local/Secondary DNSMASQ Settings Directory Path to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# DNSMASQ_DIR=''/c\DNSMASQ_DIR='${INPUT_DNSMASQ_DIR}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# DNSMASQ_DIR=''/c\DNSMASQ_DIR='${INPUT_DNSMASQ_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$SKIP_RNSMASQ_DIR" != "1" ]
|
||||
then
|
||||
MESSAGE="Remote DNSMASQ Settings Directory Path? (Leave blank for default '/etc/dnsmasq.d')"
|
||||
MESSAGE="Primary/Remote DNSMASQ Settings Directory Path? (Leave blank for default '/etc/dnsmasq.d')"
|
||||
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 Remote DNSMASQ Settings Directory Path to ${CONFIG_FILE}"
|
||||
MESSAGE="Saving Primary/Remote DNSMASQ Settings Directory Path to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# RNSMASQ_DIR=''/c\RNSMASQ_DIR='${INPUT_RNSMASQ_DIR}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# RNSMASQ_DIR=''/c\RNSMASQ_DIR='${INPUT_RNSMASQ_DIR}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
fi
|
||||
|
||||
MESSAGE="Use Custom SSH Port? (Leave blank for default '22')"
|
||||
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}"
|
||||
@ -314,11 +373,11 @@ function advanced_config_generate {
|
||||
then
|
||||
MESSAGE="Saving Custom SSH Port to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# SSH_PORT=''/c\SSH_PORT='${INPUT_SSH_PORT}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# SSH_PORT=''/c\SSH_PORT='${INPUT_SSH_PORT}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
|
||||
MESSAGE="Enable ICMP Check? (Leave blank for default 'Yes')"
|
||||
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}"
|
||||
@ -327,12 +386,12 @@ function advanced_config_generate {
|
||||
then
|
||||
MESSAGE="Saving ICMP Avoidance to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# PING_AVOID=''/c\PING_AVOID='1'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# PING_AVOID=''/c\PING_AVOID='1'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
PING_AVOID=1
|
||||
fi
|
||||
|
||||
MESSAGE="Use Custom SSH PKIF Location? (Leave blank for default '.ssh/id_rsa')"
|
||||
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}"
|
||||
@ -341,11 +400,11 @@ function advanced_config_generate {
|
||||
then
|
||||
MESSAGE="Saving Custom PKIF to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# SSH_PKIF=''/c\SSH_PKIF='${INPUT_CUSTOM_PKIF}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
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? (Leave blank for default 'Yes')"
|
||||
MESSAGE="Enable Replicate 'Local DNS Records' Feature? (Y/N, default 'Y')"
|
||||
echo_need
|
||||
read INPUT_SKIP_CUSTOM
|
||||
INPUT_SKIP_CUSTOM="${INPUT_SKIP_CUSTOM:-Y}"
|
||||
@ -354,13 +413,13 @@ function advanced_config_generate {
|
||||
then
|
||||
MESSAGE="Saving Local DNS Preference to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# SKIP_CUSTOM=''/c\SKIP_CUSTOM='1'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# SKIP_CUSTOM=''/c\SKIP_CUSTOM='1'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
|
||||
if [ "${INPUT_SKIP_CUSTOM}" == "Y" ]
|
||||
then
|
||||
MESSAGE="Enable Replicate 'Local CNAME Records' Feature? (Leave blank for default 'Yes')"
|
||||
MESSAGE="Enable Replicate 'Local CNAME Records' Feature? (Y/N, default 'Y')"
|
||||
echo_need
|
||||
read INPUT_INCLUDE_CNAME
|
||||
INPUT_INCLUDE_CNAME="${INPUT_INCLUDE_CNAME:-Y}"
|
||||
@ -369,33 +428,34 @@ function advanced_config_generate {
|
||||
then
|
||||
MESSAGE="Saving Local CNAME Preference to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# INCLUDE_CNAME=''/c\INCLUDE_CNAME='1'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# INCLUDE_CNAME=''/c\INCLUDE_CNAME='1'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
fi
|
||||
|
||||
MESSAGE="Change Backup Retention in Days? (Leave blank for default '7')"
|
||||
MESSAGE="Change Backup Retention in Days? (Leave blank for default '3')"
|
||||
echo_need
|
||||
read INPUT_BACKUP_RETAIN
|
||||
INPUT_BACKUP_RETAIN="${INPUT_BACKUP_RETAIN:-7}"
|
||||
INPUT_BACKUP_RETAIN="${INPUT_BACKUP_RETAIN:-3}"
|
||||
|
||||
if [ "${INPUT_BACKUP_RETAIN}" != "7" ]
|
||||
if [ "${INPUT_BACKUP_RETAIN}" != "3" ]
|
||||
then
|
||||
MESSAGE="Saving Backup Retention to ${CONFIG_FILE}"
|
||||
echo_stat
|
||||
sed -i "/# BACKUP_RETAIN=''/c\BACKUP_RETAIN='1'" ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
sed -i "/# BACKUP_RETAIN=''/c\BACKUP_RETAIN='${INPUT_BACKUP_RETAIN}'" ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
}
|
||||
|
||||
## Delete Existing Configuration
|
||||
function config_delete {
|
||||
source ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
source ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
MESSAGE="Configuration File Exists"
|
||||
echo_warn
|
||||
|
||||
echo_lines
|
||||
cat ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
cat ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
echo_blank
|
||||
echo_lines
|
||||
|
||||
MESSAGE="Are you sure you want to erase this configuration?"
|
||||
@ -405,7 +465,7 @@ function config_delete {
|
||||
|
||||
MESSAGE="Erasing Existing Configuration"
|
||||
echo_stat
|
||||
rm -f ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
rm -f ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
|
||||
config_generate
|
||||
@ -423,6 +483,18 @@ function docker_detect {
|
||||
fi
|
||||
}
|
||||
|
||||
## Detect Podman
|
||||
function podman_detect {
|
||||
if hash podman 2>/dev/null
|
||||
then
|
||||
FTLCHECK=$(sudo podman container ls | grep 'pihole/pihole')
|
||||
if [ "$FTLCHECK" != "" ]
|
||||
then
|
||||
PODMANREADY="1"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
## Create Bash Alias
|
||||
function create_alias {
|
||||
MESSAGE="Creating Bash Alias"
|
||||
|
@ -6,11 +6,13 @@
|
||||
|
||||
## Import Settings
|
||||
function import_gs {
|
||||
relocate_config_gs
|
||||
|
||||
MESSAGE="Importing ${CONFIG_FILE} Settings"
|
||||
echo -en "${STAT} $MESSAGE"
|
||||
if [ -f ${LOCAL_FOLDR}/${CONFIG_FILE} ]
|
||||
if [ -f ${LOCAL_FOLDR}/settings/${CONFIG_FILE} ]
|
||||
then
|
||||
source ${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
source ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
|
||||
# MESSAGE="Targeting ${REMOTE_USER}@${REMOTE_HOST}"
|
||||
@ -28,6 +30,44 @@ function import_gs {
|
||||
fi
|
||||
}
|
||||
|
||||
function relocate_config_gs {
|
||||
if [ -f ${LOCAL_FOLDR}/${CONFIG_FILE} ]
|
||||
then
|
||||
MESSAGE="Relocating ${CONFIG_FILE}"
|
||||
echo -en "${STAT} $MESSAGE"
|
||||
|
||||
mv ${LOCAL_FOLDR}/${CONFIG_FILE} ${LOCAL_FOLDR}/settings/${CONFIG_FILE}
|
||||
error_validate
|
||||
fi
|
||||
|
||||
if [ -f ${LOCAL_FOLDR}/${SYNCING_LOG} ]
|
||||
then
|
||||
MESSAGE="Relocating ${SYNCING_LOG}"
|
||||
echo -en "${STAT} $MESSAGE"
|
||||
|
||||
mv ${LOCAL_FOLDR}/${SYNCING_LOG} ${LOG_PATH}/${SYNCING_LOG}
|
||||
error_validate
|
||||
fi
|
||||
|
||||
if [ -f ${LOCAL_FOLDR}/${CRONJOB_LOG} ]
|
||||
then
|
||||
MESSAGE="Relocating ${CRONJOB_LOG}"
|
||||
echo -en "${STAT} $MESSAGE"
|
||||
|
||||
mv ${LOCAL_FOLDR}/${CRONJOB_LOG} ${LOG_PATH}/${CRONJOB_LOG}
|
||||
error_validate
|
||||
fi
|
||||
|
||||
if [ -f ${LOCAL_FOLDR}/${HISTORY_MD5} ]
|
||||
then
|
||||
MESSAGE="Relocating ${HISTORY_MD5}"
|
||||
echo -en "${STAT} $MESSAGE"
|
||||
|
||||
mv ${LOCAL_FOLDR}/${HISTORY_MD5} ${LOG_PATH}/${HISTORY_MD5}
|
||||
error_validate
|
||||
fi
|
||||
}
|
||||
|
||||
## Invalid Tasks
|
||||
function task_invalid {
|
||||
echo_fail
|
||||
@ -51,7 +91,10 @@ function ph_type {
|
||||
PH_EXEC="${PIHOLE_BIN}"
|
||||
elif [ "$PH_IN_TYPE" == "docker" ]
|
||||
then
|
||||
PH_EXEC="sudo ${DOCKER_BIN} exec ${DOCKER_CON} pihole"
|
||||
PH_EXEC="sudo ${DOCKER_BIN} exec $(sudo ${DOCKER_BIN} ps -qf name=${DOCKER_CON}) pihole"
|
||||
elif [ "$PH_IN_TYPE" == "podman" ]
|
||||
then
|
||||
PH_EXEC="sudo ${PODMAN_BIN} exec ${DOCKER_CON} pihole"
|
||||
fi
|
||||
|
||||
if [ "$RH_IN_TYPE" == "default" ]
|
||||
@ -59,7 +102,10 @@ function ph_type {
|
||||
RH_EXEC="${RIHOLE_BIN}"
|
||||
elif [ "$RH_IN_TYPE" == "docker" ]
|
||||
then
|
||||
RH_EXEC="sudo ${ROCKER_BIN} exec ${ROCKER_CON} pihole"
|
||||
RH_EXEC="sudo ${ROCKER_BIN} exec $(sudo ${ROCKER_BIN} ps -qf ${ROCKER_CON}) pihole"
|
||||
elif [ "$RH_IN_TYPE" == "podman" ]
|
||||
then
|
||||
RH_EXEC="sudo ${RODMAN_BIN} exec ${ROCKER_CON} pihole"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,10 @@ function show_info() {
|
||||
pihole version
|
||||
elif [ "${PH_IN_TYPE}" == "docker" ]
|
||||
then
|
||||
docker exec -it pihole pihole -v
|
||||
sudo docker exec -it pihole pihole -v
|
||||
elif [ "${PH_IN_TYPE}" == "podman" ]
|
||||
then
|
||||
sudo podman exec -it pihole pihole -v
|
||||
fi
|
||||
|
||||
uname -srm
|
||||
@ -112,6 +115,12 @@ function show_info() {
|
||||
then
|
||||
docker --version
|
||||
fi
|
||||
|
||||
if hash podman 2>/dev/null
|
||||
then
|
||||
podman --version
|
||||
fi
|
||||
|
||||
echo -e ""
|
||||
|
||||
echo -e "${YELLOW}Local/Secondary Instance Settings${NC}"
|
||||
@ -127,6 +136,10 @@ function show_info() {
|
||||
then
|
||||
echo -e "Local Pi-hole Container Name: ${DOCKER_CON}"
|
||||
echo -e "Local Docker Binary Directory: ${DOCKER_BIN}"
|
||||
elif [ "${PH_IN_TYPE}" == "podman" ]
|
||||
then
|
||||
echo -e "Local Pi-hole Container Name: ${DOCKER_CON}"
|
||||
echo -e "Local Podman Binary Directory: ${PODMAN_BIN}"
|
||||
fi
|
||||
|
||||
echo -e "Local File Owner Settings: ${FILE_OWNER}"
|
||||
@ -196,6 +209,10 @@ function show_info() {
|
||||
then
|
||||
echo -e "Remote Pi-hole Container Name: ${ROCKER_CON}"
|
||||
echo -e "Remote Docker Binary Directory: ${ROCKER_BIN}"
|
||||
elif [ "${RH_IN_TYPE}" == "podman" ]
|
||||
then
|
||||
echo -e "Remote Pi-hole Container Name: ${ROCKER_CON}"
|
||||
echo -e "Remote Podman Binary Directory: ${RODMAN_BIN}"
|
||||
fi
|
||||
|
||||
echo -e "Remote File Owner Settings: ${RILE_OWNER}"
|
||||
|
@ -46,6 +46,15 @@ function validate_ph_folders {
|
||||
echo_fail
|
||||
exit_nochange
|
||||
fi
|
||||
elif [ "$PH_IN_TYPE" == "podman" ]
|
||||
then
|
||||
FTLCHECK=$(sudo podman container ls | grep 'pihole/pihole')
|
||||
if [ "$FTLCHECK" == "" ]
|
||||
then
|
||||
MESSAGE="Unable to Validate that Pi-Hole is Installed"
|
||||
echo_fail
|
||||
exit_nochange
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d ${PIHOLE_DIR} ]
|
||||
|
1
logs/README.md
Normal file
1
logs/README.md
Normal file
@ -0,0 +1 @@
|
||||
Logging goes here.
|
@ -24,8 +24,24 @@ PHFAILCOUNT="0"
|
||||
CURRENTUSER=$(whoami)
|
||||
|
||||
# Header
|
||||
echo -e "========================================================"
|
||||
echo -e "${YELLOW}Gravity Sync by ${BLUE}@vmstan${YELLOW} - Online Installation${NC}"
|
||||
echo -e ""
|
||||
echo -e " ..::-----::.. ..::------::. "
|
||||
echo -e " .:----:::::::----:. .:::--:::::---===-: "
|
||||
echo -e " :---:. .:---: +##+:. .:-===-. "
|
||||
echo -e " .---:. :---: -*##*: .-===: "
|
||||
echo -e " .---. :---: -++*+. .==+- "
|
||||
echo -e " ---. = :---: :====. - .=++."
|
||||
echo -e ":--: -=-. :---::---:. -=-. :++="
|
||||
echo -e "---. .:-=====-:.. ------. .:-=====-:.. .+++"
|
||||
echo -e "---. .:===-. :------: .:===-. :+++"
|
||||
echo -e ".--: .=: :---: :---: =: -++-"
|
||||
echo -e " :--: .. .---:. :--:: .. -=+= "
|
||||
echo -e " :--: .---:. :-::: -===. "
|
||||
echo -e " :---: :---: ::::: .:==== "
|
||||
echo -e " :---::.. ..::---:. ::::::.. ..:-===-. "
|
||||
echo -e " .::-----------::. .::---------===-: "
|
||||
echo -e ""
|
||||
echo -e "${YELLOW}Gravity Sync by ${BLUE}@vmstan${NC}"
|
||||
echo -e "${CYAN}https://github.com/vmstan/gravity-sync${NC}"
|
||||
echo -e "========================================================"
|
||||
echo -e "[${GREEN}✓${NC}] Checking Short Range Sensors"
|
||||
@ -155,6 +171,33 @@ else
|
||||
PHFAILCOUNT=$((PHFAILCOUNT+1))
|
||||
fi
|
||||
fi
|
||||
elif hash podman 2>/dev/null
|
||||
then
|
||||
echo -e "[${GREEN}✓${NC}] Podman Binaries Detected"
|
||||
|
||||
if [ "$LOCALADMIN" == "sudo" ]
|
||||
then
|
||||
FTLCHECK=$(sudo podman container ls | grep 'pihole/pihole')
|
||||
elif [ "$LOCALADMIN" == "nosudo" ]
|
||||
then
|
||||
echo -e "[${PURPLE}!${NC}] ${PURPLE}No Podman Pi-hole Container Detected (unable to scan)${NC}"
|
||||
# CROSSCOUNT=$((CROSSCOUNT+1))
|
||||
PHFAILCOUNT=$((PHFAILCOUNT+1))
|
||||
else
|
||||
FTLCHECK=$(podman container ls | grep 'pihole/pihole')
|
||||
fi
|
||||
|
||||
if [ "$LOCALADMIN" != "nosudo" ]
|
||||
then
|
||||
if [ "$FTLCHECK" != "" ]
|
||||
then
|
||||
echo -e "[${GREEN}✓${NC}] Pi-Hole Podman Container Detected"
|
||||
else
|
||||
echo -e "[${PURPLE}!${NC}] ${PURPLE}No Podman Pi-hole Container Detected${NC}"
|
||||
# CROSSCOUNT=$((CROSSCOUNT+1))
|
||||
PHFAILCOUNT=$((PHFAILCOUNT+1))
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# echo -e "[${RED}✗${NC}] No Local Pi-hole Install Detected"
|
||||
echo -e "[${PURPLE}!${NC}] ${PURPLE}No Docker Pi-hole Alternative Detected${NC}"
|
||||
@ -217,7 +260,12 @@ else
|
||||
echo -e "[${YELLOW}i${NC}] Installation Exiting (without changes)"
|
||||
else
|
||||
echo -e "[${BLUE}>${NC}] Creating Gravity Sync Directories"
|
||||
git clone https://github.com/vmstan/gravity-sync.git
|
||||
if [ "$GS_DEV" != "" ]
|
||||
then
|
||||
git clone -b ${GS_DEV} https://github.com/vmstan/gravity-sync.git
|
||||
else
|
||||
git clone https://github.com/vmstan/gravity-sync.git
|
||||
fi
|
||||
echo -e "[${BLUE}>${NC}] Starting Gravity Sync Configuration"
|
||||
echo -e "========================================================"
|
||||
./gravity-sync/gravity-sync.sh configure <&1
|
||||
|
@ -9,8 +9,8 @@ REMOTE_USER='pi'
|
||||
# STANDARD VARIABLES #########################
|
||||
|
||||
### Installation Types
|
||||
# PH_IN_TYPE='' # Pi-hole install type, `default` or `docker` (local)
|
||||
# RH_IN_TYPE='' # Pi-hole install type, `default` or `docker` (remote)
|
||||
# PH_IN_TYPE='' # Pi-hole install type, `default`, `docker`, or `podman` (local)
|
||||
# RH_IN_TYPE='' # Pi-hole install type, `default`, `docker`, or `podman` (remote)
|
||||
|
||||
### Pi-hole Folder/File Customization
|
||||
# PIHOLE_DIR='' # default Pi-hole data directory (local)
|
||||
@ -21,10 +21,12 @@ REMOTE_USER='pi'
|
||||
# RIHOLE_BIN='' # default Pi-hole binary directory (remote)
|
||||
# DOCKER_BIN='' # default Docker binary directory (local)
|
||||
# ROCKER_BIN='' # default Docker binary directory (remote)
|
||||
# PODMAN_BIN='' # default Podman binary directory (local)
|
||||
# RODMAN_BIN='' # default Podman binary directory (remote)
|
||||
# FILE_OWNER='' # default Pi-hole file owner and group (local)
|
||||
# RILE_OWNER='' # default Pi-hole file owner and group (remote)
|
||||
# DOCKER_CON='' # default Pi-hole Docker container name (local)
|
||||
# ROCKER_CON='' # default Pi-hole Docker container name (remote)
|
||||
# DOCKER_CON='' # default Pi-hole container name (local)
|
||||
# ROCKER_CON='' # default Pi-hole container name (remote)
|
||||
|
||||
# GRAVITY_FI='' # default Pi-hole database file
|
||||
# CUSTOM_DNS='' # default Pi-hole local DNS lookups
|
Loading…
Reference in New Issue
Block a user