mirror of
https://github.com/vmstan/gravity-sync.git
synced 2025-06-02 05:04:13 -04:00
3.0.2 (#104)
* version change * Nova * No-config function * Markdown cleanup * Create gs-core file * correct missing includes via cron Co-authored-by: Michael Stanclift <vmstan@Sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
This commit is contained in:
parent
c1b71ec996
commit
7d09218524
4
.nova/Configuration.json
Normal file
4
.nova/Configuration.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"editor.default_syntax" : "shell",
|
||||||
|
"workspace.name" : "Gravity Sync"
|
||||||
|
}
|
14
README.md
14
README.md
@ -59,7 +59,7 @@ Starting with version 2.0, Gravity Sync will attempt to sync the Adlist database
|
|||||||
|
|
||||||
Minimal preperation is required (as of version 2.2.3) on your primary Pi-hole.
|
Minimal preperation is required (as of version 2.2.3) on your primary Pi-hole.
|
||||||
|
|
||||||
Login to your *primary* Pi-hole, and run the following command:
|
Login to your _primary_ Pi-hole, and run the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export GS_INSTALL=primary && curl -sSL https://raw.githubusercontent.com/vmstan/gravity-sync/master/prep/gs-install.sh | bash
|
export GS_INSTALL=primary && curl -sSL https://raw.githubusercontent.com/vmstan/gravity-sync/master/prep/gs-install.sh | bash
|
||||||
@ -67,13 +67,13 @@ export GS_INSTALL=primary && curl -sSL https://raw.githubusercontent.com/vmstan/
|
|||||||
|
|
||||||
This will verify you have everything necessary to use Gravity Sync. It will also add a passwordless sudo configuration file for the current user. The installer will then exit, and direct you to proceed to the secondary Pi-hole.
|
This will verify you have everything necessary to use Gravity Sync. It will also add a passwordless sudo configuration file for the current user. The installer will then exit, and direct you to proceed to the secondary Pi-hole.
|
||||||
|
|
||||||
After you have completed this step, log out of the *primary* Pi-hole.
|
After you have completed this step, log out of the _primary_ Pi-hole.
|
||||||
|
|
||||||
### Secondary Pi-Hole
|
### Secondary Pi-Hole
|
||||||
|
|
||||||
From this point forward, all operations will take place on your secondary Pi-hole.
|
From this point forward, all operations will take place on your secondary Pi-hole.
|
||||||
|
|
||||||
Login to your *secondary* Pi-hole, and run the following command:
|
Login to your _secondary_ Pi-hole, and run the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export GS_INSTALL=secondary && curl -sSL https://raw.githubusercontent.com/vmstan/gravity-sync/master/prep/gs-install.sh | bash
|
export GS_INSTALL=secondary && curl -sSL https://raw.githubusercontent.com/vmstan/gravity-sync/master/prep/gs-install.sh | bash
|
||||||
@ -85,7 +85,7 @@ Proceed to the Configuration section.
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
After you install Gravity Sync to your *secondary Pi-hole* you will need to create a configuration file.
|
After you install Gravity Sync to your _secondary Pi-hole_ you will need to create a configuration file.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd $HOME/gravity-sync
|
cd $HOME/gravity-sync
|
||||||
@ -166,9 +166,9 @@ You can verify your existing automation entry by running `crontab -l` and see it
|
|||||||
|
|
||||||
If you'd like to know what version of the script you have running, check the built in version checker. It will notify you if there are updates available.
|
If you'd like to know what version of the script you have running, check the built in version checker. It will notify you if there are updates available.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./gravity-sync.sh version
|
./gravity-sync.sh version
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then run the built-in updater to get the latest version of all the files. Both the `version` and `update` commands reach out to GitHub, so outbound access to GitHub.com is required.
|
You can then run the built-in updater to get the latest version of all the files. Both the `version` and `update` commands reach out to GitHub, so outbound access to GitHub.com is required.
|
||||||
|
|
||||||
|
@ -19,6 +19,12 @@ Enjoy!
|
|||||||
- Minor shuffle of `gravity-sync.sh` contents.
|
- Minor shuffle of `gravity-sync.sh` contents.
|
||||||
- Clarify installation requirements in `README.md`.
|
- Clarify installation requirements in `README.md`.
|
||||||
- Fixes issues with permissions on `gravity.db` after push operations.
|
- Fixes issues with permissions on `gravity.db` after push operations.
|
||||||
|
- Fixes missing script startup output during `dev` operation.
|
||||||
|
|
||||||
|
#### 3.0.2
|
||||||
|
|
||||||
|
- Realigned EPS conduits, they overheat if you leave them pointed the same way for too long.
|
||||||
|
- Corrected error when running via crontab where includes directory was not properly sourced.
|
||||||
|
|
||||||
## 2.2
|
## 2.2
|
||||||
|
|
||||||
|
110
gravity-sync.sh
110
gravity-sync.sh
@ -3,7 +3,7 @@ SCRIPT_START=$SECONDS
|
|||||||
|
|
||||||
# GRAVITY SYNC BY VMSTAN #####################
|
# GRAVITY SYNC BY VMSTAN #####################
|
||||||
PROGRAM='Gravity Sync'
|
PROGRAM='Gravity Sync'
|
||||||
VERSION='3.0.1'
|
VERSION='3.0.2'
|
||||||
|
|
||||||
# Execute from the home folder of the user who owns it (ex: 'cd ~/gravity-sync')
|
# Execute from the home folder of the user who owns it (ex: 'cd ~/gravity-sync')
|
||||||
# For documentation or downloading updates visit https://github.com/vmstan/gravity-sync
|
# For documentation or downloading updates visit https://github.com/vmstan/gravity-sync
|
||||||
@ -62,95 +62,41 @@ SSH_PKIF='.ssh/id_rsa' # default local SSH key
|
|||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
# Import Color/Message Includes
|
# Import Color/Message Includes
|
||||||
source includes/gs-colors.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-colors.sh
|
||||||
|
|
||||||
# FUNCTION DEFINITIONS #######################
|
# FUNCTION DEFINITIONS #######################
|
||||||
|
|
||||||
# Import Settings
|
# Core Functions
|
||||||
function import_gs {
|
source $HOME/${LOCAL_FOLDR}/includes/gs-core.sh
|
||||||
MESSAGE="Importing ${CONFIG_FILE} Settings"
|
|
||||||
echo -en "${STAT} $MESSAGE"
|
|
||||||
if [ -f $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} ]
|
|
||||||
then
|
|
||||||
source $HOME/${LOCAL_FOLDR}/${CONFIG_FILE}
|
|
||||||
error_validate
|
|
||||||
|
|
||||||
# MESSAGE="Targeting ${REMOTE_USER}@${REMOTE_HOST}"
|
# Gravity Replication Functions
|
||||||
# echo_info
|
source $HOME/${LOCAL_FOLDR}/includes/gs-compare.sh
|
||||||
|
source $HOME/${LOCAL_FOLDR}/includes/gs-pull.sh
|
||||||
# detect_ssh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-push.sh
|
||||||
else
|
source $HOME/${LOCAL_FOLDR}/includes/gs-smart.sh
|
||||||
echo_fail
|
source $HOME/${LOCAL_FOLDR}/includes/gs-restore.sh
|
||||||
|
source $HOME/${LOCAL_FOLDR}/includes/gs-backup.sh
|
||||||
MESSAGE="${CONFIG_FILE} Missing"
|
|
||||||
echo_info
|
|
||||||
|
|
||||||
TASKTYPE='CONFIG'
|
|
||||||
config_generate
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Invalid Tasks
|
|
||||||
function task_invalid {
|
|
||||||
echo_fail
|
|
||||||
list_gs_arguments
|
|
||||||
}
|
|
||||||
|
|
||||||
# Error Validation
|
|
||||||
function error_validate {
|
|
||||||
if [ "$?" != "0" ]
|
|
||||||
then
|
|
||||||
echo_fail
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo_good
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Standard Output
|
|
||||||
function start_gs {
|
|
||||||
MESSAGE="${PROGRAM} ${VERSION} Executing"
|
|
||||||
echo_info
|
|
||||||
|
|
||||||
import_gs
|
|
||||||
|
|
||||||
MESSAGE="Evaluating Arguments"
|
|
||||||
echo_stat
|
|
||||||
|
|
||||||
if [ "${ROOT_CHECK_AVOID}" != "1" ]
|
|
||||||
then
|
|
||||||
root_check
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Gravity Core Functions
|
|
||||||
source includes/gs-compare.sh
|
|
||||||
source includes/gs-pull.sh
|
|
||||||
source includes/gs-push.sh
|
|
||||||
source includes/gs-smart.sh
|
|
||||||
source includes/gs-restore.sh
|
|
||||||
source includes/gs-backup.sh
|
|
||||||
|
|
||||||
# Hashing & SSH Functions
|
# Hashing & SSH Functions
|
||||||
source includes/gs-hashing.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-hashing.sh
|
||||||
source includes/gs-ssh.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-ssh.sh
|
||||||
|
|
||||||
# Logging Functions
|
# Logging Functions
|
||||||
source includes/gs-logging.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-logging.sh
|
||||||
|
|
||||||
# Validation Functions
|
# Validation Functions
|
||||||
source includes/gs-validate.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-validate.sh
|
||||||
source includes/gs-intent.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-intent.sh
|
||||||
source includes/gs-root.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-root.sh
|
||||||
|
|
||||||
# Configuration Management
|
# Configuration Management
|
||||||
source includes/gs-config.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-config.sh
|
||||||
source includes/gs-update.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-update.sh
|
||||||
source includes/gs-automate.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-automate.sh
|
||||||
source includes/gs-purge.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-purge.sh
|
||||||
|
|
||||||
# Exit Codes
|
# Exit Codes
|
||||||
source includes/gs-exit.sh
|
source $HOME/${LOCAL_FOLDR}/includes/gs-exit.sh
|
||||||
|
|
||||||
# SCRIPT EXECUTION ###########################
|
# SCRIPT EXECUTION ###########################
|
||||||
|
|
||||||
@ -191,12 +137,7 @@ case $# in
|
|||||||
start_gs
|
start_gs
|
||||||
task_cron ;;
|
task_cron ;;
|
||||||
config|configure)
|
config|configure)
|
||||||
MESSAGE="${PROGRAM} ${VERSION} Executing"
|
start_gs_noconfig
|
||||||
echo_info
|
|
||||||
|
|
||||||
MESSAGE="Evaluating Arguments"
|
|
||||||
echo_stat
|
|
||||||
|
|
||||||
task_configure ;;
|
task_configure ;;
|
||||||
auto|automate)
|
auto|automate)
|
||||||
start_gs
|
start_gs
|
||||||
@ -209,10 +150,7 @@ case $# in
|
|||||||
task_purge ;;
|
task_purge ;;
|
||||||
sudo)
|
sudo)
|
||||||
start_gs
|
start_gs
|
||||||
task_sudo
|
task_sudo ;;
|
||||||
exit_withchange
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
start_gs
|
start_gs
|
||||||
task_invalid ;;
|
task_invalid ;;
|
||||||
|
71
includes/gs-core.sh
Normal file
71
includes/gs-core.sh
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
# GRAVITY SYNC BY VMSTAN #####################
|
||||||
|
# gs-core.sh #################################
|
||||||
|
|
||||||
|
# For documentation or downloading updates visit https://github.com/vmstan/gravity-sync
|
||||||
|
# This code is called from the main gravity-sync.sh file and should not execute directly!
|
||||||
|
|
||||||
|
## Import Settings
|
||||||
|
function import_gs {
|
||||||
|
MESSAGE="Importing ${CONFIG_FILE} Settings"
|
||||||
|
echo -en "${STAT} $MESSAGE"
|
||||||
|
if [ -f $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} ]
|
||||||
|
then
|
||||||
|
source $HOME/${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||||
|
error_validate
|
||||||
|
|
||||||
|
# MESSAGE="Targeting ${REMOTE_USER}@${REMOTE_HOST}"
|
||||||
|
# echo_info
|
||||||
|
|
||||||
|
# detect_ssh
|
||||||
|
else
|
||||||
|
echo_fail
|
||||||
|
|
||||||
|
MESSAGE="${CONFIG_FILE} Missing"
|
||||||
|
echo_info
|
||||||
|
|
||||||
|
TASKTYPE='CONFIG'
|
||||||
|
config_generate
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## Invalid Tasks
|
||||||
|
function task_invalid {
|
||||||
|
echo_fail
|
||||||
|
list_gs_arguments
|
||||||
|
}
|
||||||
|
|
||||||
|
## Error Validation
|
||||||
|
function error_validate {
|
||||||
|
if [ "$?" != "0" ]
|
||||||
|
then
|
||||||
|
echo_fail
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo_good
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Standard Output
|
||||||
|
function start_gs {
|
||||||
|
MESSAGE="${PROGRAM} ${VERSION} Executing"
|
||||||
|
echo_info
|
||||||
|
|
||||||
|
import_gs
|
||||||
|
|
||||||
|
MESSAGE="Evaluating Arguments"
|
||||||
|
echo_stat
|
||||||
|
|
||||||
|
if [ "${ROOT_CHECK_AVOID}" != "1" ]
|
||||||
|
then
|
||||||
|
root_check
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Standard Output No Config
|
||||||
|
function start_gs_noconfig {
|
||||||
|
MESSAGE="${PROGRAM} ${VERSION} Executing"
|
||||||
|
echo_info
|
||||||
|
|
||||||
|
MESSAGE="Evaluating Arguments"
|
||||||
|
echo_stat
|
||||||
|
}
|
@ -22,6 +22,8 @@ function task_sudo {
|
|||||||
|
|
||||||
sudo install -m 0440 $HOME/${LOCAL_FOLDR}/templates/gs-nopasswd.sudo /etc/sudoers.d/gs-nopasswd
|
sudo install -m 0440 $HOME/${LOCAL_FOLDR}/templates/gs-nopasswd.sudo /etc/sudoers.d/gs-nopasswd
|
||||||
error_validate
|
error_validate
|
||||||
|
|
||||||
|
exit_withchange
|
||||||
}
|
}
|
||||||
|
|
||||||
## Root Check
|
## Root Check
|
||||||
@ -32,7 +34,7 @@ function root_check {
|
|||||||
MESSAGE="${MESSAGE} ${TASKTYPE}"
|
MESSAGE="${MESSAGE} ${TASKTYPE}"
|
||||||
echo_fail
|
echo_fail
|
||||||
|
|
||||||
MESSAGE="${PROGRAM} Must Not Run as Root"
|
MESSAGE="${PROGRAM} Should Not Run As 'root'"
|
||||||
echo_warn
|
echo_warn
|
||||||
|
|
||||||
exit_nochange
|
exit_nochange
|
||||||
|
Loading…
x
Reference in New Issue
Block a user