From d468c005069db28e828da9c0ad2e6c7452398b5f Mon Sep 17 00:00:00 2001
From: Sebastien Luttringer <sebastien.luttringer@smartjog.com>
Date: Fri, 18 Nov 2011 13:15:09 +0100
Subject: [PATCH] chroot preparation doesn't mount on a mountpoint

this already more easy unchrooting after failure by chrooting again,
solving issue and exiting (which remove mounts again)
---
 installsystems/tools.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/installsystems/tools.py b/installsystems/tools.py
index 00ea201..1e7d5cb 100644
--- a/installsystems/tools.py
+++ b/installsystems/tools.py
@@ -365,7 +365,9 @@ def prepare_chroot(path, mount=True):
         for mp in mps:
             origin =  "/%s" % mp
             target = os.path.join(path, mp)
-            if os.path.ismount(origin) and os.path.isdir(target):
+            if os.path.ismount(target):
+                warn("%s is already a mountpoint, skipped" % target)
+            elif os.path.ismount(origin) and os.path.isdir(target):
                 arrow("%s -> %s" % (origin, target), 1)
                 try:
                     check_call(["mount",  "--bind", origin, target], close_fds=True)
-- 
GitLab