From aef3ce42a35d827830a029223296a71c73d8c341 Mon Sep 17 00:00:00 2001
From: Julian <deadbeef@outlook.de>
Date: Wed, 19 Mar 2025 20:57:41 +0000
Subject: [PATCH] Remove the pacstrap directory early to lower the maximum size
 of the working directory

---
 CHANGELOG.rst     | 2 ++
 archiso/mkarchiso | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 5d6b50c0..0c95080b 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -11,6 +11,8 @@ Added
 Changed
 -------
 
+- Remove the pacstrap directory early to lower the maximum size of the working directory.
+
 Deprecated
 ----------
 
diff --git a/archiso/mkarchiso b/archiso/mkarchiso
index 553d0d2a..de7bf016 100755
--- a/archiso/mkarchiso
+++ b/archiso/mkarchiso
@@ -1704,6 +1704,13 @@ _build_bootstrap_image() {
 
 # Build ISO
 _build_iso_image() {
+    # Remove the pacstrap directory early to lower the maximum size of the working directory.
+    # The creation of the airootfs image has already been completed.
+    if (( rm_work_dir )); then
+        _msg_info 'Removing pacstrap directory...'
+        rm -rf -- "${work_dir:?}/${arch}/airootfs"
+    fi
+
     local xorriso_options=() xorrisofs_options=()
     local bootmode
 
-- 
GitLab