From 74e52675f187e750bf200fdbd24f511714b2c590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Wed, 2 Oct 2024 13:47:23 +0200 Subject: [PATCH] Use pihole.toml to decide if installer runs on an update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- automated install/basic-install.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 4598f88e..4852929c 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -77,6 +77,7 @@ PI_HOLE_FILES=(list piholeDebug piholeLogFlush setupLCD update version gravity u PI_HOLE_INSTALL_DIR="/opt/pihole" PI_HOLE_CONFIG_DIR="/etc/pihole" PI_HOLE_BIN_DIR="/usr/local/bin" +PI_HOLE_V6_CONFIG="${PI_HOLE_CONFIG_DIR}/pihole.toml" if [ -z "$useUpdateVars" ]; then useUpdateVars=false fi @@ -2194,7 +2195,7 @@ migrate_dnsmasq_configs() { # Exit early if this is already Pi-hole v6.0 # We decide this on the presence of the file /etc/pihole/pihole.toml - if [[ -f /etc/pihole/pihole.toml ]]; then + if [[ -f "${PI_HOLE_V6_CONFIG}" ]]; then return 0 fi @@ -2289,16 +2290,19 @@ main() { printf " %b Checking for / installing Required dependencies for this install script...\\n" "${INFO}" install_dependent_packages "${INSTALLER_COMMON_DEPS[@]}" "${INSTALLER_DEPS[@]}" - # if it's running unattended, - if [[ "${runUnattended}" == true ]]; then - printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}" - # Use the setup variables - useUpdateVars=true - # also disable debconf-apt-progress dialogs - export DEBIAN_FRONTEND="noninteractive" - else - # If running attended, show the available options (repair/reconfigure) - update_dialogs + # in case of an update + if [[ -f "${PI_HOLE_V6_CONFIG}" ]]; then + # if it's running unattended, + if [[ "${runUnattended}" == true ]]; then + printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}" + # Use the setup variables + useUpdateVars=true + # also disable debconf-apt-progress dialogs + export DEBIAN_FRONTEND="noninteractive" + else + # If running attended, show the available options (repair/reconfigure) + update_dialogs + fi fi if [[ "${useUpdateVars}" == false ]]; then