Fix some broken logic in the gravity skip code (I should have read it better)

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner 2023-08-09 22:13:28 +01:00
parent 94795db7e9
commit 696895fa59
No known key found for this signature in database
2 changed files with 19 additions and 15 deletions

View File

@ -52,7 +52,9 @@ ensure_basic_configuration() {
# chown pihole:root "${PI_HOLE_BIN_DIR}/pihole"
mkdir -p /etc/pihole
echo "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" >> /etc/pihole/adlists.list
if [[ ! -f /etc/pihole/adlists.list ]]; then
echo "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" > /etc/pihole/adlists.list
fi
chown -R pihole:pihole /etc/pihole

View File

@ -98,24 +98,26 @@ start() {
/usr/sbin/crond
#migrate Database if needed:
#migrate Database if needed:
gravityDBfile=$(getFTLConfigValue files.gravity)
if [ -n "${SKIPGRAVITYONBOOT}" ]; then
if [ -f "${gravityDBfile}" ]; then
#skip set + file =>update if needed
echo " Skipping Gravity Database Update."
# TODO: Revisit this path if we move to a multistage build
source /etc/.pihole/advanced/Scripts/database_migration/gravity-db.sh
upgrade_gravityDB "${gravityDBfile}" "/etc/pihole"
else
#skip set + nofile => pihole -g (install error)
if [ ! -f "${gravityDBfile}" ]; then
if [ -n "${SKIPGRAVITYONBOOT}" ]; then
echo " SKIPGRAVITYONBOOT is set, however ${gravityDBfile} does not exist (Likely due to a fresh volume). This is a required file for Pi-hole to operate."
echo " Ignoring SKIPGRAVITYONBOOT on this occasion."
pihole -g
fi
else
echo " Skipping Gravity Database Update."
unset SKIPGRAVITYONBOOT
fi
else
# TODO: Revisit this path if we move to a multistage build
source /etc/.pihole/advanced/Scripts/database_migration/gravity-db.sh
upgrade_gravityDB "${gravityDBfile}" "/etc/pihole"
fi
if [ -n "${SKIPGRAVITYONBOOT}" ]; then
echo " Skipping Gravity Database Update."
else
pihole -g
fi
pihole updatechecker