[pbuilder] 02/02: modules: support specifying BINDMOUNTS destination

Mattia Rizzolo mattia at debian.org
Wed May 25 17:44:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository pbuilder.

commit e76e1e91797582fb138f494ed3d0cfe1aba3c4ce
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Wed May 25 17:43:14 2016 +0000

    modules: support specifying BINDMOUNTS destination
    
    Thanks: Austin Phillips <austin.phillips at ceos.com.au> for the initial patch
    
    Closes: #593100
---
 pbuilder-modules | 15 +++++++++++----
 pbuilderrc.5     | 11 +++++++----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index 54ef55f..5b4ed85 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -224,7 +224,7 @@ function umountproc () {
         reversed="$mnt $reversed"
     done
     for mnt in $reversed; do
-        umount_one "$mnt"
+        umount_one "${mnt#*:}"
     done
     if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
         umount_one "$(grep -m 1 ^selinuxfs /proc/mounts | cut -d ' ' -f 2)"
@@ -271,6 +271,7 @@ function umountproc () {
 # Also create a policy-rc.d script if it doesn't already exist.
 function mountproc () {
     local -a mounted
+    local mnt mntpoint
     if [ "$USEPROC" = "yes" ]; then
         log.i "mounting /proc filesystem"
         mkdir -p "$BUILDPLACE/proc"
@@ -330,9 +331,15 @@ function mountproc () {
     MOUNTPARAMS="-obind"
     [ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ] && MOUNTPARAMS="-t nullfs"
     for mnt in $BINDMOUNTS; do
-        log.i "Mounting $mnt"
-        if mkdir -p "$BUILDPLACE/$mnt" &&
-            mount $MOUNTPARAMS "$mnt" "$BUILDPLACE/$mnt"; then
+        mntpoint=${mnt#*:}
+        mnt=${mnt%%:*}
+        if [ "$mnt" = "$mntpoint" ]; then
+            log.i "Mounting $mnt"
+        else
+            log.i "Mounting $mnt to $mntpoint"
+        fi
+        if mkdir -p "$BUILDPLACE/$mntpoint" &&
+            mount -obind "$mnt" "$BUILDPLACE/$mntpoint"; then
             # successful.
             mounted[${#mounted[@]}]="$BUILDPLACE/$mnt"
         else
diff --git a/pbuilderrc.5 b/pbuilderrc.5
index 1907855..a25ac93 100644
--- a/pbuilderrc.5
+++ b/pbuilderrc.5
@@ -62,15 +62,18 @@ chroot image to be created and used.
 This is overridden with the option
 .BR "\-\-basetgz" "."
 .TP
-.BI "BINDMOUNTS=" "directories-to-bind-mount"
+.BI "BINDMOUNTS=" "directories-to-bind-mount[:internal-mountpoint]"
 When this value is set, pbuilder will mount these directories using
-bind-mount. Do not bind-mount
-.B "/"
+bind-mount.  Different directories are space separated, a column can optionally
+specify a mount destination inside the chroot.
+.br
+Do not bind-mount
+.BR "/" .
 .br
 An Example:
 
 .EX
-BINDMOUNTS="/home /mnt/test"
+BINDMOUNTS="/home /mnt/test /home/joe/repo:/var/repo"
 .EE
 .TP
 .BI "BUILDDIR=" "/build"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pbuilder/pbuilder.git



More information about the Pbuilder-maint mailing list