Bug#526471: [PATCH] run hooks inside the chroot root (Closes: #526471)

Francesco Poli (t1000) frx at firenze.linux.it
Thu Jul 16 21:17:03 UTC 2009


Fix "pdebuild-internal fails to execute hook scripts": set HOOKDIR and
invoke executehooks inside the chroot root (in pdebuild-internal).
---
 AUTHORS           |    1 +
 pdebuild-internal |   14 ++++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 77d0885..87c7817 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -12,4 +12,5 @@ Henrique de Moraes Holschuh <hmh at debian.org> -- portion of pbuilder-satisfydepen
 Daniel Schepler <schepler at math.berkeley.edu> -- many patches, --preserve-buildplace
 Sam Hartman <hartmans at debian.org> -- bind-mount patch
 Mattia Dongili <malattia at linux.it> -- user-mode-linux support
+Francesco Poli <frx at firenze.linux.it> -- pdebuild-internal execute hook patch
 
diff --git a/pdebuild-internal b/pdebuild-internal
index ce624b2..1cff0f0 100644
--- a/pdebuild-internal
+++ b/pdebuild-internal
@@ -1,6 +1,7 @@
 #! /bin/bash
 #   pbuilder-internal -- personal Debian package builder, internal routine
 #   Copyright (C) 2003-2007 Junichi Uekawa
+#   Copyright (C) 2008-2009 Francesco Poli
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -77,11 +78,16 @@ while [ -n "$1" ]; do
     esac
 done
 
+# set the temporary hook directory as HOOKDIR, if present
+hooks=tmp/hooks
+if [ -d "/$hooks" ]; then
+    HOOKDIR="/$hooks"
+fi
 # fool pbuilder-runhooks to use / as buildplace, since I am inside chroot.
 BUILDPLACE=
 . /usr/lib/pbuilder/pbuilder-runhooks
 
-executehooks "D"
+(cd / && executehooks "D")
 export PBCURRENTCOMMANDLINEOPERATION="pdebuild"
 "$PBUILDERSATISFYDEPENDSCMD"
 apt-get install -y --force-yes fakeroot
@@ -93,7 +99,7 @@ useradd -g pbgroup -u "${BUILDRESULTUID}" -o pbuser
 # what about id -G output? if other groups than the designated is used, we're stuffed.
 export HOME=$(pwd)/../
 
-executehooks "A"
+(cd / && executehooks "A")
 
 # do build with that user.
 export DEBBUILDOPTS
@@ -103,8 +109,8 @@ if echo /usr/bin/dpkg-buildpackage -rfakeroot -us -uc '${DEBBUILDOPTS}' | \
     # build was successful
     :
 else
-    executehooks "C"
+    (cd / && executehooks "C")
     exit 1
 fi
 
-executehooks "B"
+(cd / && executehooks "B")
-- 
1.6.3.3






More information about the Pbuilder-maint mailing list