aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pbuilder-runhooks2
-rw-r--r--pdebuild-internal22
2 files changed, 21 insertions, 3 deletions
diff --git a/pbuilder-runhooks b/pbuilder-runhooks
index cbc3113..33b522e 100644
--- a/pbuilder-runhooks
+++ b/pbuilder-runhooks
@@ -88,7 +88,7 @@ function executehooks () {
*)
if [ -x "$fn" ]; then
log "I: user script $fn starting"
- $CHROOTEXEC "$hooks/"$(basename "$fn")
+ $CHROOTEXEC "/$hooks/"$(basename "$fn")
log "I: user script $fn finished"
else
if [ -f "$fn" ]; then
diff --git a/pdebuild-internal b/pdebuild-internal
index d309c51..173bfb9 100644
--- a/pdebuild-internal
+++ b/pdebuild-internal
@@ -77,9 +77,25 @@ while [ -n "$1" ]; do
esac
done
-# fool pbuilder-runhooks to use / as buildplace, since I am inside chroot.
-BUILDPLACE=/
+# Calling pbuilder-runhooks; we try to fix up enough to fool
+# pbuilder-runhooks. The following source call depends on
+# pbuilder-runhook inside the chroot, which might be different from
+# the version outside the chroot.
. /usr/lib/pbuilder/pbuilder-runhooks
+# fool pbuilder-runhooks to use / as buildplace, since I am already
+# inside chroot.
+BUILDPLACE=/
+# chroot command will just chroot to /, which will effectively chdir
+# to / and nothing else.
+CHROOTEXEC="chroot $BUILDPLACE "
+# make HOOKDIR contain something if there is a hook, to fool HOOKDIR
+# check inside pbuilder-runhooks that there is HOOKDIR
+# configuration. We don't call loadhooks or unloadhooks ourselves,
+# pbuilder execute will do that for you, so we should be okay.
+# TODO: handle when --hookdir was not initially specified.
+if [ -d "/$hookdir" ]; then
+ HOOKDIR="/$hookdir"
+fi
executehooks "D"
export PBCURRENTCOMMANDLINEOPERATION="pdebuild"
@@ -97,6 +113,8 @@ executehooks "A"
# do build with that user.
export DEBBUILDOPTS
+# This command should be ran with current directory as bind-mounted
+# package source directory
if echo /usr/bin/dpkg-buildpackage -rfakeroot -us -uc '${DEBBUILDOPTS}' | \
su -p pbuser;
then