Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The distro_check function includes updating the APT cache, checking for dependencies, which is both not required on Docker start where all required packages are installed already. The only required steps from this function is the webserver user and config file names, which can be applied directly instead since we know that the Pi-hole Docker container is based on Debian.
Furthermore this solves the issue that updating the APT cache fails, when Pi-hole itself is used for DNS resolution, since pihole-FTL has not yet been started at this stage. That failure was not visible since "apt-get update" does not exist with error code (currently) when facing DNS resolving issues, even if not a single list could have been updated, and no other step is done that would require DNS resolving, until pihole-FTL is started. For a regular (non-Docker) install or update it is however reasonable to error out directly when the APT cache could not have been updated, to not defer the exit unnecessarily to a harder-to-debug stage.
Motivation and Context
Related issue: pi-hole/pi-hole#3537
This PR included a change of the dependency package checks, so that this check required a successful "apt-get update" to check if an APT package is actually available in the installed repository, ready to be installed. The previously used method, which is now used again since the PR has been reverted, doesn't always require the APT cache but succeeds as well if the checked package is already installed, and even if another installed package has it listed as (optional) dependency or conflict or in any other way, which means that the old-new method fails the actual aim of the check in two ways. Since with the current list of supported distribution versions, these package checks are not required anymore, it is however not a major motivation for this pull request, but more the fact that most of what
distro_check
does either fails (silently) or takes a longer time (apt-get update) while it is not required.How Has This Been Tested?
Checklist: