From 846805aeb75b49b27e48613df8b99f4fcdfac869 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 23 Jan 2023 17:52:39 +0000 Subject: [PATCH] Configure FTL to use /macvendor.db instead of /etc/pihole/macvendor.db. If user is passing in their own location, then we honour that. Signed-off-by: Adam Warner Signed-off-by: Adam Warner --- src/s6/debian-root/usr/local/bin/bash_functions.sh | 8 ++++---- src/s6/debian-root/usr/local/bin/install.sh | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/s6/debian-root/usr/local/bin/bash_functions.sh b/src/s6/debian-root/usr/local/bin/bash_functions.sh index efb22c2..611ca8c 100644 --- a/src/s6/debian-root/usr/local/bin/bash_functions.sh +++ b/src/s6/debian-root/usr/local/bin/bash_functions.sh @@ -107,11 +107,11 @@ ensure_basic_configuration() { cp -f "${setupVars}" "${setupVars}.update.bak" fi - # Remove any existing macvendor.db and replace it with a symblink to the one moved to the root directory (see install.sh) - if [[ -f "/etc/pihole/macvendor.db" ]]; then - rm /etc/pihole/macvendor.db + # If FTLCONF_MACVENDORDB is not set + if [[ -z "${FTLCONF_MACVENDORDB:-}" ]]; then + # User is not passing in a custom location - so force FTL to use the file we moved to / during the build + changeFTLsetting "MACVENDORDB" "/macvendor.db" fi - ln -s /macvendor.db /etc/pihole/macvendor.db # When fresh empty directory volumes are used then we need to create this file if [ ! -f /etc/dnsmasq.d/01-pihole.conf ] ; then diff --git a/src/s6/debian-root/usr/local/bin/install.sh b/src/s6/debian-root/usr/local/bin/install.sh index d0e31c9..77d17cb 100644 --- a/src/s6/debian-root/usr/local/bin/install.sh +++ b/src/s6/debian-root/usr/local/bin/install.sh @@ -86,11 +86,11 @@ sed -i $'s/)\s*uninstallFunc/) unsupportedFunc/g' /usr/local/bin/pihole # pihole -r / pihole reconfigure sed -i $'s/)\s*reconfigurePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole -# Move macvendor.db to root dir and symlink it back into /etc/pihole. See https://github.com/pi-hole/docker-pi-hole/issues/1137 +# Move macvendor.db to root dir See https://github.com/pi-hole/docker-pi-hole/issues/1137 +# During startup we will change FTL's configuration to point to this file instead of /etc/pihole/macvendor.db # If user goes on to bind monunt this directory to their host, then we can easily ensure macvendor.db is the latest # (it is otherwise only updated when FTL is updated, which doesn't happen as part of the normal course of running this image) mv /etc/pihole/macvendor.db /macvendor.db -ln -s /macvendor.db /etc/pihole/macvendor.db if [ ! -f /.piholeFirstBoot ]; then touch /.piholeFirstBoot