diff --git a/src/bash_functions.sh b/src/bash_functions.sh index 89a47a9..17eface 100644 --- a/src/bash_functions.sh +++ b/src/bash_functions.sh @@ -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 diff --git a/src/start.sh b/src/start.sh index 0563cf3..47c702f 100644 --- a/src/start.sh +++ b/src/start.sh @@ -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