[Collab-qa-commits] r1719 - in debcluster/configs/schroot: . default setup.d

Lucas Nussbaum lucas at alioth.debian.org
Sat Mar 13 09:18:00 UTC 2010


Author: lucas
Date: 2010-03-13 09:17:59 +0000 (Sat, 13 Mar 2010)
New Revision: 1719

Added:
   debcluster/configs/schroot/default/
   debcluster/configs/schroot/default/config
   debcluster/configs/schroot/default/copyfiles
   debcluster/configs/schroot/default/fstab
   debcluster/configs/schroot/default/nssdatabases
   debcluster/configs/schroot/nssdatabases-defaults
   debcluster/configs/schroot/setup.d/05union
   debcluster/configs/schroot/setup.d/20nssdatabases
   debcluster/configs/schroot/setup.d/99check
Removed:
   debcluster/configs/schroot/exec.d/
Modified:
   debcluster/configs/schroot/copyfiles-defaults
   debcluster/configs/schroot/mount-defaults
   debcluster/configs/schroot/schroot.conf
   debcluster/configs/schroot/script-defaults
   debcluster/configs/schroot/setup.d/00check
   debcluster/configs/schroot/setup.d/05file
   debcluster/configs/schroot/setup.d/05lvm
   debcluster/configs/schroot/setup.d/10mount
   debcluster/configs/schroot/setup.d/15killprocs
   debcluster/configs/schroot/setup.d/20copyfiles
Log:
update schroot config

Modified: debcluster/configs/schroot/copyfiles-defaults
===================================================================
--- debcluster/configs/schroot/copyfiles-defaults	2010-03-13 09:11:27 UTC (rev 1718)
+++ debcluster/configs/schroot/copyfiles-defaults	2010-03-13 09:17:59 UTC (rev 1719)
@@ -1,5 +1,5 @@
-/etc/group
-/etc/hosts
-/etc/passwd
+# Files to copy into the chroot from the host system.
+#
+# <source and destination>
 /etc/resolv.conf
-/etc/shadow
+/etc/gshadow

Added: debcluster/configs/schroot/default/config
===================================================================
--- debcluster/configs/schroot/default/config	                        (rev 0)
+++ debcluster/configs/schroot/default/config	2010-03-13 09:17:59 UTC (rev 1719)
@@ -0,0 +1,11 @@
+# Default settings for chroot setup and exec scripts.
+# See schroot-script-config(5) for further details.
+
+# Filesystems to mount inside the chroot.
+FSTAB="/etc/schroot/default/fstab"
+
+# Files to copy from the host system into the chroot.
+COPYFILES="/etc/schroot/default/copyfiles"
+
+# System NSS databases to copy into the chroot.
+NSSDATABASES="/etc/schroot/default/nssdatabases"

Added: debcluster/configs/schroot/default/copyfiles
===================================================================
--- debcluster/configs/schroot/default/copyfiles	                        (rev 0)
+++ debcluster/configs/schroot/default/copyfiles	2010-03-13 09:17:59 UTC (rev 1719)
@@ -0,0 +1,5 @@
+# Files to copy into the chroot from the host system.
+#
+# <source and destination>
+/etc/resolv.conf
+/etc/gshadow

Added: debcluster/configs/schroot/default/fstab
===================================================================
--- debcluster/configs/schroot/default/fstab	                        (rev 0)
+++ debcluster/configs/schroot/default/fstab	2010-03-13 09:17:59 UTC (rev 1719)
@@ -0,0 +1,12 @@
+# fstab: static file system information for chroots.
+# Note that the mount point will be prefixed by the chroot path
+# (CHROOT_PATH)
+#
+# <file system>	<mount point>	<type>	<options>	<dump>	<pass>
+proc		/proc		proc	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

Added: debcluster/configs/schroot/default/nssdatabases
===================================================================
--- debcluster/configs/schroot/default/nssdatabases	                        (rev 0)
+++ debcluster/configs/schroot/default/nssdatabases	2010-03-13 09:17:59 UTC (rev 1719)
@@ -0,0 +1,10 @@
+# System databases to copy into the chroot from the host system.
+#
+# <database name>
+passwd
+shadow
+group
+services
+protocols
+networks
+hosts

Modified: debcluster/configs/schroot/mount-defaults
===================================================================
--- debcluster/configs/schroot/mount-defaults	2010-03-13 09:11:27 UTC (rev 1718)
+++ debcluster/configs/schroot/mount-defaults	2010-03-13 09:17:59 UTC (rev 1719)
@@ -1,10 +1,12 @@
-# mount.defaults: static file system information for chroots.
+# fstab: static file system information for chroots.
 # Note that the mount point will be prefixed by the chroot path
 # (CHROOT_PATH)
 #
 # <file system>	<mount point>	<type>	<options>	<dump>	<pass>
 proc		/proc		proc	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
-tmpfs		/dev/shm	tmpfs	defaults	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

Added: debcluster/configs/schroot/nssdatabases-defaults
===================================================================
--- debcluster/configs/schroot/nssdatabases-defaults	                        (rev 0)
+++ debcluster/configs/schroot/nssdatabases-defaults	2010-03-13 09:17:59 UTC (rev 1719)
@@ -0,0 +1,10 @@
+# System databases to copy into the chroot from the host system.
+#
+# <database name>
+passwd
+shadow
+group
+services
+protocols
+networks
+hosts

Modified: debcluster/configs/schroot/schroot.conf
===================================================================
--- debcluster/configs/schroot/schroot.conf	2010-03-13 09:11:27 UTC (rev 1718)
+++ debcluster/configs/schroot/schroot.conf	2010-03-13 09:17:59 UTC (rev 1719)
@@ -75,23 +75,50 @@
 description=Debian sid 64 bits
 file=/dc/data/chroots/sid64.tgz
 priority=2
-run-setup-scripts=true
 root-users=user
 
+[sid64b]
+type=file
+description=Debian sid 64 bits
+file=/dc/data/chroots/sid64b.tgz
+priority=2
+root-users=user
+
+
+[sid64-quilt]
+type=file
+description=Debian sid 64 bits
+file=/dc/data/chroots/sid64-quilt.tgz
+priority=2
+root-users=user
+
 [lsid64]
 type=file
 description=Debian sid 32 bits
 file=/debscratch/chroots/sid64.tgz
 priority=2
-run-setup-scripts=true
 root-users=user
 
+[lsid64b]
+type=file
+description=Debian sid 32 bits
+file=/debscratch/chroots/sid64b.tgz
+priority=2
+root-users=user
+
+
+[lsid64-quilt]
+type=file
+description=Debian sid 32 bits
+file=/debscratch/chroots/sid64-quilt.tgz
+priority=2
+root-users=user
+
 [sid32-dpkg]
 type=file
 description=Debian sid 32 bits
 file=/dc/data/chroots/sid32-dpkg.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
@@ -101,7 +128,6 @@
 description=Debian sid 32 bits
 file=/dc/data/chroots/sid32-dash.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
@@ -110,7 +136,6 @@
 description=Debian sid 32 bits
 file=/dc/data/chroots/sid32-im.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
@@ -119,7 +144,6 @@
 description=Debian sid 32 bits
 file=/dc/data/chroots/sid32.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 aliases=unstable
@@ -130,7 +154,6 @@
 description=Debian sid 32 bits
 file=/debscratch/chroots/sid32.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
@@ -139,7 +162,6 @@
 description=Debian sid 32 bits
 file=/dc/data/chroots/lenny32-gcc.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
@@ -149,7 +171,6 @@
 description=Debian sid 32 bits
 file=/dc/data/chroots/lenny32.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
@@ -158,7 +179,6 @@
 description=Debian sid 32 bits
 file=/debscratch/chroots/lenny32.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
@@ -167,7 +187,6 @@
 description=Debian sid 32 bits
 file=/dc/data/chroots/etch32.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
@@ -176,7 +195,6 @@
 description=Debian sid 32 bits
 file=/dc/data/chroots/etch32-piuparts.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
@@ -185,69 +203,59 @@
 description=Debian sid 32 bits
 file=/dc/data/chroots/lenny32-piuparts.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
-[intrepid32]
+[lucid32]
 type=file
 description=Debian sid 32 bits
-file=/dc/data/chroots/intrepid32.tgz
+file=/dc/data/chroots/lucid32.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
-[intrepid32-toolchain]
+[llucid32]
 type=file
 description=Debian sid 32 bits
-file=/dc/data/chroots/intrepid32-toolchain.tgz
+file=/debscratch/chroots/lucid32.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
-[intrepidlp]
+[lucidlp]
 type=file
 description=Debian sid 32 bits
-file=/dc/data/chroots/intrepidlp.tgz
+file=/dc/data/chroots/lucidlp.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
 
-[intrepid64]
+[llucidlp]
 type=file
 description=Debian sid 32 bits
-file=/dc/data/chroots/intrepid64.tgz
+file=/debscratch/chroots/lucidlp.tgz
 priority=2
-run-setup-scripts=true
+personality=linux32
 root-users=user
 
-[sid32-piuparts]
+[lucid64]
 type=file
 description=Debian sid 32 bits
-file=/dc/data/chroots/sid32-piuparts.tgz
+file=/dc/data/chroots/lucid64.tgz
 priority=2
-run-setup-scripts=true
-personality=linux32
 root-users=user
 
-[sid32-bdfh]
-type=directory
+[llucid64]
+type=file
 description=Debian sid 32 bits
-location=/mnt/bdfh-tmp
+file=/debscratch/chroots/lucid64.tgz
 priority=2
-run-setup-scripts=true
-personality=linux32
 root-users=user
 
-[sid32-bdfh-src]
-type=directory
+[sid32-piuparts]
+type=file
 description=Debian sid 32 bits
-location=/mnt/root-bdfh
+file=/dc/data/chroots/sid32-piuparts.tgz
 priority=2
-run-setup-scripts=true
 personality=linux32
 root-users=user
-

Modified: debcluster/configs/schroot/script-defaults
===================================================================
--- debcluster/configs/schroot/script-defaults	2010-03-13 09:11:27 UTC (rev 1718)
+++ debcluster/configs/schroot/script-defaults	2010-03-13 09:17:59 UTC (rev 1719)
@@ -2,14 +2,10 @@
 # See schroot-script-config(5) for further details.
 
 # Filesystems to mount inside the chroot.
-FSTAB="/etc/schroot/mount-defaults"
+FSTAB="/etc/schroot/default/fstab"
 
 # Files to copy from the host system into the chroot.
-COPYFILES="/etc/schroot/copyfiles-defaults"
+COPYFILES="/etc/schroot/default/copyfiles"
 
-# Is sbuild installed?
-if [ -x /usr/bin/sbuild ]; then
-  SBUILD="true"
-else
-  SBUILD="false"
-fi
+# System NSS databases to copy into the chroot.
+NSSDATABASES="/etc/schroot/default/nssdatabases"

Modified: debcluster/configs/schroot/setup.d/00check
===================================================================
--- debcluster/configs/schroot/setup.d/00check	2010-03-13 09:11:27 UTC (rev 1718)
+++ debcluster/configs/schroot/setup.d/00check	2010-03-13 09:17:59 UTC (rev 1719)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright © 2005-2007  Roger Leigh <rleigh at debian.org>
+# Copyright © 2005-2009  Roger Leigh <rleigh at debian.org>
 #
 # schroot is free software: you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -19,6 +19,12 @@
 
 set -e
 
+# Plain chroots should not be able to use scripts, but check anyway to
+# be safe.
+if [ $CHROOT_TYPE = "plain" ]; then
+    exit 1
+fi
+
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
     . "$CHROOT_SCRIPT_CONFIG"
 elif [ "$2" = "ok" ]; then
@@ -26,74 +32,123 @@
     exit 1
 fi
 
-if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
+# Skip if run at inappropriate point.
+if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ] && [ "$(basename "$0")" = "99check" ]; then
+    exit 0;
+elif [ $1 = "setup-stop" ] && [ "$(basename "$0")" = "00check" ]; then
+    exit 0;
+fi
 
-    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-	echo "AUTH_USER=$AUTH_USER"
-	echo "AUTH_VERBOSITY=$AUTH_VERBOSITY"
-	echo "MOUNT_DIR=$MOUNT_DIR"
-	echo "LIBEXEC_DIR=$LIBEXEC_DIR"
-	echo "PID=$PID"
-	echo "SESSION_ID=$SESSION_ID"
-	echo "CHROOT_TYPE=$CHROOT_TYPE"
-	echo "CHROOT_NAME=$CHROOT_NAME"
-	echo "CHROOT_DESCRIPTION=$CHROOT_DESCRIPTION"
-	echo "CHROOT_SCRIPT_CONFIG=$CHROOT_SCRIPT_CONFIG"
-	echo "CHROOT_MOUNT_LOCATION=$CHROOT_MOUNT_LOCATION"
-	echo "CHROOT_LOCATION=$CHROOT_LOCATION"
-	echo "CHROOT_PATH=$CHROOT_PATH"
-	echo "CHROOT_MOUNT_DEVICE=$CHROOT_MOUNT_DEVICE"
-	if [ "$CHROOT_TYPE" = "plain" ] || [ "$CHROOT_TYPE" = "directory" ]; then
-	    :
-	elif [ "$CHROOT_TYPE" = "file" ]; then
-	    echo "CHROOT_FILE=$CHROOT_FILE"
-	    echo "CHROOT_FILE_REPACK=$CHROOT_FILE_REPACK"
-	elif [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
-	    echo "CHROOT_DEVICE=$CHROOT_DEVICE"
-	    echo "CHROOT_MOUNT_OPTIONS=$CHROOT_MOUNT_OPTIONS"
-	    if [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
-		echo "CHROOT_LVM_SNAPSHOT_NAME=$CHROOT_LVM_SNAPSHOT_NAME"
-		echo "CHROOT_LVM_SNAPSHOT_DEVICE=$CHROOT_LVM_SNAPSHOT_DEVICE"
-		echo "CHROOT_LVM_SNAPSHOT_OPTIONS=$CHROOT_LVM_SNAPSHOT_OPTIONS"
-	    fi
+if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+    echo "AUTH_USER=$AUTH_USER"
+    echo "AUTH_RUSER=$AUTH_RUSER"
+    echo "AUTH_RGROUP=$AUTH_RGROUP"
+    echo "AUTH_UID=$AUTH_UID"
+    echo "AUTH_GID=$AUTH_GID"
+    echo "AUTH_RUID=$AUTH_RUID"
+    echo "AUTH_RGID=$AUTH_RGID"
+    echo "AUTH_HOME=$AUTH_HOME"
+    echo "AUTH_SHELL=$AUTH_SHELL"
+    echo "AUTH_VERBOSITY=$AUTH_VERBOSITY"
+    echo "MOUNT_DIR=$MOUNT_DIR"
+    echo "LIBEXEC_DIR=$LIBEXEC_DIR"
+    echo "PID=$PID"
+    echo "HOST=$HOST"
+    echo "HOST_OS=$HOST_OS"
+    echo "HOST_VENDOR=$HOST_VENDOR"
+    echo "HOST_CPU=$HOST_CPU"
+    echo "PLATFORM=$PLATFORM"
+    echo "SESSION_ID=$SESSION_ID"
+    echo "CHROOT_TYPE=$CHROOT_TYPE"
+    echo "CHROOT_NAME=$CHROOT_NAME"
+    echo "CHROOT_DESCRIPTION=$CHROOT_DESCRIPTION"
+    echo "CHROOT_SCRIPT_CONFIG=$CHROOT_SCRIPT_CONFIG"
+    echo "CHROOT_MOUNT_LOCATION=$CHROOT_MOUNT_LOCATION"
+    echo "CHROOT_LOCATION=$CHROOT_LOCATION"
+    echo "CHROOT_PATH=$CHROOT_PATH"
+    if [ -n "$CHROOT_UNION_TYPE" ] && [ "$CHROOT_UNION_TYPE" != "none" ]; then
+	echo "CHROOT_UNION_TYPE=$CHROOT_UNION_TYPE"
+	echo "CHROOT_UNION_OVERLAY_DIRECTORY=$CHROOT_UNION_OVERLAY_DIRECTORY"
+	echo "CHROOT_UNION_UNDERLAY_DIRECTORY=$CHROOT_UNION_UNDERLAY_DIRECTORY"
+    fi
+    if [ "$CHROOT_TYPE" = "directory" ]; then
+	echo "CHROOT_DIRECTORY=$CHROOT_DIRECTORY"
+    elif [ "$CHROOT_TYPE" = "file" ]; then
+	echo "CHROOT_FILE=$CHROOT_FILE"
+	echo "CHROOT_FILE_REPACK=$CHROOT_FILE_REPACK"
+	echo "CHROOT_FILE_UNPACK_DIR=$CHROOT_FILE_UNPACK_DIR"
+    elif [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+	echo "CHROOT_DEVICE=$CHROOT_DEVICE"
+	echo "CHROOT_MOUNT_OPTIONS=$CHROOT_MOUNT_OPTIONS"
+	if [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+	    echo "CHROOT_LVM_SNAPSHOT_NAME=$CHROOT_LVM_SNAPSHOT_NAME"
+	    echo "CHROOT_LVM_SNAPSHOT_DEVICE=$CHROOT_LVM_SNAPSHOT_DEVICE"
+	    echo "CHROOT_LVM_SNAPSHOT_OPTIONS=$CHROOT_LVM_SNAPSHOT_OPTIONS"
 	fi
-	echo "CHROOT_SESSION_CREATE=$CHROOT_SESSION_CREATE"
-	echo "CHROOT_SESSION_CLONE=$CHROOT_SESSION_CLONE"
-	echo "CHROOT_SESSION_PURGE=$CHROOT_SESSION_PURGE"
-        echo "FSTAB=$FSTAB"
-        echo "SBUILD=$SBUILD"
     fi
+    echo "CHROOT_SESSION_CREATE=$CHROOT_SESSION_CREATE"
+    echo "CHROOT_SESSION_CLONE=$CHROOT_SESSION_CLONE"
+    echo "CHROOT_SESSION_PURGE=$CHROOT_SESSION_PURGE"
+    echo "FSTAB=$FSTAB"
+    echo "NSSDATABASES=$NSSDATABASES"
+fi
 
-    case "$CHROOT_TYPE" in
-	plain | directory)
-	    if [ ! -d "$CHROOT_LOCATION" ]; then
-		echo "Directory '$CHROOT_LOCATION' does not exist"
+case "$CHROOT_TYPE" in
+    directory)
+	if [ ! -d "$CHROOT_DIRECTORY" ]; then
+	    echo "Directory '$CHROOT_DIRECTORY' does not exist"
+	    exit 1
+	fi
+	if [ "$CHROOT_UNION_TYPE" != "none" ]; then
+	    if [ ! -d "$CHROOT_UNION_OVERLAY_DIRECTORY" ] \
+		&& [ $1 = "setup-recover" ];
+	    then
+		echo "Directory '$CHROOT_UNION_OVERLAY_DIRECTORY' does not exist"
 		exit 1
 	    fi
-	    ;;
-	file | loopback)
-	    if [ ! -f "$CHROOT_FILE" ]; then
-		echo "File '$CHROOT_FILE' does not exist"
+	    if [ ! -d "$CHROOT_UNION_UNDERLAY_DIRECTORY" ] \
+		    && [ $1 = "setup-recunder" ];
+		then
+		echo "Directory '$CHROOT_UNION_UNDERLAY_DIRECTORY' does not exist"
 		exit 1
 	    fi
-	    ;;
-	block-device | lvm-snapshot)
-	    if [ ! -b "$CHROOT_DEVICE" ]; then
-		echo "Device '$CHROOT_DEVICE' does not exist"
-		exit 1
-	    fi
-	    ;;
-	*)
-	    echo "Unknown chroot type $CHROOT_TYPE"
+	fi
+	;;
+    file | loopback)
+	if [ ! -f "$CHROOT_FILE" ]; then
+	    echo "File '$CHROOT_FILE' does not exist"
 	    exit 1
-	    ;;
-    esac
+	fi
+	;;
+    block-device | lvm-snapshot)
+	case "$HOST_OS" in
+	    freebsd* | k*bsd*-gnu) :
+		DEVTYPE="-c"
+		;;
+	    *):
+		DEVTYPE="-b"
+		;;
+	esac
 
-    # A basic safety check, so that the root filesystem doesn't get
-    # toasted by accident.
-    if [ -z "$CHROOT_PATH" ] || [ "$CHROOT_PATH" = "/" ] || [ "$CHROOT_LOCATION" = "/" ]; then
-	echo "Invalid chroot mount location: '$CHROOT_LOCATION'"
+	if [ ! "$DEVTYPE" "$CHROOT_DEVICE" ]; then
+	    echo "Device '$CHROOT_DEVICE' does not exist"
+	    exit 1
+	fi
+	;;
+    *)
+	echo "Unknown chroot type $CHROOT_TYPE"
 	exit 1
-    fi
+	;;
+esac
 
+# A basic safety check, so that the root filesystem doesn't get
+# toasted by accident.
+if [ -z "$CHROOT_PATH" ] \
+    || [ "$CHROOT_PATH" = "/" ] \
+    || ( [ -z "$CHROOT_UNION_TYPE" ] \
+         && [ "$CHROOT_DIRECTORY" = "/" ] ) \
+    || [ "$CHROOT_UNION_OVERLAY_DIRECTORY" = "/" ]
+then
+    echo "Invalid chroot mount path or directory"
+    exit 1
 fi

Modified: debcluster/configs/schroot/setup.d/05file
===================================================================
--- debcluster/configs/schroot/setup.d/05file	2010-03-13 09:11:27 UTC (rev 1718)
+++ debcluster/configs/schroot/setup.d/05file	2010-03-13 09:17:59 UTC (rev 1719)
@@ -97,35 +97,39 @@
 
     check_filetype
 
+    UNPACK_LOCATION="${CHROOT_FILE_UNPACK_DIR}/${SESSION_ID}"
+
     if [ $1 = "setup-start" ]; then
 
-        if [ ! -d "$CHROOT_MOUNT_LOCATION" ]; then
-	    mkdir -p "$CHROOT_MOUNT_LOCATION"
+	if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+	    echo "File unpack directory: $UNPACK_LOCATION"
+	fi
+        if [ ! -d "$UNPACK_LOCATION" ]; then
+	    mkdir -p "$UNPACK_LOCATION"
+	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+		echo "Created file unpack directory: $UNPACK_LOCATION"
+	    fi
         fi
-	cd "$CHROOT_MOUNT_LOCATION"
+	cd "$UNPACK_LOCATION"
+	if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+	    echo "Changed CWD to $UNPACK_LOCATION"
+	fi
 
 	unpack_file
 
     elif [ "$1" = "setup-stop" ]; then
 
 	if [ "$2" = "ok" ] && [ "$CHROOT_FILE_REPACK" = "true" ]; then
-	    cd "$CHROOT_MOUNT_LOCATION" && repack_file
+	    cd "$UNPACK_LOCATION" && repack_file
 	fi
 
-	"$LIBEXEC_DIR/schroot-listmounts" -m "$CHROOT_MOUNT_LOCATION" |
-	while read mountloc; do
-	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-		echo "Not purging $CHROOT_MOUNT_LOCATION; filesystems are mounted:"
-		"$LIBEXEC_DIR/schroot-listmounts" -m "$CHROOT_MOUNT_LOCATION"
-	    fi
-	    exit 1
-	done || exit 1
-
 	if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
 	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-		echo "Purging $CHROOT_MOUNT_LOCATION"
+		echo "Purging $UNPACK_LOCATION"
 	    fi
-	    rm -rf "$CHROOT_MOUNT_LOCATION"
+	    if [ -d "$UNPACK_LOCATION" ]; then
+		rm -rf "$UNPACK_LOCATION"
+	    fi
 	fi
 
     fi

Modified: debcluster/configs/schroot/setup.d/05lvm
===================================================================
--- debcluster/configs/schroot/setup.d/05lvm	2010-03-13 09:11:27 UTC (rev 1718)
+++ debcluster/configs/schroot/setup.d/05lvm	2010-03-13 09:17:59 UTC (rev 1719)
@@ -35,11 +35,11 @@
     if [ $1 = "setup-start" ]; then
 
 	if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-	    lvcreate $VERBOSE $CHROOT_LVM_SNAPSHOT_OPTIONS --snapshot \
-		--name "$CHROOT_LVM_SNAPSHOT_NAME" "$CHROOT_DEVICE"
+	    lvcreate $VERBOSE --snapshot --name "$CHROOT_LVM_SNAPSHOT_NAME" \
+		"$CHROOT_DEVICE" $CHROOT_LVM_SNAPSHOT_OPTIONS
 	else
-	    lvcreate $VERBOSE $CHROOT_LVM_SNAPSHOT_OPTIONS --snapshot \
-		--name "$CHROOT_LVM_SNAPSHOT_NAME" "$CHROOT_DEVICE" > /dev/null
+	    lvcreate $VERBOSE --snapshot --name "$CHROOT_LVM_SNAPSHOT_NAME" \
+		"$CHROOT_DEVICE" $CHROOT_LVM_SNAPSHOT_OPTIONS > /dev/null
 	fi
 
     elif [ $1 = "setup-stop" ]; then
@@ -65,7 +65,7 @@
 	    # The block device no longer exists, or was never created,
 	    # for example on lvcreate failure.
 	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-		echo "W: $CHROOT_LVM_SNAPSHOT_DEVICE does not exist"
+		echo "$CHROOT_LVM_SNAPSHOT_DEVICE does not exist"
 	    fi
 	fi
 

Added: debcluster/configs/schroot/setup.d/05union
===================================================================
--- debcluster/configs/schroot/setup.d/05union	                        (rev 0)
+++ debcluster/configs/schroot/setup.d/05union	2010-03-13 09:17:59 UTC (rev 1719)
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Copyright © 2008-2009  Jan-Marek Glogowski <glogow at fbihome.de>
+#
+# schroot is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# schroot is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#####################################################################
+
+set -e
+
+if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
+    . "$CHROOT_SCRIPT_CONFIG"
+fi
+
+if [ -n "${CHROOT_UNION_TYPE}" ] && [ "${CHROOT_UNION_TYPE}" != 'none' ]; then
+
+    if [ $1 = "setup-start" ]; then
+	mkdir "${CHROOT_UNION_OVERLAY_DIRECTORY}"
+	if [ ! -d "$CHROOT_UNION_OVERLAY_DIRECTORY" ]; then
+	    echo "$CHROOT_UNION_OVERLAY_DIRECTORY does not exist, and could not be created"
+	    exit 1
+	fi
+
+	mkdir "${CHROOT_UNION_UNDERLAY_DIRECTORY}"
+	if [ ! -d "$CHROOT_UNION_UNDERLAY_DIRECTORY" ]; then
+	    echo "$CHROOT_UNION_UNDERLAY_DIRECTORY does not exist, and could not be created"
+	    exit 1
+	fi
+
+    elif [ $1 = "setup-recover" ]; then
+        if [ ! -d "${CHROOT_UNION_OVERLAY_DIRECTORY}" ]; then
+	    echo "Missing overlay directory for session: can't recover"
+	    exit 1
+        fi
+        if [ ! -d "${CHROOT_UNION_UNDERLAY_DIRECTORY}" ]; then
+	    echo "Missing underlay directory for session: can't recover"
+	    exit 1
+        fi
+
+    elif [ $1 = "setup-stop" ]; then
+        if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
+	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+		echo "Purging $CHROOT_UNION_OVERLAY_DIRECTORY"
+	    fi
+	    if [ -d "${CHROOT_UNION_OVERLAY_DIRECTORY}" ]; then
+		rm -rf "${CHROOT_UNION_OVERLAY_DIRECTORY}"
+	    fi
+
+	    # For safety, use rmdir rather than rm -rf in case
+	    # umount failed.
+	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+		echo "Removing $CHROOT_UNION_UNDERLAY_DIRECTORY"
+	    fi
+	    if [ -d "${CHROOT_UNION_UNDERLAY_DIRECTORY}" ]; then
+		rmdir "${CHROOT_UNION_UNDERLAY_DIRECTORY}"
+	    fi
+	fi
+    fi
+
+fi
+


Property changes on: debcluster/configs/schroot/setup.d/05union
___________________________________________________________________
Added: svn:executable
   + *

Modified: debcluster/configs/schroot/setup.d/10mount
===================================================================
--- debcluster/configs/schroot/setup.d/10mount	2010-03-13 09:11:27 UTC (rev 1718)
+++ debcluster/configs/schroot/setup.d/10mount	2010-03-13 09:17:59 UTC (rev 1719)
@@ -1,5 +1,6 @@
 #!/bin/sh
-# Copyright © 2005-2007  Roger Leigh <rleigh at debian.org>
+# Copyright © 2005-2009  Roger Leigh <rleigh at debian.org>
+# Copyright © 2009       Jan-Marek Glogowski <glogow at fbihome.de>
 #
 # schroot is free software: you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -65,23 +66,78 @@
     fi
 }
 
+# Mount a filesystem union
+# $1: the mount location
+do_mount_fs_union()
+{
+    # Prepare mount options (branch config) for union type
+    if [ -z "$CHROOT_UNION_MOUNT_OPTIONS" ]; then
+	case $CHROOT_UNION_TYPE in
+	    unionfs)
+		CHROOT_UNION_MOUNT_OPTIONS="dirs=${CHROOT_UNION_OVERLAY_DIRECTORY}=rw,${CHROOT_UNION_UNDERLAY_DIRECTORY}=ro"
+		;;
+	    aufs)
+		CHROOT_UNION_MOUNT_OPTIONS="br:${CHROOT_UNION_OVERLAY_DIRECTORY}:${CHROOT_UNION_UNDERLAY_DIRECTORY}=ro"
+		;;
+	esac
+    fi
+
+    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+	echo "Using '$CHROOT_UNION_TYPE' for filesystem union"
+    fi
+
+    # Try mounting fs
+    mount -t "$CHROOT_UNION_TYPE" -o "$CHROOT_UNION_MOUNT_OPTIONS" "$CHROOT_NAME" "$1"
+}
+
 if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-  VERBOSE="-v"
+    VERBOSE="-v"
 #  FSCK_VERBOSE="-V"
 fi
 
-if [ "$CHROOT_TYPE" = "plain" ] || [ "$CHROOT_TYPE" = "directory" ] || [ "$CHROOT_TYPE" = "file" ] || [ "$CHROOT_TYPE" = "loopback" ] || [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+if [ "$CHROOT_TYPE" = "directory" ] || [ "$CHROOT_TYPE" = "file" ] || [ "$CHROOT_TYPE" = "file" ] || [ "$CHROOT_TYPE" = "loopback" ] || [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
 
-    if [ "$CHROOT_TYPE" = "plain" ]; then
-	CHROOT_MOUNT_OPTIONS="--rbind"
-	CHROOT_MOUNT_DEVICE="$CHROOT_LOCATION"
-    elif [ "$CHROOT_TYPE" = "directory" ]; then
-	CHROOT_MOUNT_OPTIONS="--bind"
-	CHROOT_MOUNT_DEVICE="$CHROOT_LOCATION"
+    if [ "${CHROOT_UNION_TYPE:-none}" != "none" ]; then
+	CREATE_UNION="yes"
+    else
+	CREATE_UNION="no"
+    fi
+
+    case "$HOST_OS" in
+	freebsd* | k*bsd*-gnu) :
+	    BINDOPT="-t nullfs"
+	    ;;
+	*):
+	    BINDOPT="--bind"
+	    ;;
+    esac
+
+    if [ "$CHROOT_TYPE" = "directory" ]; then
+	CHROOT_MOUNT_OPTIONS="$BINDOPT"
+	CHROOT_MOUNT_DEVICE="$CHROOT_DIRECTORY"
+    elif [ "$CHROOT_TYPE" = "file" ]; then
+	UNPACK_LOCATION="${UNPACK_DIR}/${SESSION_ID}"
+	CHROOT_MOUNT_OPTIONS="$BINDOPT"
+	CHROOT_MOUNT_DEVICE="${CHROOT_FILE_UNPACK_DIR}/${SESSION_ID}"
+
     elif [ "$CHROOT_TYPE" = "loopback" ]; then
-	CHROOT_MOUNT_OPTIONS="$CHROOT_MOUNT_OPTIONS -o loop"
-    elif [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
-	CHROOT_MOUNT_DEVICE="$CHROOT_LVM_SNAPSHOT_DEVICE"
+	case "$HOST_OS" in
+	    freebsd* | k*bsd*-gnu) :
+		LOOP_DEVICE="/dev/$(/sbin/mdconfig -a -t vnode -f "$CHROOT_FILE")"
+		CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
+		CHROOT_MOUNT_OPTIONS=""
+		;;
+	    *):
+		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
+		;;
+	esac
     fi
 
     if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
@@ -97,32 +153,42 @@
 	    exit 1
 	fi
 
-        # If recovering, we want to remount all filesystems to ensure
-        # a sane state.
+	# If recovering, we want to remount all filesystems to ensure
+	# a sane state.
 	if [ $1 = "setup-recover" ]; then
+	    if [ "$CREATE_UNION" = "yes" ]; then
+		do_umount_all "$CHROOT_UNION_UNDERLAY_DIRECTORY"
+	    fi
 	    do_umount_all "$CHROOT_MOUNT_LOCATION"
 	fi
 
-	if [ "$CHROOT_TYPE" != "file" ]; then
+	if [ "$CREATE_UNION" = "yes" ]; then
+	    do_mount "$CHROOT_MOUNT_OPTIONS" "$CHROOT_MOUNT_DEVICE" "$CHROOT_UNION_UNDERLAY_DIRECTORY"
+	    do_mount_fs_union "$CHROOT_MOUNT_LOCATION"
+	else
 	    do_mount "$CHROOT_MOUNT_OPTIONS" "$CHROOT_MOUNT_DEVICE" "$CHROOT_MOUNT_LOCATION"
 	fi
 
-	if [ "$CHROOT_TYPE" != "plain" ]; then
-	    if [ -n "$FSTAB" ]; then
-		if [ -f "$FSTAB" ]; then
-		    "$LIBEXEC_DIR/schroot-mount" $VERBOSE \
-			-f "$FSTAB" -m "$CHROOT_PATH"
-		else
-		    echo "fstab file '$FSTAB' does not exist"
-		    exit 1
-		fi
+	if [ -n "$FSTAB" ]; then
+	    if [ -f "$FSTAB" ]; then
+		"$LIBEXEC_DIR/schroot-mount" $VERBOSE \
+		    -f "$FSTAB" -m "$CHROOT_PATH"
+	    else
+		echo "fstab file '$FSTAB' does not exist"
+		exit 1
 	    fi
 	fi
 
     elif [ $1 = "setup-stop" ]; then
 
 	do_umount_all "$CHROOT_MOUNT_LOCATION"
+	if [ "$CREATE_UNION" = "yes" ]; then
+	    do_umount_all "$CHROOT_UNION_UNDERLAY_DIRECTORY"
+	fi
 
+	# Purge mount location.
+	# The contents of file chroots are purged separately, because
+	# we might want to repack the contents.
 	if [ "$CHROOT_TYPE" != "file" ]; then
 	    if echo "$CHROOT_MOUNT_LOCATION" | grep -q "^$MOUNT_DIR/"; then
 		if [ -d "$CHROOT_MOUNT_LOCATION" ]; then

Modified: debcluster/configs/schroot/setup.d/15killprocs
===================================================================
--- debcluster/configs/schroot/setup.d/15killprocs	2010-03-13 09:11:27 UTC (rev 1718)
+++ debcluster/configs/schroot/setup.d/15killprocs	2010-03-13 09:17:59 UTC (rev 1719)
@@ -1,6 +1,6 @@
 #!/bin/sh
-# Copyright © 2007  Kees Cook <kees at outflux.net>
-# Copyright © 2007  Roger Leigh <rleigh at debian.org>
+# Copyright © 2007       Kees Cook <kees at outflux.net>
+# Copyright © 2007-2009  Roger Leigh <rleigh at debian.org>
 #
 # schroot is free software: you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -31,6 +31,11 @@
 # $1: mount base location
 do_kill_all()
 {
+    if [ -z "$1" ]; then
+	echo "No path for finding stray processes: not reaping processes in chroot"
+	exit 0
+    fi
+
     if [ "$AUTH_VERBOSITY" = "verbose" ]; then
         echo "Killing processes run inside $1"
     fi
@@ -43,8 +48,9 @@
                 echo "Killing left-over pid $pid (${exe##$1})"
                 echo "  Sending SIGTERM to pid $pid"
             fi
-            kill -TERM "$pid" 2>/dev/null
 
+            /bin/kill -TERM "$pid" 2>/dev/null
+
             count=0
             max=5
             while [ -d /proc/"$pid" ]; do
@@ -58,7 +64,7 @@
                     if [ "$AUTH_VERBOSITY" = "verbose" ]; then
                         echo "  Sending SIGKILL to pid $pid"
                     fi
-                    kill -KILL "$pid" 2>/dev/null
+                    /bin/kill -KILL "$pid" 2>/dev/null
                     sleep 1
                     break
                 fi

Modified: debcluster/configs/schroot/setup.d/20copyfiles
===================================================================
--- debcluster/configs/schroot/setup.d/20copyfiles	2010-03-13 09:11:27 UTC (rev 1718)
+++ debcluster/configs/schroot/setup.d/20copyfiles	2010-03-13 09:17:59 UTC (rev 1719)
@@ -35,33 +35,45 @@
 # $2: destination file
 copy_file()
 {
-    if [ -r "$1" ]; then
-	if [ -r "$2" ]; then
+    if [ -e "$1" ]; then
 
+	COPY="true"
+
+	if [ -e "$2" ]; then
+
             # Device and inode
 	    da=$(/usr/bin/stat --format="%d %i" "$1")
 	    db=$(/usr/bin/stat --format="%d %i" "$2")
 
-            # Content
-	    ca=$(/usr/bin/md5sum "$1" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
-	    cb=$(/usr/bin/md5sum "$2" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
-
-	    # Copy if files are different
-	    if [ "$da" != "$db" ]; then
-		if [ "$ca" != "$cb" ]; then
-		    cp $VERBOSE "$1" "$2"
+	    if [ "$da" = "$db" ]; then
+		COPY="false"
+	    elif [ -L "$2" ]; then
+		# Copy if destination is a symlink
+		:
+	    elif [ -f "$1" ] && [ -f "$2" ]; then
+                # Content
+		ca=$(/usr/bin/md5sum "$1" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
+		cb=$(/usr/bin/md5sum "$2" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
+	        # Copy only if file contents differ
+		if [ "$ca" = "$cb" ]; then
+		    COPY="false"
 		fi
 	    fi
+	fi
 
-	else
-
-	    # Copy if destination file does not exist
-	    cp $VERBOSE "$1" "$2"
-
+	# Copy only if files are different
+	if [ "$COPY" = "true" ]; then
+	    if [ -f "$1" ]; then
+		cp --preserve=all $VERBOSE "$1" "$2"
+	    else
+	        # Copy non-regular file directly
+		cp -a $VERBOSE "$1" "$2"
+	    fi
 	fi
 
     else
-	echo "W: Not copying nonexistent file: $file"
+	echo "Not copying nonexistent file: $file"
+	exit 1
     fi
 }
 
@@ -70,10 +82,13 @@
     if [ -n "$COPYFILES" ]; then
 	if [ -f "$COPYFILES" ]; then
 	    while read file; do
+		if echo "$file" | egrep -q '^(#|$)' ; then
+		    continue
+		fi
 		if echo "$file" | grep -q '^/'; then
 		    copy_file "$file" "${CHROOT_PATH}$file"
 		else
-		    echo "W: Not copying file with relative path: $file"
+		    echo "Not copying file with relative path: $file"
 		fi
 	    done < "$COPYFILES"
 	else

Added: debcluster/configs/schroot/setup.d/20nssdatabases
===================================================================
--- debcluster/configs/schroot/setup.d/20nssdatabases	                        (rev 0)
+++ debcluster/configs/schroot/setup.d/20nssdatabases	2010-03-13 09:17:59 UTC (rev 1719)
@@ -0,0 +1,61 @@
+#!/bin/sh
+# Copyright © 2005-2009  Roger Leigh <rleigh at debian.org>
+#
+# schroot is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# schroot is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#####################################################################
+
+set -e
+
+if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
+fi
+
+if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+  VERBOSE="--verbose"
+fi
+
+# Copy NSS database from host to chroot
+# $1: database name
+# $2: destination file name
+dup_nss()
+{
+    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+	echo "Copying $1 database to $2"
+    fi
+    getent "$1" > "$2"
+}
+
+if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
+
+    if [ -n "$NSSDATABASES" ]; then
+	if [ -f "$NSSDATABASES" ]; then
+	    while read db; do
+		if echo "$db" | egrep -q '^(#|$)' ; then
+		    continue
+		fi
+		dup_nss "$db" "${CHROOT_PATH}/etc/$db"
+	    done < "$NSSDATABASES"
+	else
+	    echo "nssdatabases file '$NSSDATABASES' does not exist"
+	    exit 1
+	fi
+    fi
+
+fi
+


Property changes on: debcluster/configs/schroot/setup.d/20nssdatabases
___________________________________________________________________
Added: svn:executable
   + *

Added: debcluster/configs/schroot/setup.d/99check
===================================================================
--- debcluster/configs/schroot/setup.d/99check	                        (rev 0)
+++ debcluster/configs/schroot/setup.d/99check	2010-03-13 09:17:59 UTC (rev 1719)
@@ -0,0 +1,154 @@
+#!/bin/sh
+# Copyright © 2005-2009  Roger Leigh <rleigh at debian.org>
+#
+# schroot is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# schroot is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#####################################################################
+
+set -e
+
+# Plain chroots should not be able to use scripts, but check anyway to
+# be safe.
+if [ $CHROOT_TYPE = "plain" ]; then
+    exit 1
+fi
+
+if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
+fi
+
+# Skip if run at inappropriate point.
+if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ] && [ "$(basename "$0")" = "99check" ]; then
+    exit 0;
+elif [ $1 = "setup-stop" ] && [ "$(basename "$0")" = "00check" ]; then
+    exit 0;
+fi
+
+if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+    echo "AUTH_USER=$AUTH_USER"
+    echo "AUTH_RUSER=$AUTH_RUSER"
+    echo "AUTH_RGROUP=$AUTH_RGROUP"
+    echo "AUTH_UID=$AUTH_UID"
+    echo "AUTH_GID=$AUTH_GID"
+    echo "AUTH_RUID=$AUTH_RUID"
+    echo "AUTH_RGID=$AUTH_RGID"
+    echo "AUTH_HOME=$AUTH_HOME"
+    echo "AUTH_SHELL=$AUTH_SHELL"
+    echo "AUTH_VERBOSITY=$AUTH_VERBOSITY"
+    echo "MOUNT_DIR=$MOUNT_DIR"
+    echo "LIBEXEC_DIR=$LIBEXEC_DIR"
+    echo "PID=$PID"
+    echo "HOST=$HOST"
+    echo "HOST_OS=$HOST_OS"
+    echo "HOST_VENDOR=$HOST_VENDOR"
+    echo "HOST_CPU=$HOST_CPU"
+    echo "PLATFORM=$PLATFORM"
+    echo "SESSION_ID=$SESSION_ID"
+    echo "CHROOT_TYPE=$CHROOT_TYPE"
+    echo "CHROOT_NAME=$CHROOT_NAME"
+    echo "CHROOT_DESCRIPTION=$CHROOT_DESCRIPTION"
+    echo "CHROOT_SCRIPT_CONFIG=$CHROOT_SCRIPT_CONFIG"
+    echo "CHROOT_MOUNT_LOCATION=$CHROOT_MOUNT_LOCATION"
+    echo "CHROOT_LOCATION=$CHROOT_LOCATION"
+    echo "CHROOT_PATH=$CHROOT_PATH"
+    if [ -n "$CHROOT_UNION_TYPE" ] && [ "$CHROOT_UNION_TYPE" != "none" ]; then
+	echo "CHROOT_UNION_TYPE=$CHROOT_UNION_TYPE"
+	echo "CHROOT_UNION_OVERLAY_DIRECTORY=$CHROOT_UNION_OVERLAY_DIRECTORY"
+	echo "CHROOT_UNION_UNDERLAY_DIRECTORY=$CHROOT_UNION_UNDERLAY_DIRECTORY"
+    fi
+    if [ "$CHROOT_TYPE" = "directory" ]; then
+	echo "CHROOT_DIRECTORY=$CHROOT_DIRECTORY"
+    elif [ "$CHROOT_TYPE" = "file" ]; then
+	echo "CHROOT_FILE=$CHROOT_FILE"
+	echo "CHROOT_FILE_REPACK=$CHROOT_FILE_REPACK"
+	echo "CHROOT_FILE_UNPACK_DIR=$CHROOT_FILE_UNPACK_DIR"
+    elif [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+	echo "CHROOT_DEVICE=$CHROOT_DEVICE"
+	echo "CHROOT_MOUNT_OPTIONS=$CHROOT_MOUNT_OPTIONS"
+	if [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+	    echo "CHROOT_LVM_SNAPSHOT_NAME=$CHROOT_LVM_SNAPSHOT_NAME"
+	    echo "CHROOT_LVM_SNAPSHOT_DEVICE=$CHROOT_LVM_SNAPSHOT_DEVICE"
+	    echo "CHROOT_LVM_SNAPSHOT_OPTIONS=$CHROOT_LVM_SNAPSHOT_OPTIONS"
+	fi
+    fi
+    echo "CHROOT_SESSION_CREATE=$CHROOT_SESSION_CREATE"
+    echo "CHROOT_SESSION_CLONE=$CHROOT_SESSION_CLONE"
+    echo "CHROOT_SESSION_PURGE=$CHROOT_SESSION_PURGE"
+    echo "FSTAB=$FSTAB"
+    echo "NSSDATABASES=$NSSDATABASES"
+fi
+
+case "$CHROOT_TYPE" in
+    directory)
+	if [ ! -d "$CHROOT_DIRECTORY" ]; then
+	    echo "Directory '$CHROOT_DIRECTORY' does not exist"
+	    exit 1
+	fi
+	if [ "$CHROOT_UNION_TYPE" != "none" ]; then
+	    if [ ! -d "$CHROOT_UNION_OVERLAY_DIRECTORY" ] \
+		&& [ $1 = "setup-recover" ];
+	    then
+		echo "Directory '$CHROOT_UNION_OVERLAY_DIRECTORY' does not exist"
+		exit 1
+	    fi
+	    if [ ! -d "$CHROOT_UNION_UNDERLAY_DIRECTORY" ] \
+		    && [ $1 = "setup-recunder" ];
+		then
+		echo "Directory '$CHROOT_UNION_UNDERLAY_DIRECTORY' does not exist"
+		exit 1
+	    fi
+	fi
+	;;
+    file | loopback)
+	if [ ! -f "$CHROOT_FILE" ]; then
+	    echo "File '$CHROOT_FILE' does not exist"
+	    exit 1
+	fi
+	;;
+    block-device | lvm-snapshot)
+	case "$HOST_OS" in
+	    freebsd* | k*bsd*-gnu) :
+		DEVTYPE="-c"
+		;;
+	    *):
+		DEVTYPE="-b"
+		;;
+	esac
+
+	if [ ! "$DEVTYPE" "$CHROOT_DEVICE" ]; then
+	    echo "Device '$CHROOT_DEVICE' does not exist"
+	    exit 1
+	fi
+	;;
+    *)
+	echo "Unknown chroot type $CHROOT_TYPE"
+	exit 1
+	;;
+esac
+
+# A basic safety check, so that the root filesystem doesn't get
+# toasted by accident.
+if [ -z "$CHROOT_PATH" ] \
+    || [ "$CHROOT_PATH" = "/" ] \
+    || ( [ -z "$CHROOT_UNION_TYPE" ] \
+         && [ "$CHROOT_DIRECTORY" = "/" ] ) \
+    || [ "$CHROOT_UNION_OVERLAY_DIRECTORY" = "/" ]
+then
+    echo "Invalid chroot mount path or directory"
+    exit 1
+fi


Property changes on: debcluster/configs/schroot/setup.d/99check
___________________________________________________________________
Added: svn:executable
   + *




More information about the Collab-qa-commits mailing list