aboutsummaryrefslogtreecommitdiff
path: root/pbuilder-modules
diff options
context:
space:
mode:
authorSteve M. Robbins <steve@sumost.ca>2010-12-31 17:24:36 -0600
committerJunichi Uekawa <dancer@netfort.gr.jp>2011-06-24 19:29:54 +0900
commitb8ba16bbb5354d65c6857df64b8488578ca648f7 (patch)
tree85fed23ddde2226f92d44e388c38a7bcdc6177d9 /pbuilder-modules
parentc3ecceb7767e49733bcc7f8c85a1ec43a00e581b (diff)
downloadpbuilder-b8ba16bbb5354d65c6857df64b8488578ca648f7.tar
pbuilder-b8ba16bbb5354d65c6857df64b8488578ca648f7.tar.gz
Bug#542915: NMU patch
Hi, The patch for this NMU is as follows.
Diffstat (limited to 'pbuilder-modules')
-rw-r--r--pbuilder-modules20
1 files changed, 17 insertions, 3 deletions
diff --git a/pbuilder-modules b/pbuilder-modules
index db6988b..aa3fc2a 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -319,9 +319,23 @@ function cleanbuildplace () {
log "W: Aborting with an error";
fi
if [ "${INTERNAL_BUILD_UML}" != "yes" ]; then
- if [ -d "$BUILDPLACE" ]; then
- log "I: cleaning the build env "
- clean_subdirectories "$BUILDPLACE"
+ if [ -d "$BUILDPLACE" ]; then
+ # A directory on the same partition as $BUILDPLACE, bind-mounted
+ # into $BUILDPLACE, will be cleaned out by clean_subdirectories
+ # (because -xdev doesn't know about bind mounts). To avoid that
+ # potential disaster (and also to avoid ugly error messages from
+ # rmdir otherwise), we want to make sure that there is *nothing*
+ # mounted under the chroot before we do our bulldozer routine.
+ #
+ # The readlink -f is a simple way to canonicalize the path for
+ # $BUILDPLACE (no dirty double slashes for *us*), so it matches
+ # what will be in the output of mount.
+ if mount |grep -q -F " $(readlink -f $BUILDPLACE)/"; then
+ log "E: Something is still mounted under ${BUILDPLACE}; unmount and remove ${BUILDPLACE} manually"
+ else
+ log "I: cleaning the build env "
+ clean_subdirectories "$BUILDPLACE"
+ fi
fi;
fi
}