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