From 59e348fc3c5dd086331d884a6dd76fb43a92b7eb Mon Sep 17 00:00:00 2001
From: WorMzy Tykashi <wormzy.tykashi@gmail.com>
Date: Mon, 16 Sep 2013 00:35:37 +0100
Subject: [PATCH] Add mountpoint check to btrfs subvol logic

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
---
 makechrootpkg.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/makechrootpkg.in b/makechrootpkg.in
index 00e538a..2309be2 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -142,7 +142,7 @@ create_chroot() {
 		slock 8 "$chrootdir/root.lock" "Locking clean chroot"
 
 		stat_busy "Creating clean working copy [$copy]"
-		if [[ "$chroottype" == btrfs ]]; then
+		if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
 			if [[ -d $copydir ]]; then
 				btrfs subvolume delete "$copydir" >/dev/null ||
 					die "Unable to delete subvolume %s" "$copydir"
-- 
GitLab