1
0
mirror of https://github.com/pi-hole/pi-hole.git synced 2025-09-15 13:21:15 +08:00

Move unattended check to the top of the script - exit early if /etc/pihole/pihole.toml file is not found,

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2025-08-11 14:51:59 +01:00
parent 75286a1626
commit 5ed52554d7

View File

@ -167,6 +167,17 @@ for var in "$@"; do
esac esac
done done
if [[ "${runUnattended}" == true ]]; then
# In order to run an unattended setup, a pre-seeded /etc/pihole/pihole.toml must exist
if [[ ! -f "${PI_HOLE_CONFIG_DIR}/pihole.toml" ]]; then
printf " %b Error: \"%s\" not found. Cannot run unattended setup\\n" "${CROSS}" "${PI_HOLE_CONFIG_DIR}/pihole.toml"
exit 1
fi
printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"
# also disable debconf-apt-progress dialogs
export DEBIAN_FRONTEND="noninteractive"
fi
# If the color table file exists, # If the color table file exists,
if [[ -f "${coltable}" ]]; then if [[ -f "${coltable}" ]]; then
# source it # source it
@ -2242,15 +2253,6 @@ main() {
exit 1 exit 1
fi fi
if [[ "${fresh_install}" == false ]]; then
# if it's running unattended,
if [[ "${runUnattended}" == true ]]; then
printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"
# also disable debconf-apt-progress dialogs
export DEBIAN_FRONTEND="noninteractive"
fi
fi
if [[ "${fresh_install}" == true ]]; then if [[ "${fresh_install}" == true ]]; then
# Display welcome dialogs # Display welcome dialogs
welcomeDialogs welcomeDialogs