From a780fc59e28b5cd9be7e60fa9c530db16fffff96 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 20 Dec 2021 10:56:42 -0800 Subject: [PATCH] Set DBFile permissions on creation. Signed-off-by: Dan Schaper --- gravity.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gravity.sh b/gravity.sh index b2cd27b9..81bca09d 100755 --- a/gravity.sh +++ b/gravity.sh @@ -75,7 +75,9 @@ fi # Generate new sqlite3 file from schema template generate_gravity_database() { - sqlite3 "${1}" < "${gravityDBschema}" + sqlite3 "${gravityDBFile}" < "${gravityDBschema}" + chown pihole:pihole "${gravityDBfile}" + chmod g+w "${piholeDir}" "${gravityDBfile}" } # Copy data from old to new database file and swap them @@ -279,7 +281,7 @@ migrate_to_database() { if [ ! -e "${gravityDBfile}" ]; then # Create new database file - note that this will be created in version 1 echo -e " ${INFO} Creating new gravity database" - generate_gravity_database "${gravityDBfile}" + generate_gravity_database # Check if gravity database needs to be updated upgrade_gravityDB "${gravityDBfile}" "${piholeDir}"