gravity-sync/gravity-sync.sh

202 lines
6.8 KiB
Bash
Raw Normal View History

2020-05-21 18:00:42 +00:00
#!/bin/bash
2020-06-02 15:44:16 +00:00
SCRIPT_START=$SECONDS
2020-05-21 18:00:42 +00:00
2020-05-22 17:18:16 +00:00
# GRAVITY SYNC BY VMSTAN #####################
2020-05-23 23:37:08 +00:00
PROGRAM='Gravity Sync'
VERSION='3.4.7'
2020-05-21 18:00:42 +00:00
2020-05-28 01:51:21 +00:00
# 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
2020-05-21 18:00:42 +00:00
2020-05-22 17:18:16 +00:00
# REQUIRED SETTINGS ##########################
2020-05-21 18:00:42 +00:00
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
# Run './gravity-sync.sh config' to get started, it will customize the script for your environment
# You should not to change the values of any variables here here to customize your install
# Add replacement variables to gravity-sync.conf, which will overwrite these defaults.
2020-05-22 17:18:16 +00:00
2020-05-22 17:25:30 +00:00
# STANDARD VARIABLES #########################
2020-05-21 18:00:42 +00:00
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
# Installation Types
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)
2020-05-21 18:00:42 +00:00
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
# Pi-hole Folder/File Customization
PIHOLE_DIR='/etc/pihole' # default Pi-hole data directory (local)
RIHOLE_DIR='/etc/pihole' # default Pi-hole data directory (remote)
DNSMAQ_DIR='/etc/dnsmasq.d' # default DNSMASQ data directory (local)
RNSMAQ_DIR='/etc/dnsmasq.d' # default DNSMASQ data directory (remote)
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
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)
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
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 container name (local)
ROCKER_CON='pihole' # default Pi-hole container name (remote)
CONTAIMAGE='pihole/pihole' # official Pi-hole container image
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
GRAVITY_FI='gravity.db' # default Pi-hole database file
CUSTOM_DNS='custom.list' # default Pi-hole local DNS lookups
CNAME_CONF='05-pihole-custom-cname.conf' # default DNSMASQ CNAME alias file
GSLAN_CONF='08-gs-lan.conf' # default DNSMASQ GS managed file
2020-05-27 15:00:30 +00:00
2020-05-29 02:43:58 +00:00
# Interaction Customization
VERIFY_PASS='0' # replace in gravity-sync.conf to overwrite
2020-05-29 19:43:36 +00:00
SKIP_CUSTOM='0' # replace in gravity-sync.conf to overwrite
INCLUDE_CNAME='0' # replace in gravity-sync.conf to overwrite
2020-05-29 19:43:36 +00:00
DATE_OUTPUT='0' # replace in gravity-sync.conf to overwrite
2020-06-02 14:43:58 +00:00
PING_AVOID='0' # replace in gravity-sync.conf to overwrite
ROOT_CHECK_AVOID='0' # replace in gravity-sync.conf to overwrite
2020-05-29 02:43:58 +00:00
2020-07-11 03:13:49 +00:00
# Backup Customization
BACKUP_RETAIN='3' # replace in gravity-sync.conf to overwrite
BACKUP_TIMEOUT='240' # replace in gravity-sync.conf to overwrite
BACKUP_INTEGRITY_WAIT='5' # replace in gravity-sync.conf to overwrite
2020-07-11 03:13:49 +00:00
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
# SSH Customization
SSH_PORT='22' # default SSH port
SSH_PKIF='.ssh/id_rsa' # default local SSH key
# GS Folder/File Locations
GS_FILEPATH=$(realpath $0) # auto determined - do not change!
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}/logs" # replace in gravity-sync.conf to overwrite
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
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
2020-05-21 18:00:42 +00:00
2020-05-28 15:54:32 +00:00
# OS Settings
BASH_PATH='/bin/bash' # default OS bash path
2020-05-24 18:39:21 +00:00
##############################################
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
### NEVER CHANGE ANYTHING BELOW THIS LINE! ###
2020-05-24 18:39:21 +00:00
##############################################
3.3.3 is 3.4.0 (#185) * new first line of script * no requested * Abort! * Test silent folder validation * sameline * echo newline * echo_sameline * what happened? * sameline for ssh * sqlite sameline * Lower case * Reset line * clear line * Flip the line * version update * Backup lowercase * More lowercase * Remove file names from standard messages * Breakout backup message * Output backup folder size * Just H * Invalid replication settings * Compare updated * Colors and updates * Lower case for version output * For Pihole * Cron cleanup * Sudo, or no sudo. * Branch! * Silent error validate * Silent error validate * Clearing up status messages * Records * Primary and secondary * Gravity database * Domain Database * Backup output cleanup * Move file permission validation into new functions * Change restart * UI variables test * Breakout UI variables into new file * Unified validation functions * Replace text strings with variables * Replace text strings with variables * Replace logging with variables * Convert backup to UI variables * Switch restore to UI variables * Fix bug where gravity database did not restore * App validation checks * Rev to 3.4.0 * Convert Push functions to new strings * Completing push UI changes * remove added line * Move purge to UI strings * Move automation to UI strings * Move core strings into UI * Exit strings * First pass at hashing UI * Escape the remote system query (#179) * hashing committed Co-authored-by: Michael Stanclift <vmstan@mstanclift-a03.local> Co-authored-by: Veduco <59983694+Veduco@users.noreply.github.com>
2021-04-01 20:16:20 +00:00
# Import UI Fields
source ${LOCAL_FOLDR}/includes/gs-ui.sh
# Import Color/Message Includes
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
source ${LOCAL_FOLDR}/includes/gs-colors.sh
2020-05-21 18:00:42 +00:00
# FUNCTION DEFINITIONS #######################
2020-05-28 15:54:32 +00:00
# Core Functions
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
source ${LOCAL_FOLDR}/includes/gs-core.sh
2020-06-03 20:43:36 +00:00
# Gravity Replication Functions
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
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
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
source ${LOCAL_FOLDR}/includes/gs-hashing.sh
source ${LOCAL_FOLDR}/includes/gs-ssh.sh
# Logging Functions
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
source ${LOCAL_FOLDR}/includes/gs-logging.sh
# Validation Functions
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
source ${LOCAL_FOLDR}/includes/gs-validate.sh
source ${LOCAL_FOLDR}/includes/gs-intent.sh
source ${LOCAL_FOLDR}/includes/gs-root.sh
# Configuration Management
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
source ${LOCAL_FOLDR}/includes/gs-config.sh
source ${LOCAL_FOLDR}/includes/gs-update.sh
source ${LOCAL_FOLDR}/includes/gs-automate.sh
source ${LOCAL_FOLDR}/includes/gs-purge.sh
# Exit Codes
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
source ${LOCAL_FOLDR}/includes/gs-exit.sh
# SCRIPT EXECUTION ###########################
2020-05-21 18:00:42 +00:00
case $# in
2020-12-31 02:45:47 +00:00
0)
start_gs
2020-12-31 02:49:54 +00:00
task_smart ;;
2020-12-31 02:45:47 +00:00
1)
case $1 in
smart|sync)
start_gs
task_smart ;;
2020-12-31 02:45:47 +00:00
pull)
start_gs
task_pull ;;
2020-12-31 02:45:47 +00:00
push)
start_gs
task_push ;;
2020-12-31 02:45:47 +00:00
restore)
start_gs
task_restore ;;
2020-12-31 02:45:47 +00:00
version)
start_gs_noconfig
task_version ;;
2020-12-31 02:45:47 +00:00
update|upgrade)
start_gs_noconfig
task_update ;;
2020-12-31 02:45:47 +00:00
dev|devmode|development|develop)
start_gs_noconfig
task_devmode ;;
2020-12-31 02:45:47 +00:00
logs|log)
start_gs
task_logs ;;
2020-12-31 02:45:47 +00:00
compare)
start_gs
task_compare ;;
2020-12-31 02:45:47 +00:00
cron)
start_gs
task_cron ;;
2020-12-31 02:45:47 +00:00
config|configure)
start_gs_noconfig
task_configure ;;
2020-12-31 02:45:47 +00:00
auto|automate)
start_gs
task_automate ;;
2020-12-31 02:45:47 +00:00
backup)
start_gs
task_backup ;;
2020-12-31 02:45:47 +00:00
purge)
start_gs
task_purge ;;
2020-12-31 02:45:47 +00:00
sudo)
start_gs
task_sudo ;;
2020-12-31 02:45:47 +00:00
info)
start_gs
task_info ;;
2020-12-31 02:45:47 +00:00
*)
start_gs
task_invalid ;;
2020-12-31 02:45:47 +00:00
esac
;;
2020-12-31 02:49:54 +00:00
2020-12-31 02:45:47 +00:00
2)
case $1 in
auto|automate)
start_gs
task_automate ;;
2020-12-31 02:45:47 +00:00
esac
;;
2020-12-31 02:49:54 +00:00
2020-12-31 02:45:47 +00:00
3)
case $1 in
auto|automate)
start_gs
task_automate $2 ;;
2020-12-31 02:45:47 +00:00
esac
;;
*)
start_gs
task_invalid ;;
2.2.0 (#81) * import config file before executing * show_target function * git * Sync back (#72) * 2.1.6 beta 1 (#65) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> * 2.1.6 beta 2 (#67) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific * adv conf: add ROOT_CHECK_AVOID for container. (#64) * adv conf: add ROOT_CHECK_AVOID for container. import_gs only once at start * allow parameters for automation option Co-authored-by: Michael Stanclift <mstanclift@vmware.com> * Post PR cleanup * Thanks for fbourqui * readjusts import_gs Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> * 2.1.7 (#70) * import config file before executing * show_target function * git Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> * Sync back (#73) * 2.1.6 beta 1 (#65) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> * 2.1.6 beta 2 (#67) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific * adv conf: add ROOT_CHECK_AVOID for container. (#64) * adv conf: add ROOT_CHECK_AVOID for container. import_gs only once at start * allow parameters for automation option Co-authored-by: Michael Stanclift <mstanclift@vmware.com> * Post PR cleanup * Thanks for fbourqui * readjusts import_gs Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> * spellcheck is awesome * I speel reel gurd * Spelling sucks * Update remote backup timeout to 60 This will avoid [ FAIL ] Performing Backup of Remote gravity.db * readme updates * spelling * extra fi * config cleanup * hide if dbclient installed but also ssh * move backup in config * backup process in configure * 2.2.0 beta 1 (#78) * 2.1.6 beta 1 (#65) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> * 2.1.6 beta 2 (#67) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific * adv conf: add ROOT_CHECK_AVOID for container. (#64) * adv conf: add ROOT_CHECK_AVOID for container. import_gs only once at start * allow parameters for automation option Co-authored-by: Michael Stanclift <mstanclift@vmware.com> * Post PR cleanup * Thanks for fbourqui * readjusts import_gs Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> * import config file before executing * show_target function * git * Sync back (#72) * 2.1.6 beta 1 (#65) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> * 2.1.6 beta 2 (#67) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific * adv conf: add ROOT_CHECK_AVOID for container. (#64) * adv conf: add ROOT_CHECK_AVOID for container. import_gs only once at start * allow parameters for automation option Co-authored-by: Michael Stanclift <mstanclift@vmware.com> * Post PR cleanup * Thanks for fbourqui * readjusts import_gs Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> * 2.1.7 (#70) * import config file before executing * show_target function * git Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> * spellcheck is awesome * I speel reel gurd * Spelling sucks * Update remote backup timeout to 60 This will avoid [ FAIL ] Performing Backup of Remote gravity.db * readme updates * spelling * extra fi * config cleanup * hide if dbclient installed but also ssh * move backup in config * backup process in configure Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> Co-authored-by: Sungray <ced.lapage@gmail.com> Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.local> * THE PURGE * PURGE IT * PURRRRRRGE * Purged Release * if beta * pihole note * silence git output * 2.2.0 beta 2 (#79) * 2.1.6 beta 1 (#65) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> * 2.1.6 beta 2 (#67) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific * adv conf: add ROOT_CHECK_AVOID for container. (#64) * adv conf: add ROOT_CHECK_AVOID for container. import_gs only once at start * allow parameters for automation option Co-authored-by: Michael Stanclift <mstanclift@vmware.com> * Post PR cleanup * Thanks for fbourqui * readjusts import_gs Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> * import config file before executing * show_target function * git * Sync back (#72) * 2.1.6 beta 1 (#65) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> * 2.1.6 beta 2 (#67) * select different files for restore * star trek reference * Log backup jobs * color restore * ping avoid and custom ssh prompts * z variable * or * [] * new method for defaults * variables matter * or this? * making it specific * adv conf: add ROOT_CHECK_AVOID for container. (#64) * adv conf: add ROOT_CHECK_AVOID for container. import_gs only once at start * allow parameters for automation option Co-authored-by: Michael Stanclift <mstanclift@vmware.com> * Post PR cleanup * Thanks for fbourqui * readjusts import_gs Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> * 2.1.7 (#70) * import config file before executing * show_target function * git Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> * spellcheck is awesome * I speel reel gurd * Spelling sucks * Update remote backup timeout to 60 This will avoid [ FAIL ] Performing Backup of Remote gravity.db * readme updates * spelling * extra fi * config cleanup * hide if dbclient installed but also ssh * move backup in config * backup process in configure * THE PURGE * PURGE IT * PURRRRRRGE * Purged Release * if beta * pihole note * silence git output Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> Co-authored-by: Sungray <ced.lapage@gmail.com> Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.local> * Installation instructions. * bash * words * purge now updates * purge reword * more warnigns * 2.2.0 Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.vmstan.net> Co-authored-by: fbourqui <fbourqui@yahoo.com> Co-authored-by: Sungray <ced.lapage@gmail.com> Co-authored-by: Michael Stanclift <vmstan@MS-MacBook.local>
2020-07-21 05:14:20 +00:00
esac
# END OF SCRIPT ##############################