Update tools.func

This commit is contained in:
CanbiZ
2025-11-22 13:20:18 +01:00
parent 053e5ab128
commit e05a351712

View File

@@ -3671,16 +3671,16 @@ EOF
return 1 return 1
fi fi
# Build module list - don't pre-check, let apt-get handle it # Build module list - without version pinning (preferences.d handles it)
local MODULE_LIST="php${PHP_VERSION}=${AVAILABLE_PHP_VERSION}-*" local MODULE_LIST="php${PHP_VERSION}"
IFS=',' read -ra MODULES <<<"$COMBINED_MODULES" IFS=',' read -ra MODULES <<<"$COMBINED_MODULES"
for mod in "${MODULES[@]}"; do for mod in "${MODULES[@]}"; do
MODULE_LIST+=" php${PHP_VERSION}-${mod}=${AVAILABLE_PHP_VERSION}-*" MODULE_LIST+=" php${PHP_VERSION}-${mod}"
done done
if [[ "$PHP_FPM" == "YES" ]]; then if [[ "$PHP_FPM" == "YES" ]]; then
MODULE_LIST+=" php${PHP_VERSION}-fpm=${AVAILABLE_PHP_VERSION}-*" MODULE_LIST+=" php${PHP_VERSION}-fpm"
fi fi
# install apache2 with PHP support if requested # install apache2 with PHP support if requested
@@ -3691,17 +3691,14 @@ EOF
msg_error "Failed to install Apache" msg_error "Failed to install Apache"
return 1 return 1
} }
install_packages_with_retry "libapache2-mod-php${PHP_VERSION}=${AVAILABLE_PHP_VERSION}-*" || { install_packages_with_retry "libapache2-mod-php${PHP_VERSION}" || {
msg_warn "Failed to install libapache2-mod-php${PHP_VERSION}, continuing without Apache module" msg_warn "Failed to install libapache2-mod-php${PHP_VERSION}, continuing without Apache module"
} }
fi fi
fi fi
# Install PHP packages with explicit version constraints # Install PHP packages (pinning via preferences.d ensures correct version)
msg_info "Installing PHP ${PHP_VERSION} packages (version ${AVAILABLE_PHP_VERSION})"
if ! install_packages_with_retry $MODULE_LIST; then if ! install_packages_with_retry $MODULE_LIST; then
msg_warn "Failed to install PHP packages with version constraints, attempting individual installation"
# Install main package first (critical) # Install main package first (critical)
install_packages_with_retry "php${PHP_VERSION}" || { install_packages_with_retry "php${PHP_VERSION}" || {
msg_error "Failed to install php${PHP_VERSION}" msg_error "Failed to install php${PHP_VERSION}"
@@ -3710,25 +3707,19 @@ EOF
# Try to install Apache module individually if requested # Try to install Apache module individually if requested
if [[ "$PHP_APACHE" == "YES" ]]; then if [[ "$PHP_APACHE" == "YES" ]]; then
install_packages_with_retry "libapache2-mod-php${PHP_VERSION}" || { install_packages_with_retry "libapache2-mod-php${PHP_VERSION}" || true
msg_warn "Could not install libapache2-mod-php${PHP_VERSION}"
}
fi fi
# Try to install modules individually - skip those that don't exist # Try to install modules individually - skip those that don't exist
for pkg in "${MODULES[@]}"; do for pkg in "${MODULES[@]}"; do
if apt-cache search "^php${PHP_VERSION}-${pkg}\$" 2>/dev/null | grep -q "^php${PHP_VERSION}-${pkg}"; then if apt-cache search "^php${PHP_VERSION}-${pkg}\$" 2>/dev/null | grep -q "^php${PHP_VERSION}-${pkg}"; then
install_packages_with_retry "php${PHP_VERSION}-${pkg}" || { install_packages_with_retry "php${PHP_VERSION}-${pkg}" || true
msg_warn "Could not install php${PHP_VERSION}-${pkg}"
}
fi fi
done done
if [[ "$PHP_FPM" == "YES" ]]; then if [[ "$PHP_FPM" == "YES" ]]; then
if apt-cache search "^php${PHP_VERSION}-fpm\$" 2>/dev/null | grep -q "^php${PHP_VERSION}-fpm"; then if apt-cache search "^php${PHP_VERSION}-fpm\$" 2>/dev/null | grep -q "^php${PHP_VERSION}-fpm"; then
install_packages_with_retry "php${PHP_VERSION}-fpm" || { install_packages_with_retry "php${PHP_VERSION}-fpm" || true
msg_warn "Could not install php${PHP_VERSION}-fpm"
}
fi fi
fi fi
fi fi