From 4a1bcda6f1b0a7f7e56221ad3ac27b7f509e20a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Mon, 21 Apr 2025 09:28:19 +0200 Subject: [PATCH 1/2] All gravity related files and dirs should be owned by pihole:pihole MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- gravity.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 514289d0..37a7301b 100755 --- a/gravity.sh +++ b/gravity.sh @@ -126,7 +126,7 @@ gravity_swap_databases() { oldAvail=false if [ "${availableBlocks}" -gt "$((gravityBlocks * 2))" ] && [ -f "${gravityDBfile}" ]; then oldAvail=true - cp "${gravityDBfile}" "${gravityOLDfile}" + cp -p "${gravityDBfile}" "${gravityOLDfile}" fi # Drop the gravity and antigravity tables + subsequent VACUUM the current @@ -140,6 +140,7 @@ gravity_swap_databases() { # Check if the backup directory exists if [ ! -d "${gravityBCKdir}" ]; then mkdir -p "${gravityBCKdir}" + chown pihole:pihole "${gravityBCKdir}" fi # If multiple gravityBCKfile's are present (appended with a number), rotate them @@ -1016,6 +1017,7 @@ migrate_to_listsCache_dir() { local str="Migrating the list's cache directory to new location" echo -ne " ${INFO} ${str}..." mkdir -p "${listsCacheDir}" + chown pihole:pihole "${listsCacheDir}" # Move the old files to the new directory if mv "${piholeDir}"/list.* "${listsCacheDir}/" 2>/dev/null; then From 189da82614a4d9e3a25e526541fa5719f7047bd5 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Mon, 12 May 2025 08:54:58 +0200 Subject: [PATCH 2/2] && chown Co-authored-by: Dan Schaper Signed-off-by: yubiuser --- gravity.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gravity.sh b/gravity.sh index 37a7301b..f34ac3fb 100755 --- a/gravity.sh +++ b/gravity.sh @@ -139,8 +139,7 @@ gravity_swap_databases() { else # Check if the backup directory exists if [ ! -d "${gravityBCKdir}" ]; then - mkdir -p "${gravityBCKdir}" - chown pihole:pihole "${gravityBCKdir}" + mkdir -p "${gravityBCKdir}" && chown pihole:pihole "${gravityBCKdir}" fi # If multiple gravityBCKfile's are present (appended with a number), rotate them @@ -1016,8 +1015,7 @@ migrate_to_listsCache_dir() { # If not, we need to migrate the old files to the new directory local str="Migrating the list's cache directory to new location" echo -ne " ${INFO} ${str}..." - mkdir -p "${listsCacheDir}" - chown pihole:pihole "${listsCacheDir}" + mkdir -p "${listsCacheDir}" && chown pihole:pihole "${listsCacheDir}" # Move the old files to the new directory if mv "${piholeDir}"/list.* "${listsCacheDir}/" 2>/dev/null; then