mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-19 17:02:16 +00:00
var. core fixes (bash to sh in fix_gpu_gids ...) (#9666)
* Switch container exec from bash to sh in fix_gpu_gids Replaces bash with sh for container execution in fix_gpu_gids and updates device matching logic to use a POSIX-compliant case statement. This improves compatibility with containers that may not have bash installed. * fix(apt): auto-recover from interrupted dpkg operations When a previous installation is interrupted (e.g., by script error or user cancellation), dpkg can be left in an inconsistent state requiring 'dpkg --configure -a' to fix. This change: - Adds dpkg --configure -a check to ensure_apt_working() - Adds dpkg --configure -a to retry logic in install_packages_with_retry() - Adds dpkg --configure -a to retry logic in upgrade_packages_with_retry() Fixes: Omada Controller update failing after interrupted installation Reported-in: #9663
This commit is contained in:
@@ -192,6 +192,8 @@ install_packages_with_retry() {
|
||||
if [[ $retry -le $max_retries ]]; then
|
||||
msg_warn "Package installation failed, retrying ($retry/$max_retries)..."
|
||||
sleep 2
|
||||
# Fix any interrupted dpkg operations before retry
|
||||
$STD dpkg --configure -a 2>/dev/null || true
|
||||
$STD apt update 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
@@ -217,6 +219,8 @@ upgrade_packages_with_retry() {
|
||||
if [[ $retry -le $max_retries ]]; then
|
||||
msg_warn "Package upgrade failed, retrying ($retry/$max_retries)..."
|
||||
sleep 2
|
||||
# Fix any interrupted dpkg operations before retry
|
||||
$STD dpkg --configure -a 2>/dev/null || true
|
||||
$STD apt update 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
@@ -1182,6 +1186,12 @@ cleanup_orphaned_sources() {
|
||||
# This should be called at the start of any setup function
|
||||
# ------------------------------------------------------------------------------
|
||||
ensure_apt_working() {
|
||||
# Fix interrupted dpkg operations first
|
||||
# This can happen if a previous installation was interrupted (e.g., by script error)
|
||||
if [[ -f /var/lib/dpkg/lock-frontend ]] || dpkg --audit 2>&1 | grep -q "interrupted"; then
|
||||
$STD dpkg --configure -a 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Clean up orphaned sources first
|
||||
cleanup_orphaned_sources
|
||||
|
||||
|
||||
Reference in New Issue
Block a user