aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-06-17 19:21:48 +0000
committerMattia Rizzolo <mattia@mapreri.org>2015-06-17 20:31:24 +0000
commitad50ac00a531dbe60260c63760388ce6dac12361 (patch)
treee45df26ce8c8c6b90ece685231bf86df2acc75f1
parent935740912f47d9dc9f0ea337a3a11cc5f0a9e988 (diff)
downloadpbuilder-ad50ac00a531dbe60260c63760388ce6dac12361.tar
pbuilder-ad50ac00a531dbe60260c63760388ce6dac12361.tar.gz
import 0.125+nmu3
-rw-r--r--Makefile1
-rw-r--r--debian/changelog10
-rw-r--r--debian/control1
-rwxr-xr-xpbuilder-buildpackage15
-rwxr-xr-xpbuilder-unshare-wrapper21
5 files changed, 41 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 299498b..170f78d 100644
--- a/Makefile
+++ b/Makefile
@@ -58,6 +58,7 @@ PKGLIB_SCRIPTS += \
pbuilder-satisfydepends-gdebi \
pbuilder-selftest \
pbuilder-uml-checkparams \
+ pbuilder-unshare-wrapper \
pbuilder-updatebuildenv \
pdebuild-checkparams \
pdebuild-internal \
diff --git a/debian/changelog b/debian/changelog
index aa5296a..a73cf63 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+pbuilder (0.215+nmu3) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Enable the loopback device even when USE_NETWORK=no (Closes: #753944)
+ Patch based on one provided by Niko Tyni; thanks! This also allows
+ getting rid of the “env” hack and disabling network for pre-squeeze
+ chroot by setting the new namespace up before chrooting.
+
+ -- Thorsten Glaser <tg@mirbsd.de> Fri, 11 Jul 2014 19:56:53 +0200
+
pbuilder (0.215+nmu2) unstable; urgency=low
* Fix missing space, thanks gregoa for spotting (Closes: #753690)
diff --git a/debian/control b/debian/control
index f4a1f94..fe53932 100644
--- a/debian/control
+++ b/debian/control
@@ -27,6 +27,7 @@ Depends: coreutils (>= 4.5.8-1),
wget,
${misc:Depends}
Recommends: fakeroot,
+ net-tools | iproute2,
sudo,
devscripts
Suggests: pbuilder-uml,
diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage
index 2158cbe..78f028b 100755
--- a/pbuilder-buildpackage
+++ b/pbuilder-buildpackage
@@ -37,7 +37,7 @@ if [ -n "$BUILDUSERNAME" -a -n "$BUILDUSERID" ]; then
# environment, so cowdancer shouldn't have to run, and fakeroot
# should be running later, so it shouldn't matter.
# LOGNAME: set this to shut up some tools.
- SUTOUSER=" env LD_PRELOAD= LOGNAME=$BUILDUSERNAME /sbin/start-stop-daemon --start --pidfile /dev/null --chuid $BUILDUSERNAME --startas /bin/sh"
+ SUTOUSER="LD_PRELOAD= LOGNAME=$BUILDUSERNAME /sbin/start-stop-daemon --start --pidfile /dev/null --chuid $BUILDUSERNAME --startas /bin/sh"
DEBBUILDOPTS="${DEBBUILDOPTS:+$DEBBUILDOPTS }-rfakeroot"
EXTRAPACKAGES="${EXTRAPACKAGES} fakeroot"
log "I: using fakeroot in build."
@@ -45,9 +45,10 @@ else
# run the build in root
BUILDUSERID=0
BUILDUSERNAME=root
- SUTOUSER=" env LOGNAME=$BUILDUSERNAME /bin/sh"
+ SUTOUSER="LOGNAME=$BUILDUSERNAME /bin/sh"
fi
+UNSHARE=
case $USENETWORK in
yes)
if [ "$DEB_BUILD_ARCH_OS" = "linux" ]; then
@@ -56,9 +57,9 @@ yes)
fi
;;
*)
- if $CHROOTEXEC /usr/bin/unshare -n true; then
+ if /usr/bin/unshare -n -- /usr/lib/pbuilder/pbuilder-unshare-wrapper true; then
USENETWORK=no
- SUTOUSER="/usr/bin/unshare -n -- $SUTOUSER"
+ UNSHARE="/usr/bin/unshare -n -- /usr/lib/pbuilder/pbuilder-unshare-wrapper"
log "I: pbuilder: network access will be disabled during build"
else
USENETWORK=yes
@@ -115,7 +116,7 @@ recover_aptcache
createbuilduser
CCACHE_ENV=
setup_ccache
-SUTOUSER=${SUTOUSER/ env / env $CCACHE_ENV }
+SUTOUSER="$CCACHE_ENV $SUTOUSER"
log "I: Installing the build-deps"
executehooks "D"
trap saveaptcache_umountproc_cleanbuildplace_trap exit sighup sigpipe
@@ -134,7 +135,7 @@ else
log "E: pbuilder: Failed chowning to $BUILDUSERNAME:$BUILDUSERNAME"
exit 1;
fi
-if echo "( cd tmp/buildd; env PATH=\"$PATH\" /usr/bin/dpkg-source -x $(basename $PACKAGENAME) )" | $CHROOTEXEC $SUTOUSER ; then
+if echo "( cd tmp/buildd; env PATH=\"$PATH\" /usr/bin/dpkg-source -x $(basename $PACKAGENAME) )" | $UNSHARE $CHROOTEXEC env $SUTOUSER ; then
: # success
else
log "E: pbuilder: Failed extracting the source"
@@ -154,7 +155,7 @@ DPKG_COMMANDLINE="env PATH=\"$PATH\" dpkg-buildpackage -us -uc ${DEBEMAIL:+\"-e$
fi
DPKG_COMMANDLINE="cd tmp/buildd/*/ && $DPKG_COMMANDLINE"
log "I: Running $DPKG_COMMANDLINE"
- echo "$DPKG_COMMANDLINE" | $CHROOTEXEC $SUTOUSER
+ echo "$DPKG_COMMANDLINE" | $UNSHARE $CHROOTEXEC env $SUTOUSER
) &
BUILD_PID=$!
if [ -n "${TIMEOUT_TIME}" ]; then
diff --git a/pbuilder-unshare-wrapper b/pbuilder-unshare-wrapper
new file mode 100755
index 0000000..ffa25c8
--- /dev/null
+++ b/pbuilder-unshare-wrapper
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+die() {
+ echo >&@ E: $2 returned error code $1
+ echo >&2 N: Could not set up the loopback interface.
+ exit 1
+}
+
+if test -x /sbin/ifconfig; then
+ /sbin/ifconfig lo up || die $? ifconfig
+elif test -x /sbin/ip; then
+ /sbin/ip link set lo up || die $? ip
+elif test -x /bin/ip; then
+ /bin/ip link set lo up || die $? ip
+else
+ echo >&2 E: Neither ifconfig nor ip found.
+ echo >&2 N: Could not set up the loopback interface.
+ exit 1
+fi
+
+exec "$@"