aboutsummaryrefslogtreecommitdiff
path: root/pbuilder-createbuildenv
diff options
context:
space:
mode:
authordancer <dancer>2002-01-27 12:27:03 +0000
committerdancer <dancer>2002-01-27 12:27:03 +0000
commit076f814f3d8216a1a7f63dbf7c8e0522d05965ad (patch)
tree410f7970803ebf245ebb3711419ff325758b22e2 /pbuilder-createbuildenv
parent2947553d0cf463a35e29313b3397a7d4119803bb (diff)
downloadpbuilder-076f814f3d8216a1a7f63dbf7c8e0522d05965ad.tar
pbuilder-076f814f3d8216a1a7f63dbf7c8e0522d05965ad.tar.gz
modified the cleaning process to the one using trap, for create, update, and login methods.
build is not modified (yet)
Diffstat (limited to 'pbuilder-createbuildenv')
-rwxr-xr-xpbuilder-createbuildenv10
1 files changed, 8 insertions, 2 deletions
diff --git a/pbuilder-createbuildenv b/pbuilder-createbuildenv
index 7ad8cff..3cee940 100755
--- a/pbuilder-createbuildenv
+++ b/pbuilder-createbuildenv
@@ -11,6 +11,7 @@ if [ -z "$DISTRIBUTION" ]; then
fi
echo "Distribution is $DISTRIBUTION."
+# first clean it.
cleanbuildplace
echo "Building the build environment"
@@ -19,6 +20,8 @@ if [ ! -d "$BUILDPLACE" ]; then
echo "pbuilder: Could not make directory [$BUILDPLACE]" >&2
exit 1
fi
+trap cleanbuildplace exit
+
echo " -> running debootstrap"
DEBOOTSTRAPSCRIPT=""
if [ -n "$HOOKDIR" ]; then
@@ -29,7 +32,6 @@ if [ -n "$HOOKDIR" ]; then
fi
if ! ( cd "$BUILDPLACE" && debootstrap "$DISTRIBUTION" . "$MIRRORSITE" "$DEBOOTSTRAPSCRIPT" ) ; then
echo "pbuilder: debootstrap failed" >&2
- cleanbuildplace
exit 1
fi
@@ -51,6 +53,7 @@ installaptlines
echo "Refreshing the base.tgz "
echo " -> upgrading packages"
mountproc
+trap umountproc_cleanbuildplace exit
$CHROOTEXEC /usr/bin/apt-get update
if [ -n "$REMOVEPACKAGES" ]; then
$CHROOTEXEC /usr/bin/dpkg --purge $REMOVEPACKAGES
@@ -62,8 +65,11 @@ if [ -n "$HOOKDIR" ]; then
executehooks "X"
unloadhooks
fi
+
umountproc
+trap cleanbuildplace exit
+
echo " -> creating base.tgz"
( cd "$BUILDPLACE" && tar cfz "$BASETGZ" * || echo " -> failed building base.tgz")
-cleanbuildplace
+