mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-07-28 08:04:11 +02:00
Only update the package cache on fresh installations
Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
parent
4d4195ed4e
commit
ea61755881
@ -114,6 +114,7 @@ main() {
|
||||
|
||||
|
||||
# Install packages used by this installation script (necessary if users have removed e.g. git from their systems)
|
||||
check_fresh_install
|
||||
package_manager_detect
|
||||
build_dependency_package
|
||||
install_dependent_packages
|
||||
|
@ -231,6 +231,13 @@ is_command() {
|
||||
command -v "${check_command}" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
check_fresh_install() {
|
||||
# in case of an update (can be a v5 -> v6 or v6 -> v6 update) or repair
|
||||
if [[ -f "${PI_HOLE_V6_CONFIG}" ]] || [[ -f "/etc/pihole/setupVars.conf" ]]; then
|
||||
fresh_install=false
|
||||
fi
|
||||
}
|
||||
|
||||
# Compatibility
|
||||
package_manager_detect() {
|
||||
|
||||
@ -247,8 +254,10 @@ package_manager_detect() {
|
||||
PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true"
|
||||
# The command we will use to remove packages (used in the uninstaller)
|
||||
PKG_REMOVE="${PKG_MANAGER} -y remove --purge"
|
||||
# Update package cache
|
||||
update_package_cache || exit 1
|
||||
# Update package cache only on fresh installs
|
||||
if [[ "${fresh_install}" == true ]]; then
|
||||
update_package_cache || exit 1
|
||||
fi
|
||||
|
||||
# If apt-get is not found, check for rpm.
|
||||
elif is_command rpm; then
|
||||
@ -2193,6 +2202,9 @@ main() {
|
||||
# Check for availability of either the "service" or "systemctl" commands
|
||||
check_service_command
|
||||
|
||||
# Check if this is a fresh install or an update/repair
|
||||
check_fresh_install
|
||||
|
||||
# Check for supported package managers so that we may install dependencies
|
||||
package_manager_detect
|
||||
|
||||
@ -2216,10 +2228,7 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# in case of an update (can be a v5 -> v6 or v6 -> v6 update) or repair
|
||||
if [[ -f "${PI_HOLE_V6_CONFIG}" ]] || [[ -f "/etc/pihole/setupVars.conf" ]]; then
|
||||
# retain settings
|
||||
fresh_install=false
|
||||
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}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user