mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-03-04 15:58:27 +00:00
Update gravity.sh
fix the `if statement` that doesn't seem to work for neither of alpine's ash / bash - applying some workaround with the `stat` command Signed-off-by: Karol Kania <44871508+karolkania@users.noreply.github.com>
This commit is contained in:
parent
567bb724b1
commit
a9650ae287
1 changed files with 6 additions and 2 deletions
|
@ -541,14 +541,18 @@ 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})
|
||||
# echo "directory_permissions: ${directory_permissions}"
|
||||
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})
|
||||
# echo "saveLocation_permissions: ${saveLocation_permissions}"
|
||||
if [ -e "${saveLocation}" ] && [ ${saveLocation_permissions} -lt 600 ]; then
|
||||
echo -e " ${CROSS} Unable to write to ${saveLocation}"
|
||||
echo " Please run pihole -g as root"
|
||||
echo ""
|
||||
|
|
Loading…
Add table
Reference in a new issue