mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
More review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
61840edb30
commit
bbc392caeb
@ -120,6 +120,7 @@ gravity_store_in_database() {
|
|||||||
tmpFile="$(mktemp -p "/tmp" --suffix=".gravity")"
|
tmpFile="$(mktemp -p "/tmp" --suffix=".gravity")"
|
||||||
local timestamp
|
local timestamp
|
||||||
timestamp="$(date --utc +'%s')"
|
timestamp="$(date --utc +'%s')"
|
||||||
|
local inputfile
|
||||||
if [ "$table" == "whitelist" ] || [ "$table" == "blacklist" ] || [ "$table" == "regex" ]; then
|
if [ "$table" == "whitelist" ] || [ "$table" == "blacklist" ] || [ "$table" == "regex" ]; then
|
||||||
# Apply format for white-, blacklist, and regex tables
|
# Apply format for white-, blacklist, and regex tables
|
||||||
# Read file line by line
|
# Read file line by line
|
||||||
@ -135,7 +136,7 @@ gravity_store_in_database() {
|
|||||||
# Store domains in gravity database table ${table}
|
# Store domains in gravity database table ${table}
|
||||||
# Use printf as .mode and .import need to be on separate lines
|
# Use printf as .mode and .import need to be on separate lines
|
||||||
# see https://unix.stackexchange.com/a/445615/83260
|
# see https://unix.stackexchange.com/a/445615/83260
|
||||||
output=$( { printf ".mode csv\\n.import \"%s\" ${table}\\n" "${inputfile}" | sqlite3 "${gravityDBfile}"; } 2>&1 )
|
output=$( { printf ".mode csv\\n.import \"%s\" %s\\n" "${inputfile}" "${table}" | sqlite3 "${gravityDBfile}"; } 2>&1 )
|
||||||
status="$?"
|
status="$?"
|
||||||
|
|
||||||
if [[ "${status}" -ne 0 ]]; then
|
if [[ "${status}" -ne 0 ]]; then
|
||||||
@ -144,7 +145,7 @@ gravity_store_in_database() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Delete tmpfile
|
# Delete tmpfile
|
||||||
#rm "$tmpFile" > /dev/null 2>&1 || true
|
rm "$tmpFile" > /dev/null 2>&1 || true
|
||||||
|
|
||||||
# Only create template file if asked to
|
# Only create template file if asked to
|
||||||
if [ "${template}" != "-" ]; then
|
if [ "${template}" != "-" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user