From 85da9aa8f8b90f4e0ce8cae070ab86973950fd4a Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Tue, 26 May 2020 11:43:12 -0500 Subject: [PATCH] New way to validate permissions --- gravity-sync.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 1f63a45..6e299b4 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -145,15 +145,19 @@ function pull_gs { MESSAGE="Validating Permissions on ${GRAVITY_FI}" echo -en "${STAT} ${MESSAGE}" - if [ ! u-w "${PIHOLE_DIR}/${GRAVITY_FI}" ] + GRAVDB_RWE=$(namei -m ${PIHOLE_DIR}/${GRAVITY_FI} | grep ${GRAVITY_FI} | awk '{print $1}' ) + if [ $GRAVDB_RWE "-rw-r--r--" ] then + echo -e "\r${GOOD} ${MESSAGE}" + else echo -e "\r${FAIL} $MESSAGE" - + MESSAGE2="Attempting to Compensate" + + MESSAGE="Setting Ownership on ${GRAVITY_FI}" + echo -en "${STAT} ${MESSAGE}" sudo chmod 644 ${PIHOLE_DIR}/${GRAVITY_FI} >/dev/null 2>&1 error_validate - else - echo -e "\r${GOOD} ${MESSAGE}" fi # MESSAGE="Setting Permissions on ${GRAVITY_FI}"