On Sun, Nov 29, 2009 at 11:44:56AM +0100, Andreas Barth wrote:
> * Junichi Uekawa (dan...@netfort.gr.jp) [091129 11:18]:
> > So, would 'mount -o bind ' to 'mount -tnullfs ' just work?

> > I don't have a kfreebsd instance handy to test this, so I would like
> > to make sure. It would be super if you could supply a patch that I
> > could patch in, but since there is no real code to support multiple
> > architectures in pbuilder, it might need a bit more infrastructure
> > change.
> 
> If you have a premilinary code with architecture support, I'm happy to
> test and adjust it (or just code the bsd parts into it if I know where
> I should code them into).
Hi,

I attached 5 small patches that fix the problem for me.

Best regards,

    Gonéri Le Bouder
From b39a4bb8d4dc53c5d8d6de731ca4a48b405328a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= <gon...@rulezlan.org>
Date: Thu, 26 Aug 2010 00:21:33 +0200
Subject: [PATCH 1/5] use linprocfs on kFreeBSD instead of proc

---
 pbuilder-modules |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index db6988b..ba4d1f3 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -230,10 +230,13 @@ function umountproc () {
 # Also create a policy-rc.d script if it doesn't already exist.
 function mountproc () {
     local -a mounted
+    DEB_BUILD_ARCH_OS=$(dpkg-architecture -qDEB_BUILD_ARCH_OS)
     if [ "$USEPROC" = "yes" ]; then
 	log "I: mounting /proc filesystem"
 	mkdir -p $BUILDPLACE/proc
-	mount -t proc /proc "$BUILDPLACE/proc"
+	PROCFS="proc"
+	[ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ] && PROCFS="linprocfs"
+	mount -t $PROCFS /proc "$BUILDPLACE/proc"
 	ln -s ../proc/mounts $BUILDPLACE/etc/mtab 2> /dev/null || true
 	mounted[${#mount...@]}]="$BUILDPLACE/proc"
     fi
-- 
1.7.1

From 4f02bebc0f09751296455cd7b4749d560f06fb68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= <gon...@rulezlan.org>
Date: Thu, 26 Aug 2010 00:55:42 +0200
Subject: [PATCH 2/5] /proc/sys/fs/binfmt_misc only exist on Linux

---
 pbuilder-modules |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index ba4d1f3..34e9fd3 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -218,7 +218,7 @@ function umountproc () {
 	umount_one "dev"
     fi
     if [ "$USEPROC" = "yes" ]; then
-	if [ -e $BUILDPLACE/proc/sys/fs/binfmt_misc/status ]; then
+	if [ "$DEB_BUILD_ARCH_OS" = "linux" ] && [ -e $BUILDPLACE/proc/sys/fs/binfmt_misc/status ]; then
 	    umount_one "proc/sys/fs/binfmt_misc"
 	fi
 	umount_one "proc"
-- 
1.7.1

From 8ab6b02f13d8216a9ff80e177b1661046ede0c8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= <gon...@rulezlan.org>
Date: Thu, 26 Aug 2010 00:20:23 +0200
Subject: [PATCH 3/5] umount the /sys filesystem on kFreeBSD

---
 pbuilder-modules |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index 34e9fd3..3c2be82 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -201,6 +201,7 @@ EOF
 function umountproc () {
     # push arguments on a stack to reverse direction.
     local reversed
+    DEB_BUILD_ARCH_OS=$(dpkg-architecture -qDEB_BUILD_ARCH_OS)
     reversed=
     for mnt in $BINDMOUNTS; do
 	reversed="$mnt $reversed"
@@ -223,6 +224,9 @@ function umountproc () {
 	fi
 	umount_one "proc"
     fi
+    if [ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ]; then
+        umount_one "sys"
+    fi
 }
 
 
-- 
1.7.1

From 4f2abc6e9d566eb2e4347e525c6fd7846b396a5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= <gon...@rulezlan.org>
Date: Thu, 26 Aug 2010 00:15:25 +0200
Subject: [PATCH 4/5] no devpts on non Linux system

---
 pbuilder-modules |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index 3c2be82..d4c0f89 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -212,7 +212,7 @@ function umountproc () {
     if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
 	umount_one "selinux"
     fi
-    if [ "$USEDEVPTS" = "yes" ]; then
+    if [ "$DEB_BUILD_ARCH_OS" = "linux" ] && [ "$USEDEVPTS" = "yes" ]; then
 	umount_one "dev/pts"
     fi
     if [ "$USEDEVFS" = "yes" ]; then
@@ -250,7 +250,7 @@ function mountproc () {
 	mount -t devfs /dev "$BUILDPLACE/dev" 
 	mounted[${#mount...@]}]="$BUILDPLACE/dev"
     fi
-    if [ "$USEDEVPTS" = "yes" ]; then
+    if [ "$DEB_BUILD_ARCH_OS" = "linux" ] && [ "$USEDEVPTS" = "yes" ]; then
 	log "I: mounting /dev/pts filesystem"
 	mkdir -p $BUILDPLACE/dev/pts || true
 	TTYGRP=5
-- 
1.7.1

From 7045298373a597dd42f368f10c57a374bf894271 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= <gon...@rulezlan.org>
Date: Thu, 26 Aug 2010 01:56:21 +0200
Subject: [PATCH 5/5] use nullfs for BINDMOUNTS

---
 pbuilder-modules |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index d4c0f89..a14fa67 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -265,10 +265,12 @@ function mountproc () {
 	mount -t selinuxfs /selinux "$BUILDPLACE/selinux"
 	mounted[${#mount...@]}]="$BUILDPLACE/selinux"
     fi
+    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 -obind "$mnt" "$BUILDPLACE/$mnt"; then
+	    mount $MOUNTPARAMS "$mnt" "$BUILDPLACE/$mnt"; then
 	    # successful.
 	    mounted[${#mount...@]}]="$mnt"
 	else
-- 
1.7.1

Reply via email to