From db546425ffc4e1dfe83ba295dbd0bfd62d03583b Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Wed, 3 Jun 2020 18:12:07 -0500 Subject: [PATCH 1/5] Check for sudo ability --- README.md | 2 -- gravity-sync.sh | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index defa437..4078711 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ What is better than a [Pi-hole](https://github.com/pi-hole/pi-hole) blocking ads That's Gravity Sync. -![Pull execution](https://user-images.githubusercontent.com/3002053/82915078-e870a180-9f35-11ea-8b36-271a02acdeaa.gif) - At it's core, Gravity Sync is maybe a handful of core bash commands, that uses rsync to reach out to a remote host, copy the running `gravity.db` file that contains the Pi-hole blocklist, as well as the `custom.list` file that contains local DNS enteries, and then replaces the copy on the local system. What Gravity Sync provides is an easy way to keep this happening in the background. Ideally you set it and forget it and in the long term, it would be awesome if the Pi-hole team made this entire script unncessary. Gravity Sync will **not** overwrite device specific settings such as device network configuration, admin/API passwords/keys, upstream DNS resolvers, etc. It will also **not** keep DHCP settings or device leases synchronized. diff --git a/gravity-sync.sh b/gravity-sync.sh index 8ca504a..1854334 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1221,6 +1221,12 @@ function task_configure { TASKTYPE='CONFIGURE' MESSAGE="${MESSAGE}: ${TASKTYPE} Requested" echo_good + + MESSAGE="Escalation Ability Check" + echo_stat + + timeout 2 sudo cat VERSION + error_validate if [ -f $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} ] then From 1f3aac8142602b4cf015bc3e3ba02399bd5a16e5 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Wed, 3 Jun 2020 18:14:16 -0500 Subject: [PATCH 2/5] Hide output --- gravity-sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 1854334..be55400 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1225,7 +1225,7 @@ function task_configure { MESSAGE="Escalation Ability Check" echo_stat - timeout 2 sudo cat VERSION + timeout 2 sudo cat VERSION >/dev/null 2>&1 error_validate if [ -f $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} ] From f908739ae1f8a974cf1310b5ada316fd9d31b66d Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Thu, 11 Jun 2020 21:08:13 -0500 Subject: [PATCH 3/5] Remove esc check --- gravity-sync.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index be55400..36b22da 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -846,7 +846,8 @@ function detect_ssh { ## Error Validation function error_validate { - if [ "$?" != "0" ]; then + if [ "$?" != "0" ] + then echo_fail exit 1 else @@ -1221,12 +1222,6 @@ function task_configure { TASKTYPE='CONFIGURE' MESSAGE="${MESSAGE}: ${TASKTYPE} Requested" echo_good - - MESSAGE="Escalation Ability Check" - echo_stat - - timeout 2 sudo cat VERSION >/dev/null 2>&1 - error_validate if [ -f $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} ] then @@ -1486,4 +1481,4 @@ case $# in *) task_invalid ;; -esac +esac \ No newline at end of file From e72536359543410eecd781a28d424a9f4449cbd6 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Thu, 11 Jun 2020 21:24:12 -0500 Subject: [PATCH 4/5] Fix for no custom.list locally not replicating --- gravity-sync.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/gravity-sync.sh b/gravity-sync.sh index 36b22da..2b68e3d 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -915,6 +915,7 @@ function md5_compare { then REMOTE_CUSTOM_DNS="1" MESSAGE="${REMOTE_HOST} has ${CUSTOM_DNS}" + HASHMARK=$((HASHMARK+1)) echo_info fi MESSAGE="No ${CUSTOM_DNS} Detected on $HOSTNAME" From e233a42daa34e83868753b56beaef8625fc8d4c2 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Thu, 11 Jun 2020 21:35:20 -0500 Subject: [PATCH 5/5] 1.8.2 --- ADVANCED.md | 4 ++-- CHANGELOG.md | 5 ++++- VERSION | 2 +- gravity-sync.sh | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ADVANCED.md b/ADVANCED.md index eeb79dd..4ac0662 100644 --- a/ADVANCED.md +++ b/ADVANCED.md @@ -14,8 +14,8 @@ Download the latest release from [GitHub](https://github.com/vmstan/gravity-sync ```bash cd ~ -wget https://github.com/vmstan/gravity-sync/archive/v1.8.1.zip -unzip v1.8.1.zip -d gravity-sync +wget https://github.com/vmstan/gravity-sync/archive/v1.8.2.zip +unzip v1.8.2.zip -d gravity-sync cd gravity-sync ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a0e4db..5f3b3b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,11 @@ There is nothing really sexy here, but a lot of changes under the covers to impr - Adds custom port specification to ssh-copy-id and dropbearkey commands during configuration generation. - Generally better error handling of configuration options. +#### 1.8.2 +- Corrects issue where `custom.list` file would not replicate if the file didn't exist locally, and there were no other changes to replicate. [#39](https://github.com/vmstan/gravity-sync/issues/39) + #### 1.8.1 -- Detects if script is running as the root user or via `sudo ./gravity-sync.sh` and exits on error. +- Detects if script is running as the root user or via `sudo ./gravity-sync.sh` and exits on error. [#34](https://github.com/vmstan/gravity-sync/issues/34) ## 1.7 ### The Andrew Release diff --git a/VERSION b/VERSION index b9268da..0bfbd57 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8.1 \ No newline at end of file +1.8.2 \ No newline at end of file diff --git a/gravity-sync.sh b/gravity-sync.sh index 2b68e3d..20e5789 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -3,7 +3,7 @@ SCRIPT_START=$SECONDS # GRAVITY SYNC BY VMSTAN ##################### PROGRAM='Gravity Sync' -VERSION='1.8.1' +VERSION='1.8.2' # 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