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:
CanbiZ
2025-12-05 09:17:19 +01:00
committed by GitHub
parent eb53af44c9
commit e73f35e2c8
2 changed files with 15 additions and 6 deletions

View File

@@ -2954,15 +2954,14 @@ fix_gpu_gids() {
# For privileged containers: also fix permissions inside container
if [[ "$CT_TYPE" == "0" ]]; then
pct exec "$CTID" -- bash -c "
pct exec "$CTID" -- sh -c "
if [ -d /dev/dri ]; then
for dev in /dev/dri/*; do
if [ -e \"\$dev\" ]; then
if [[ \"\$dev\" =~ renderD ]]; then
chgrp ${render_gid} \"\$dev\" 2>/dev/null || true
else
chgrp ${video_gid} \"\$dev\" 2>/dev/null || true
fi
case \"\$dev\" in
*renderD*) chgrp ${render_gid} \"\$dev\" 2>/dev/null || true ;;
*) chgrp ${video_gid} \"\$dev\" 2>/dev/null || true ;;
esac
chmod 660 \"\$dev\" 2>/dev/null || true
fi
done