]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Do disk space cleanup asynchronously
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 15 Mar 2024 19:25:01 +0000 (20:25 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 15 Mar 2024 20:31:25 +0000 (05:31 +0900)
This can actually take a rather long time (multiple minutes) so
make sure we do it asynchronously.

.github/workflows/mkosi.yml

index a71ae3fd39b5ab53ea53543122baf5ea6a130b69..f9df0a22bad0069f8773a4df31251e5c9235019b 100644 (file)
@@ -78,10 +78,14 @@ jobs:
     - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
     - uses: systemd/mkosi@1445b389750af22756c0fde6facc1f2f343340b4
 
+    # Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
+    # immediately, we remove the files in the background. However, we first move them to a different location
+    # so that nothing tries to use anything in these directories anymore while we're busy deleting them.
     - name: Free disk space
       run: |
-        sudo rm -rf /usr/local
-        sudo rm -rf /opt/hostedtoolcache
+        sudo mv /usr/local /usr/local.trash
+        sudo mv /opt/hostedtoolcache /opt/hostedtoolcache.trash
+        sudo systemd-run rm -rf /usr/local.trash /opt/hostedtoolcache.trash
 
     - name: Configure
       run: |