Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pi-hole/pi-hole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDL6ER <dl6er@dl6er.de>2021-03-18 11:04:09 +0300
committerDL6ER <dl6er@dl6er.de>2021-03-18 18:46:59 +0300
commitf536718aaab7fd4ed1d22a9b0e5f3357cc1f9efb (patch)
treec288ad5d559582056935b7f30ec40775a179cfcf /gravity.sh
parentf1740da9ffcbabc58b56107d2e1131aae380dd90 (diff)
Use possibly custom gravity.db location in the copying SQL script
Signed-off-by: DL6ER <dl6er@dl6er.de>
Diffstat (limited to 'gravity.sh')
-rwxr-xr-xgravity.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/gravity.sh b/gravity.sh
index d07d558d..24a41c48 100755
--- a/gravity.sh
+++ b/gravity.sh
@@ -90,7 +90,7 @@ generate_gravity_database() {
# Copy data from old to new database file and swap them
gravity_swap_databases() {
- local str
+ local str copyGravity
str="Building tree"
echo -ne " ${INFO} ${str}..."
@@ -107,7 +107,14 @@ gravity_swap_databases() {
str="Swapping databases"
echo -ne " ${INFO} ${str}..."
- output=$( { sqlite3 "${gravityTEMPfile}" < "${gravityDBcopy}"; } 2>&1 )
+ # Gravity copying SQL script
+ copyGravity="$(cat "${gravityDBcopy}")"
+ if [[ "${gravityDBfile}" != "${gravityDBfile_default}" ]]; then
+ # Replace default gravity script location by custom location
+ copyGravity="${copyGravity//"${gravityDBfile_default}"/"${gravityDBfile}"}"
+ fi
+
+ output=$( { sqlite3 "${gravityTEMPfile}" <<< "${copyGravity}"; } 2>&1 )
status="$?"
if [[ "${status}" -ne 0 ]]; then