[buildd-tools-devel] Bug#566513: schroot: GNU/kFreeBSD support

Aurelien Jarno aurel32 at debian.org
Sat Jan 23 17:39:51 UTC 2010


Package: schroot
Version: 1.4.0-1
Severity: normal
Tags: patch

Please find below a patch to support GNU/kFreeBSD. I don't know how you
plan to deal with architecture specific changes in scripts, so I have
decided to just modify them in this patch. With it I have been able to
get schroot working in plain, directory, block device and loopback modes.
I haven't tested the other modes yet.

Some more explanation about this patch: on FreeBSD, storage devices
appear as character devices, hence the changes in tests for block
devices.

--- schroot-1.4.0.orig/sbuild/sbuild-chroot-block-device.cc
+++ schroot-1.4.0/sbuild/sbuild-chroot-block-device.cc
@@ -123,7 +123,11 @@
 
   try
     {
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+      if (!stat(this->get_device()).is_character())
+#else
       if (!stat(this->get_device()).is_block())
+#endif
 	{
 	  throw error(get_device(), DEVICE_NOTBLOCK);
 	}
--- schroot-1.4.0.orig/etc/mount-defaults
+++ schroot-1.4.0/etc/mount-defaults
@@ -3,10 +3,9 @@
 # (CHROOT_PATH)
 #
 # <file system>	<mount point>	<type>	<options>	<dump>	<pass>
-proc		/proc		proc	defaults	0	0
+proc		/proc		linprocfs defaults	0	0
 #procbususb      /proc/bus/usb   usbfs   defaults        0       0
-#/dev            /dev            none    rw,bind         0       0
-/dev/pts	/dev/pts	none	rw,bind		0	0
-/dev/shm	/dev/shm	none	rw,bind		0	0
-/home		/home		none	rw,bind		0	0
-/tmp		/tmp		none	rw,bind		0	0
+dev             /dev            devfs   rw,bind         0       0
+dev             /dev/fd         fdescfs rw,bind         0       0
+/home		/home		nullfs	rw		0	0
+/tmp		/tmp		nullfs	rw		0	0
only in patch2:
unchanged:
--- schroot-1.4.0.orig/etc/setup.d/10mount
+++ schroot-1.4.0/etc/setup.d/10mount
@@ -104,22 +104,17 @@
     fi
 
     if [ "$CHROOT_TYPE" = "directory" ]; then
-	CHROOT_MOUNT_OPTIONS="--bind"
+	CHROOT_MOUNT_OPTIONS="-t nullfs"
 	CHROOT_MOUNT_DEVICE="$CHROOT_DIRECTORY"
     elif [ "$CHROOT_TYPE" = "file" ]; then
 	UNPACK_LOCATION="${UNPACK_DIR}/${SESSION_ID}"
-	CHROOT_MOUNT_OPTIONS="--bind"
+	CHROOT_MOUNT_OPTIONS="-t nullfs"
 	CHROOT_MOUNT_DEVICE="${CHROOT_FILE_UNPACK_DIR}/${SESSION_ID}"
 
     elif [ "$CHROOT_TYPE" = "loopback" ]; then
-	LOOP_DEVICE="$(/sbin/losetup -j "$CHROOT_FILE" | sed -e 's/:.*$//')"
-	if [ -z "$LOOP_DEVICE" ]; then
-	    CHROOT_MOUNT_DEVICE="$CHROOT_FILE"
-	    CHROOT_MOUNT_OPTIONS="${CHROOT_MOUNT_OPTIONS},loop"
-	else
-	    CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
-	    CHROOT_MOUNT_OPTIONS=""
-	fi
+	LOOP_DEVICE="/dev/$(/sbin/mdconfig -a -t vnode -f "$CHROOT_FILE")"
+	CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
+	CHROOT_MOUNT_OPTIONS=""
     fi
 
     if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
only in patch2:
unchanged:
--- schroot-1.4.0.orig/etc/setup.d/00check
+++ schroot-1.4.0/etc/setup.d/00check
@@ -116,7 +116,7 @@
 	fi
 	;;
     block-device | lvm-snapshot)
-	if [ ! -b "$CHROOT_DEVICE" ]; then
+	if [ ! -c "$CHROOT_DEVICE" ]; then
 	    echo "Device '$CHROOT_DEVICE' does not exist"
 	    exit 1
 	fi

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 8.0-1-amd64
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages schroot depends on:
ii  libboost-filesystem1.40.0     1.40.0-6   filesystem operations (portable pa
ii  libboost-program-options1.40. 1.40.0-6   program options library for C++
ii  libboost-regex1.40.0          1.40.0-6   regular expression library for C++
ii  libboost-system1.40.0         1.40.0-6   Operating system (e.g. diagnostics
ii  libc0.1                       2.10.2-5   Embedded GNU C Library: Shared lib
ii  libgcc1                       1:4.4.3-1  GCC support library
ii  liblockdev1                   1.0.3-1.3  Run-time shared library for lockin
ii  libpam0g                      1.1.0-4    Pluggable Authentication Modules l
ii  libstdc++6                    4.4.3-1    The GNU Standard C++ Library v3
ii  libuuid1                      2.16.2-0   Universally Unique ID library
ii  schroot-common                1.4.0-1    common files for schroot

schroot recommends no packages.

Versions of packages schroot suggests:
pn  aufs-modules | unionfs-module <none>     (no description available)
ii  debootstrap                   1.0.20     Bootstrap a basic Debian system
pn  lvm2                          <none>     (no description available)
ii  unzip                         6.0-1      De-archiver for .zip files

-- no debconf information





More information about the Buildd-tools-devel mailing list