diff --git a/gravity.sh b/gravity.sh index 3a7db5ae..493f2b15 100755 --- a/gravity.sh +++ b/gravity.sh @@ -541,16 +541,14 @@ gravity_DownloadBlocklists() { # it (in case it doesn't exist) # First, check if the directory is writable directory="$(dirname -- "${saveLocation}")" - directory_permissions=$(stat -c %a ${directory}) - if [ $directory_permissions -lt 700 ]; then + if [ ! -w "${directory}" ]; then echo -e " ${CROSS} Unable to write to ${directory}" echo " Please run pihole -g as root" echo "" continue fi # Then, check if the file is writable (if it exists) - saveLocation_permissions=$(stat -c %a ${saveLocation}) - if [ -e "${saveLocation}" ] && [ ${saveLocation_permissions} -lt 600 ]; then + if [ -e "${saveLocation}" ] && [ ! -w "${saveLocation}" ]; then echo -e " ${CROSS} Unable to write to ${saveLocation}" echo " Please run pihole -g as root" echo ""