about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJieyou Xu <jieyouxu@outlook.com>2025-08-24 18:41:48 +0800
committerJieyou Xu <jieyouxu@outlook.com>2025-08-25 21:09:28 +0800
commitcce9479abd78695d28e3dfe255ce77d79d5aac04 (patch)
tree9e8c6b60fc49411f85de452c47f478c6b7802357 /src
parent4eedad312695d773b6e2e17a4f8082660470c101 (diff)
downloadrust-cce9479abd78695d28e3dfe255ce77d79d5aac04.tar.gz
rust-cce9479abd78695d28e3dfe255ce77d79d5aac04.zip
Wait for DPkg frontend lock when trying to remove packages
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ci/scripts/free-disk-space-linux.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ci/scripts/free-disk-space-linux.sh b/src/ci/scripts/free-disk-space-linux.sh
index 32649fe0d9b..ac3c9cfb28b 100755
--- a/src/ci/scripts/free-disk-space-linux.sh
+++ b/src/ci/scripts/free-disk-space-linux.sh
@@ -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.