aboutsummaryrefslogtreecommitdiff
path: root/pbuilder-modules
diff options
context:
space:
mode:
authordancer <dancer>2003-08-08 21:47:13 +0000
committerdancer <dancer>2003-08-08 21:47:13 +0000
commit2eb6c002c64a210a9e7afa2dfd21904d7529583e (patch)
tree651514578d5cda4c46b581b442184f3512e5a21c /pbuilder-modules
parentc43a4f2b7fd890534d5dc464519ee00651719451 (diff)
downloadpbuilder-2eb6c002c64a210a9e7afa2dfd21904d7529583e.tar
pbuilder-2eb6c002c64a210a9e7afa2dfd21904d7529583e.tar.gz
0.80
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 71fbfea..1619f0e 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -136,6 +136,22 @@ function mountproc () {
done
}
+## function to clean subdirs, use instead of rm -r
+function clean_subdirectories () {
+ if [ -z "$1" ]; then
+ echo "Fatal internal error in clean_subdirectories"
+ exit 1;
+ fi
+ if [ ! -d "$1" ]; then
+ echo "Warning: directory $1 does not exist in clean_subdirectories"
+ return;
+ fi
+ echo " -> removing directory $1 and its subdirectories"
+ find "$1" \( \! -type d \) -a -xdev -print0 |xargs -0 rm -f
+ find "$1" -type d -xdev -depth -print0 | \
+ (xargs -0 rmdir || true)
+}
+
function cleanbuildplace () {
if [ "$?" -ne 0 ]; then
echo " -> Aborting with an error";
@@ -143,9 +159,7 @@ function cleanbuildplace () {
if [ "${INTERNAL_BUILD_UML}" != "yes" ]; then
if [ -d "$BUILDPLACE" ]; then
echo " -> cleaning the build env "
- find "$BUILDPLACE" \( \! -type d \) -a -xdev -print0 |xargs -0 rm -f
- find "$BUILDPLACE" -type d -xdev -depth -print0 |(xargs -0 \
- rmdir || true)
+ clean_subdirectories "$BUILDPLACE"
fi;
fi
}