Now that FTL has a native config migration option - we no longer need to defer the startup of FTL as we were previously doing.

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2025-01-14 17:57:27 +00:00
committed by yubiuser
parent 164cf4ac28
commit 79111aea02
2 changed files with 25 additions and 18 deletions

View File

@@ -147,7 +147,7 @@ ftl_config() {
setup_web_password
}
migrate_dnsmasq_d_contents() {
migrate_v5_configs() {
# Previously, Pi-hole created a number of files in /etc/dnsmasq.d
# During migration, their content is copied into the new single source of
# truth file /etc/pihole/pihole.toml and the old files are moved away to
@@ -168,6 +168,21 @@ migrate_dnsmasq_d_contents() {
mv /etc/dnsmasq.d/0{1,2,4,5}-pihole*.conf "${V6_CONF_MIGRATION_DIR}/" 2>/dev/null || true
mv /etc/dnsmasq.d/06-rfc6761.conf "${V6_CONF_MIGRATION_DIR}/" 2>/dev/null || true
echo ""
# Finally, after everything is in place, we can create the new config file
# /etc/pihole/pihole.toml
# This file will be created with the default settings unless the user has
# changed settings via setupVars.conf or the other dnsmasq files moved above
# During migration, setupVars.conf is moved to /etc/pihole/migration_backup_v6
local FTLoutput
FTLoutput=$(pihole-FTL migrate v6)
# Print the output of the FTL migration prefacing every line with six
# spaces for alignment with other container output. Replace the first line to match the style of the other messages
printf "%b" "${FTLoutput}" | sed 's/^/ /' | sed 's/ Migrating config to Pi-hole v6.0 format/ [i] Migrating config to Pi-hole v6.0 format/'
# Print a blank line for separation
echo ""
}
setup_web_password() {

View File

@@ -21,13 +21,8 @@ start() {
# FTL Will handle the migration of the config files
if [[ -f /etc/pihole/setupVars.conf && ! -f /etc/pihole/pihole.toml ]]; then
echo " [i] v5 files detected that have not yet been migrated to v6"
echo " [i] Deferring additional configuration until after FTL has started"
echo " [i] Note: It is normal to see \"Config file /etc/pihole/pihole.toml not available (r): No such file or directory\" in the logs at this point"
echo ""
# We need to migrate the dnsmasq.d contents so that FTL can read them in properly
migrate_dnsmasq_d_contents
v5_volume=1
migrate_v5_configs
fi
# ===========================
@@ -37,12 +32,9 @@ start() {
# If PIHOLE_UID is set, modify the pihole user's id to match
set_uid_gid
# Only run the next step if we are not migrating from v5 to v6
if [[ ${v5_volume} -eq 0 ]]; then
# Configure FTL with any environment variables if needed
echo " [i] Starting FTL configuration"
ftl_config
fi
# Configure FTL with any environment variables if needed
echo " [i] Starting FTL configuration"
ftl_config
# Install additional packages inside the container if requested
install_additional_packages
@@ -88,11 +80,11 @@ start() {
# If we are migrating from v5 to v6, we now need to run the basic configuration step that we deferred earlier
# This is because pihole-FTL needs to migrate the config files before we can perform the basic configuration checks
if [[ ${v5_volume} -eq 1 ]]; then
echo " [i] Starting deferred FTL Configuration"
ftl_config
echo ""
fi
# if [[ ${v5_volume} -eq 1 ]]; then
# echo " [i] Starting deferred FTL Configuration"
# ftl_config
# echo ""
# fi
pihole updatechecker
pihole -v