From 167e29229fe975ca16ff8fba26e7e2d83dfc653b Mon Sep 17 00:00:00 2001
From: Erich Eckner <git@eckner.net>
Date: Mon, 20 May 2019 13:12:20 +0200
Subject: bin/build-packages: :clean_chroot: sets -c for makepkg, which may be
 insufficient for removing still mounted submounts (e.g. /run) - we now run
 recursively_umount_and_rm to (hopefully) clean the build chroot entirely

---
 bin/build-packages | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'bin/build-packages')

diff --git a/bin/build-packages b/bin/build-packages
index 46dcff5..73279f9 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -524,6 +524,14 @@ while [ "${count}" -ne 0 ] && \
         find . -maxdepth 1 -type f \( -name '*.pkg.tar.xz' -o -name '*.pkg.tar.xz.sig' \) -exec \
           rm {} \;
 
+        if echo "${outerParameters}" | \
+          grep -qwF -- '-c'; then
+          # sometimes it is necessary to manually remove the root/ build
+          # directory (due to leftover mounts of /run) - so we just do
+          # it everytime '-c' is set
+          recursively_umount_and_rm '/var/lib/archbuild/'"${build_command%-build}"
+        fi
+
         echo 'building' > "${tmp_dir}/.ping-build-master"
         >&2 printf '%s: building package "%s" (revisions %s %s, repository %s, straw %s) for %s ...' \
           "$(date +'%Y-%m-%d %T')" \
-- 
cgit v1.2.3-70-g09d2