1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-02-06 21:22:38 +00:00

Use a different method to identify if a gravity restore succeeded (#5868)

This commit is contained in:
Dominik 2025-01-29 19:23:40 +01:00 committed by GitHub
commit e682f69a1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -413,7 +413,7 @@ gravity_DownloadBlocklists() {
echo -e " ${INFO} Storing gravity database in ${COL_BOLD}${gravityDBfile}${COL_NC}"
fi
local url domain str target compression adlist_type directory
local url domain str target compression adlist_type directory success
echo ""
# Prepare new gravity database
@ -447,16 +447,18 @@ gravity_DownloadBlocklists() {
echo -e "\\n ${CROSS} Unable to copy data from ${gravityDBfile} to ${gravityTEMPfile}\\n ${output}"
# Try to attempt a backup restore
success=false
if [[ -d "${gravityBCKdir}" ]]; then
for i in {1..10}; do
if try_restore_backup "${i}"; then
success=true
break
fi
done
fi
# If none of the attempts worked, return 1
if [[ "${i}" -eq 10 ]]; then
if [[ "${success}" == false ]]; then
pihole-FTL sqlite3 "${gravityTEMPfile}" "INSERT OR REPLACE INTO info (property,value) values ('gravity_restored','failed');"
return 1
fi