From 948f4a8827dfca24ce38e4b9a1a3c1d0072d847b Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 16 Dec 2019 09:55:46 +0000 Subject: [PATCH] Ensure permissions and ownership of gravity.db are correctly set on each run of pihole -g. This would have prevented https://github.com/pi-hole/AdminLTE/issues/1077 Signed-off-by: DL6ER --- gravity.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gravity.sh b/gravity.sh index f2e82b43..659263b5 100755 --- a/gravity.sh +++ b/gravity.sh @@ -81,10 +81,6 @@ fi # Generate new sqlite3 file from schema template generate_gravity_database() { sqlite3 "${gravityDBfile}" < "${gravityDBschema}" - - # Ensure proper permissions are set for the newly created database - chown pihole:pihole "${gravityDBfile}" - chmod g+w "${piholeDir}" "${gravityDBfile}" } update_gravity_timestamp() { @@ -690,6 +686,10 @@ fi # Move possibly existing legacy files to the gravity database migrate_to_database +# Ensure proper permissions are set for the newly created database +chown pihole:pihole "${gravityDBfile}" +chmod g+w "${piholeDir}" "${gravityDBfile}" + if [[ "${forceDelete:-}" == true ]]; then str="Deleting existing list cache" echo -ne "${INFO} ${str}..."