Wait for DPkg frontend lock when trying to remove packages

This commit is contained in:
Jieyou Xu 2025-08-24 18:41:48 +08:00
parent 4eedad3126
commit cce9479abd
No known key found for this signature in database
GPG Key ID: 045B995028EA6AFC

View File

@ -221,10 +221,13 @@ cleanPackages() {
)
fi
sudo apt-get -qq remove -y --fix-missing "${packages[@]}"
WAIT_DPKG_LOCK="-o DPkg::Lock::Timeout=60"
sudo apt-get ${WAIT_DPKG_LOCK} -qq remove -y --fix-missing "${packages[@]}"
sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed"
sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed failed"
sudo apt-get ${WAIT_DPKG_LOCK} autoremove -y \
|| echo "::warning::The command [sudo apt-get autoremove -y] failed"
sudo apt-get ${WAIT_DPKG_LOCK} clean \
|| echo "::warning::The command [sudo apt-get clean] failed"
}
# Remove Docker images.