tag 560332 patch
thanks

Cyril Brulebois <k...@debian.org> (10/12/2009):
>  - but even then, removing the temporary directory failed because
>    /sys was still mounted. Which led me to believe it might be nicer
>    if pbuilder could check where /sys is not empty, and umounting
>    accordingly if needed (umount $path/sys). The same could be said
>    about /proc, I guess. Maybe controlling this umount behaviour
>    through a configuration option?

(I know there's USEPROC already, by the way, but wanted to make sure
to exclude /proc from the base tarball, there's no point in having
anything /proc-related in the base tarball, I guess.)

Please find attached a patch which implements this. I didn't test it
much, I can only tell you it's possible to create a base.tgz on
kfreebsd-amd64 once it's applied, and with this configuration:
| USEPROC=no
| USEDEVFS=yes
| USEDEVPTS=no

I've also successfully built some packages of mine (which were failing
with USEDEVFS=no, because of at least missing /dev/null).

It's probably not perfect, but that should help people interested in
trying out package building on GNU/kFreeBSD, until a clean solution is
implemented.

Mraw,
KiBi.
From abdb507312a1557b8059fa59e2181f8a2d9af204 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <k...@debian.org>
Date: Fri, 11 Dec 2009 05:43:22 +0100
Subject: [PATCH] Introduce umount_proc_sys().

This function ensures /proc and /sys are not mounted before packing the
base tarball.

Signed-off-by: Cyril Brulebois <k...@debian.org>
---
 pbuilder-modules |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index 8f604eb..90f3c1c 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -484,6 +484,7 @@ function create_basetgz() {
 	    log "I: Someone else has lock over ${BASETGZ}.tmp, waiting"
 	    sleep 10s
 	done
+	umount_proc_sys .
 	log "I: creating base tarball [${BASETGZ}]"
 	if ! tar cfz "${BASETGZ}.tmp" * ; then
 	    log "E: failed building base tarball"
@@ -494,6 +495,16 @@ function create_basetgz() {
     )
 }
 
+function umount_proc_sys() {
+    dir="$1"
+    for i in proc sys; do
+	if [ $(find $dir/$i | wc -l) -gt 1 ]; then
+	    log "I: $dir/$i seems mounted, umounting"
+	    umount $dir/$i
+	fi
+    done
+}
+
 function copyinputfile() {
     # copy files to inside chroot, copy all files specified by INPUTFILE[] parameter.
     TARGETDIR="$1"
-- 
1.6.5.4

Attachment: signature.asc
Description: Digital signature

Reply via email to