1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-03-06 03:06:07 +00:00

Fix gravity.sh -- Alpine / Docker specific issue (#6030)

This commit is contained in:
Adam Warner 2025-03-03 17:44:45 +00:00 committed by GitHub
commit edf336067a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -541,14 +541,16 @@ gravity_DownloadBlocklists() {
# it (in case it doesn't exist)
# First, check if the directory is writable
directory="$(dirname -- "${saveLocation}")"
if [ ! -w "${directory}" ]; then
directory_permissions=$(stat -c %a ${directory})
if [ $directory_permissions -lt 700 ]; 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)
if [ -e "${saveLocation}" ] && [ ! -w "${saveLocation}" ]; then
saveLocation_permissions=$(stat -c %a ${saveLocation})
if [ -e "${saveLocation}" ] && [ ${saveLocation_permissions} -lt 600 ]; then
echo -e " ${CROSS} Unable to write to ${saveLocation}"
echo " Please run pihole -g as root"
echo ""