[Collab-qa-commits] r1802 - in debcluster/configs/schroot: . default desktop minimal sbuild setup.d

Lucas Nussbaum lucas at alioth.debian.org
Sat Sep 25 06:26:14 UTC 2010


Author: lucas
Date: 2010-09-25 06:26:11 +0000 (Sat, 25 Sep 2010)
New Revision: 1802

Added:
   debcluster/configs/schroot/desktop/
   debcluster/configs/schroot/desktop/config
   debcluster/configs/schroot/desktop/copyfiles
   debcluster/configs/schroot/desktop/fstab
   debcluster/configs/schroot/desktop/nssdatabases
   debcluster/configs/schroot/minimal/
   debcluster/configs/schroot/minimal/config
   debcluster/configs/schroot/minimal/copyfiles
   debcluster/configs/schroot/minimal/fstab
   debcluster/configs/schroot/minimal/nssdatabases
   debcluster/configs/schroot/sbuild/
   debcluster/configs/schroot/sbuild/config
   debcluster/configs/schroot/sbuild/copyfiles
   debcluster/configs/schroot/sbuild/fstab
   debcluster/configs/schroot/sbuild/nssdatabases
   debcluster/configs/schroot/setup.d/05btrfs
Modified:
   debcluster/configs/schroot/default/config
   debcluster/configs/schroot/default/fstab
   debcluster/configs/schroot/default/nssdatabases
   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/05union
   debcluster/configs/schroot/setup.d/10mount
   debcluster/configs/schroot/setup.d/15killprocs
   debcluster/configs/schroot/setup.d/20copyfiles
   debcluster/configs/schroot/setup.d/20nssdatabases
   debcluster/configs/schroot/setup.d/50chrootname
   debcluster/configs/schroot/setup.d/99check
Log:
debcluster: schroot config update

Modified: debcluster/configs/schroot/default/config
===================================================================
--- debcluster/configs/schroot/default/config	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/default/config	2010-09-25 06:26:11 UTC (rev 1802)
@@ -1,5 +1,7 @@
-# Default settings for chroot setup and exec scripts.
-# See schroot-script-config(5) for further details.
+# Settings for "default" profile.
+# See schroot.conf(5) and schroot-script-config(5) for further details.
+# The files detailed below may also be edited to further customise
+# this profile.
 
 # Filesystems to mount inside the chroot.
 FSTAB="/etc/schroot/default/fstab"

Modified: debcluster/configs/schroot/default/fstab
===================================================================
--- debcluster/configs/schroot/default/fstab	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/default/fstab	2010-09-25 06:26:11 UTC (rev 1802)
@@ -3,10 +3,8 @@
 # (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
+/proc		/proc		none    rw,rbind        0       0
+/sys		/sys		none    rw,rbind        0       0
+/dev            /dev            none    rw,rbind        0       0
 /home		/home		none	rw,bind		0	0
 /tmp		/tmp		none	rw,bind		0	0

Modified: debcluster/configs/schroot/default/nssdatabases
===================================================================
--- debcluster/configs/schroot/default/nssdatabases	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/default/nssdatabases	2010-09-25 06:26:11 UTC (rev 1802)
@@ -4,7 +4,5 @@
 passwd
 shadow
 group
-services
-protocols
 networks
 hosts

Added: debcluster/configs/schroot/desktop/config
===================================================================
--- debcluster/configs/schroot/desktop/config	                        (rev 0)
+++ debcluster/configs/schroot/desktop/config	2010-09-25 06:26:11 UTC (rev 1802)
@@ -0,0 +1,13 @@
+# Settings for "desktop" profile.
+# See schroot.conf(5) and schroot-script-config(5) for further details.
+# The files detailed below may also be edited to further customise
+# this profile.
+
+# Filesystems to mount inside the chroot.
+FSTAB="/etc/schroot/desktop/fstab"
+
+# Files to copy from the host system into the chroot.
+COPYFILES="/etc/schroot/desktop/copyfiles"
+
+# System NSS databases to copy into the chroot.
+NSSDATABASES="/etc/schroot/desktop/nssdatabases"

Added: debcluster/configs/schroot/desktop/copyfiles
===================================================================
--- debcluster/configs/schroot/desktop/copyfiles	                        (rev 0)
+++ debcluster/configs/schroot/desktop/copyfiles	2010-09-25 06:26:11 UTC (rev 1802)
@@ -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/desktop/fstab
===================================================================
--- debcluster/configs/schroot/desktop/fstab	                        (rev 0)
+++ debcluster/configs/schroot/desktop/fstab	2010-09-25 06:26:11 UTC (rev 1802)
@@ -0,0 +1,13 @@
+# 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		none    rw,rbind        0       0
+/sys		/sys		none    rw,rbind        0       0
+/dev            /dev            none    rw,rbind        0       0
+/home		/home		none	rw,bind		0	0
+/tmp		/tmp		none	rw,bind		0	0
+
+# If you use gdm3, uncomment this line to allow Xauth to work
+#/var/run/gdm3	/var/run/gdm3	none	rw,bind		0	0

Added: debcluster/configs/schroot/desktop/nssdatabases
===================================================================
--- debcluster/configs/schroot/desktop/nssdatabases	                        (rev 0)
+++ debcluster/configs/schroot/desktop/nssdatabases	2010-09-25 06:26:11 UTC (rev 1802)
@@ -0,0 +1,10 @@
+# System databases to copy into the chroot from the host system.
+#
+# <database name>
+passwd
+shadow
+group
+services
+protocols
+networks
+hosts

Added: debcluster/configs/schroot/minimal/config
===================================================================
--- debcluster/configs/schroot/minimal/config	                        (rev 0)
+++ debcluster/configs/schroot/minimal/config	2010-09-25 06:26:11 UTC (rev 1802)
@@ -0,0 +1,13 @@
+# Settings for "minimal" profile.
+# See schroot.conf(5) and schroot-script-config(5) for further details.
+# The files detailed below may also be edited to further customise
+# this profile.
+
+# Filesystems to mount inside the chroot.
+FSTAB="/etc/schroot/minimal/fstab"
+
+# Files to copy from the host system into the chroot.
+COPYFILES="/etc/schroot/minimal/copyfiles"
+
+# System NSS databases to copy into the chroot.
+NSSDATABASES="/etc/schroot/minimal/nssdatabases"

Added: debcluster/configs/schroot/minimal/copyfiles
===================================================================
--- debcluster/configs/schroot/minimal/copyfiles	                        (rev 0)
+++ debcluster/configs/schroot/minimal/copyfiles	2010-09-25 06:26:11 UTC (rev 1802)
@@ -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/minimal/fstab
===================================================================
--- debcluster/configs/schroot/minimal/fstab	                        (rev 0)
+++ debcluster/configs/schroot/minimal/fstab	2010-09-25 06:26:11 UTC (rev 1802)
@@ -0,0 +1,7 @@
+# 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		none    rw,rbind        0       0
+/sys		/sys		none    rw,rbind        0       0

Added: debcluster/configs/schroot/minimal/nssdatabases
===================================================================
--- debcluster/configs/schroot/minimal/nssdatabases	                        (rev 0)
+++ debcluster/configs/schroot/minimal/nssdatabases	2010-09-25 06:26:11 UTC (rev 1802)
@@ -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-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/mount-defaults	2010-09-25 06:26:11 UTC (rev 1802)
@@ -3,10 +3,8 @@
 # (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
+/proc		/proc		none    rw,rbind        0       0
+/sys		/sys		none    rw,rbind        0       0
+/dev            /dev            none    rw,rbind        0       0
 /home		/home		none	rw,bind		0	0
 /tmp		/tmp		none	rw,bind		0	0

Added: debcluster/configs/schroot/sbuild/config
===================================================================
--- debcluster/configs/schroot/sbuild/config	                        (rev 0)
+++ debcluster/configs/schroot/sbuild/config	2010-09-25 06:26:11 UTC (rev 1802)
@@ -0,0 +1,13 @@
+# Settings for "sbuild" profile.
+# See schroot.conf(5) and schroot-script-config(5) for further details.
+# The files detailed below may also be edited to further customise
+# this profile.
+
+# Filesystems to mount inside the chroot.
+FSTAB="/etc/schroot/sbuild/fstab"
+
+# Files to copy from the host system into the chroot.
+COPYFILES="/etc/schroot/sbuild/copyfiles"
+
+# System NSS databases to copy into the chroot.
+NSSDATABASES="/etc/schroot/sbuild/nssdatabases"

Added: debcluster/configs/schroot/sbuild/copyfiles
===================================================================
--- debcluster/configs/schroot/sbuild/copyfiles	                        (rev 0)
+++ debcluster/configs/schroot/sbuild/copyfiles	2010-09-25 06:26:11 UTC (rev 1802)
@@ -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/sbuild/fstab
===================================================================
--- debcluster/configs/schroot/sbuild/fstab	                        (rev 0)
+++ debcluster/configs/schroot/sbuild/fstab	2010-09-25 06:26:11 UTC (rev 1802)
@@ -0,0 +1,7 @@
+# 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		none    rw,rbind        0       0
+/sys		/sys		none    rw,rbind        0       0

Added: debcluster/configs/schroot/sbuild/nssdatabases
===================================================================
--- debcluster/configs/schroot/sbuild/nssdatabases	                        (rev 0)
+++ debcluster/configs/schroot/sbuild/nssdatabases	2010-09-25 06:26:11 UTC (rev 1802)
@@ -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-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/schroot.conf	2010-09-25 06:26:11 UTC (rev 1802)
@@ -77,6 +77,64 @@
 priority=2
 root-users=user
 
+[squeeze64]
+type=file
+description=Debian sid 64 bits
+file=/dc/data/chroots/squeeze64.tgz
+priority=2
+root-users=user
+
+[lenny64]
+type=file
+description=Debian sid 64 bits
+file=/dc/data/chroots/lenny64.tgz
+priority=2
+root-users=user
+
+[squeeze64-instest]
+type=file
+description=Debian sid 64 bits
+file=/dc/data/chroots/squeeze64-instest.tgz
+priority=2
+root-users=user
+
+[sid64-instest]
+type=file
+description=Debian sid 64 bits
+file=/dc/data/chroots/sid64-instest.tgz
+priority=2
+root-users=user
+
+[lenny64-instest]
+type=file
+description=Debian sid 64 bits
+file=/dc/data/chroots/lenny64-instest.tgz
+priority=2
+root-users=user
+
+[lsqueeze64-instest]
+type=file
+description=Debian sid 64 bits
+file=/debscratch/chroots/squeeze64-instest.tgz
+priority=2
+root-users=user
+
+[lsid64-instest]
+type=file
+description=Debian sid 64 bits
+file=/debscratch/chroots/sid64-instest.tgz
+priority=2
+root-users=user
+
+[llenny64-instest]
+type=file
+description=Debian sid 64 bits
+file=/debscratch/chroots/lenny64-instest.tgz
+priority=2
+root-users=user
+
+
+
 [sid64b]
 type=file
 description=Debian sid 64 bits
@@ -84,7 +142,14 @@
 priority=2
 root-users=user
 
+[sid64c]
+type=file
+description=Debian sid 64 bits
+file=/dc/data/chroots/sid64c.tgz
+priority=2
+root-users=user
 
+
 [sid64-quilt]
 type=file
 description=Debian sid 64 bits
@@ -99,6 +164,21 @@
 priority=2
 root-users=user
 
+[lsqueeze64]
+type=file
+description=Debian sid 32 bits
+file=/debscratch/chroots/squeeze64.tgz
+priority=2
+root-users=user
+
+[llenny64]
+type=file
+description=Debian sid 32 bits
+file=/debscratch/chroots/lenny64.tgz
+priority=2
+root-users=user
+
+
 [lsid64b]
 type=file
 description=Debian sid 32 bits
@@ -106,6 +186,12 @@
 priority=2
 root-users=user
 
+[lsid64c]
+type=file
+description=Debian sid 32 bits
+file=/debscratch/chroots/sid64c.tgz
+priority=2
+root-users=user
 
 [lsid64-quilt]
 type=file
@@ -206,6 +292,22 @@
 personality=linux32
 root-users=user
 
+[ubuntu32]
+type=file
+description=Debian sid 32 bits
+file=/dc/data/chroots/ubuntu32.tgz
+priority=2
+personality=linux32
+root-users=user
+
+[lubuntu32]
+type=file
+description=Debian sid 32 bits
+file=/debscratch/chroots/ubuntu32.tgz
+priority=2
+personality=linux32
+root-users=user
+
 [lucid32]
 type=file
 description=Debian sid 32 bits
@@ -222,22 +324,21 @@
 personality=linux32
 root-users=user
 
-[lucidlp]
+[ubuntu64]
 type=file
 description=Debian sid 32 bits
-file=/dc/data/chroots/lucidlp.tgz
+file=/dc/data/chroots/ubuntu64.tgz
 priority=2
-personality=linux32
 root-users=user
 
-[llucidlp]
+[lubuntu64]
 type=file
 description=Debian sid 32 bits
-file=/debscratch/chroots/lucidlp.tgz
+file=/debscratch/chroots/ubuntu64.tgz
 priority=2
-personality=linux32
 root-users=user
 
+
 [lucid64]
 type=file
 description=Debian sid 32 bits
@@ -252,6 +353,35 @@
 priority=2
 root-users=user
 
+[lucid64b]
+type=file
+description=Debian sid 32 bits
+file=/dc/data/chroots/lucid64b.tgz
+priority=2
+root-users=user
+
+[llucid64b]
+type=file
+description=Debian sid 32 bits
+file=/debscratch/chroots/lucid64b.tgz
+priority=2
+root-users=user
+
+[lucid64c]
+type=file
+description=Debian sid 32 bits
+file=/dc/data/chroots/lucid64c.tgz
+priority=2
+root-users=user
+
+[llucid64c]
+type=file
+description=Debian sid 32 bits
+file=/debscratch/chroots/lucid64c.tgz
+priority=2
+root-users=user
+
+
 [sid32-piuparts]
 type=file
 description=Debian sid 32 bits

Modified: debcluster/configs/schroot/script-defaults
===================================================================
--- debcluster/configs/schroot/script-defaults	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/script-defaults	2010-09-25 06:26:11 UTC (rev 1802)
@@ -1,5 +1,7 @@
-# Default settings for chroot setup and exec scripts.
-# See schroot-script-config(5) for further details.
+# Settings for "default" profile.
+# See schroot.conf(5) and schroot-script-config(5) for further details.
+# The files detailed below may also be edited to further customise
+# this profile.
 
 # Filesystems to mount inside the chroot.
 FSTAB="/etc/schroot/default/fstab"

Modified: debcluster/configs/schroot/setup.d/00check
===================================================================
--- debcluster/configs/schroot/setup.d/00check	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/setup.d/00check	2010-09-25 06:26:11 UTC (rev 1802)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright © 2005-2009  Roger Leigh <rleigh at debian.org>
+# Copyright © 2005-2010  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,128 +19,34 @@
 
 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
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
 
 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
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
 fi
 
+# Plain chroots should not be able to use scripts, but check anyway to
+# be safe.
+if [ $CHROOT_TYPE = "plain" ]; then
+    fatal "plain chroots may not run setup scripts; use directory instead"
+fi
+
 # Skip if run at inappropriate point.
-if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ] && [ "$(basename "$0")" = "99check" ]; then
+if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ] && [ "$(basename "$0")" = "99check" ]; then
     exit 0;
-elif [ $1 = "setup-stop" ] && [ "$(basename "$0")" = "00check" ]; then
+elif [ $STAGE = "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"
+info "STAGE=$STAGE"
+info "STATUS=$STATUS"
+if [ "$VERBOSE" = "verbose" ]; then
+    env | sort
 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" ] \
@@ -149,6 +55,5 @@
          && [ "$CHROOT_DIRECTORY" = "/" ] ) \
     || [ "$CHROOT_UNION_OVERLAY_DIRECTORY" = "/" ]
 then
-    echo "Invalid chroot mount path or directory"
-    exit 1
+    fatal "Invalid chroot mount path or directory"
 fi

Added: debcluster/configs/schroot/setup.d/05btrfs
===================================================================
--- debcluster/configs/schroot/setup.d/05btrfs	                        (rev 0)
+++ debcluster/configs/schroot/setup.d/05btrfs	2010-09-25 06:26:11 UTC (rev 1802)
@@ -0,0 +1,73 @@
+#!/bin/sh
+# Copyright © 2005-2010  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
+
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
+if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+fi
+
+if [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
+
+    if [ $STAGE = "setup-start" ]; then
+
+	if [ ! -d "$CHROOT_BTRFS_SOURCE_SUBVOLUME" ]; then
+	    fatal "Btrfs source subvolume directory '$CHROOT_BTRFS_SOURCE_SUBVOLUME' does not exist"
+	fi
+	if [ ! -d "$CHROOT_BTRFS_SNAPSHOT_DIRECTORY" ]; then
+	    fatal "Btrfs snapshot directory '$CHROOT_BTRFS_SNAPSHOT_DIRECTORY' does not exist"
+	fi
+
+	info "Creating snapshot $CHROOT_BTRFS_SNAPSHOT_NAME from subvolume $CHROOT_BTRFS_SOURCE_SUBVOLUME"
+
+	if [ "$VERBOSE" = "verbose" ]; then
+	    btrfs subvolume snapshot "$CHROOT_BTRFS_SOURCE_SUBVOLUME" \
+		"$CHROOT_BTRFS_SNAPSHOT_NAME"
+	else
+	    btrfs subvolume snapshot "$CHROOT_BTRFS_SOURCE_SUBVOLUME" \
+		"$CHROOT_BTRFS_SNAPSHOT_NAME" > /dev/null
+	fi
+
+    elif [ $STAGE = "setup-stop" ]; then
+
+	if [ -d "$CHROOT_BTRFS_SNAPSHOT_NAME" ]; then
+
+	    info "Deleting snapshot $CHROOT_BTRFS_SNAPSHOT_NAME"
+
+	    if [ "$VERBOSE" = "verbose" ]; then
+		btrfs subvolume delete "$CHROOT_BTRFS_SNAPSHOT_NAME" || true
+	    else
+		btrfs subvolume delete "$CHROOT_BTRFS_SNAPSHOT_NAME" > /dev/null || true
+	    fi
+
+	else
+	    # The block device no longer exists, or was never created,
+	    # for example on lvcreate failure.
+	    warn "$CHROOT_BTRFS_SNAPSHOT_NAME does not exist (it may have been removed previously)"
+	fi
+
+    fi
+
+fi
+


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

Modified: debcluster/configs/schroot/setup.d/05file
===================================================================
--- debcluster/configs/schroot/setup.d/05file	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/setup.d/05file	2010-09-25 06:26:11 UTC (rev 1802)
@@ -19,11 +19,13 @@
 
 set -e
 
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
 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
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
 fi
 
 # Check file type
@@ -38,57 +40,66 @@
     elif echo "$CHROOT_FILE" | grep -q '\.zip$'; then
 	filetype="zip"
     else
-	echo "Unsupported filetype for $CHROOT_FILE"
-	exit 1
+	fatal "Unsupported filetype for $CHROOT_FILE"
     fi
 }
 
 # Unpack archive
 unpack_file()
 {
+    if [ ! -f "$CHROOT_FILE" ]; then
+	fatal "File '$CHROOT_FILE' does not exist"
+    fi
+
     if [ "$filetype" = "tar" ]; then
-	tar $VERBOSE -xf "$CHROOT_FILE"
+	tar $TAR_VERBOSE -xf "$CHROOT_FILE"
     elif [ "$filetype" = "tgz" ]; then
-	tar $VERBOSE -xzf "$CHROOT_FILE"
+	tar $TAR_VERBOSE -xzf "$CHROOT_FILE"
     elif [ "$filetype" = "tbz" ]; then
-	tar $VERBOSE -xjf "$CHROOT_FILE"
+	tar $TAR_VERBOSE -xjf "$CHROOT_FILE"
     elif [ "$filetype" = "zip" ]; then
 	unzip $ZIP_VERBOSE "$CHROOT_FILE"
     else
-	echo "Unsupported filetype for $CHROOT_FILE"
-	exit 1
+	fatal "Unsupported filetype for $CHROOT_FILE"
     fi
 }
 
 # Repack archive
 repack_file()
 {
-    NEWFILE=`mktemp "${CHROOT_FILE}.XXXXXX"`
+    NEWFILE=$(mktemp "${CHROOT_FILE}.XXXXXX")
 
     trap "if [ -f \"$NEWFILE\" ]; then rm -f \"$NEWFILE\"; fi" 0
 
     if [ "$filetype" = "tar" ]; then
-	tar $VERBOSE -cf "$NEWFILE" .
+	tar $TAR_VERBOSE -cf "$NEWFILE" .
     elif [ "$filetype" = "tgz" ]; then
-	tar $VERBOSE -czf "$NEWFILE" .
+	tar $TAR_VERBOSE -czf "$NEWFILE" .
     elif [ "$filetype" = "tbz" ]; then
-	tar $VERBOSE -cjf "$NEWFILE" .
+	tar $TAR_VERBOSE -cjf "$NEWFILE" .
     elif [ "$filetype" = "zip" ]; then
 	zip $ZIP_VERBOSE -r "$NEWFILE" .
     else
-	echo "Unsupported filetype for $CHROOT_FILE"
-	exit 1
+	fatal "Unsupported filetype for $CHROOT_FILE"
     fi
 
-    chown --reference="$CHROOT_FILE" "$NEWFILE"
-    chmod --reference="$CHROOT_FILE" "$NEWFILE"
+    if [ -f "$CHROOT_FILE" ]; then
+	info "Setting ownership and permissions from old archive"
+	chown --reference="$CHROOT_FILE" "$NEWFILE"
+	chmod --reference="$CHROOT_FILE" "$NEWFILE"
+    else
+	warn "Old archive no longer exists"
+	warn "Setting ownership and permissions to root:root 0600"
+	chown root:root "$NEWFILE"
+	chmod 0600 "$NEWFILE"
+    fi
     mv "$NEWFILE" "$CHROOT_FILE"
 
     trap "" 0
 }
 
-if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-    VERBOSE="-v"
+if [ "$VERBOSE" = "verbose" ]; then
+    TAR_VERBOSE="-v"
 else
     ZIP_VERBOSE="-q"
 fi
@@ -99,34 +110,32 @@
 
     UNPACK_LOCATION="${CHROOT_FILE_UNPACK_DIR}/${SESSION_ID}"
 
-    if [ $1 = "setup-start" ]; then
+    if [ $STAGE = "setup-start" ]; then
 
-	if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-	    echo "File unpack directory: $UNPACK_LOCATION"
-	fi
+	info "File unpack directory: $UNPACK_LOCATION"
+
         if [ ! -d "$UNPACK_LOCATION" ]; then
 	    mkdir -p "$UNPACK_LOCATION"
-	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-		echo "Created file unpack directory: $UNPACK_LOCATION"
-	    fi
+	    info "Created file unpack directory: $UNPACK_LOCATION"
         fi
 	cd "$UNPACK_LOCATION"
-	if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-	    echo "Changed CWD to $UNPACK_LOCATION"
-	fi
+	info "Changed CWD to $UNPACK_LOCATION"
 
 	unpack_file
 
-    elif [ "$1" = "setup-stop" ]; then
+    elif [ "$STAGE" = "setup-stop" ]; then
 
-	if [ "$2" = "ok" ] && [ "$CHROOT_FILE_REPACK" = "true" ]; then
-	    cd "$UNPACK_LOCATION" && repack_file
+	if [ "$STATUS" = "ok" ] && [ "$CHROOT_FILE_REPACK" = "true" ]; then
+	    if [ -d "$UNPACK_LOCATION" ]; then
+		info "Repacking chroot archive file $CHROOT_FILE from $UNPACK_LOCATION"
+		cd "$UNPACK_LOCATION" && repack_file
+	    else
+		warn "Not repacking chroot archive file: $UNPACK_LOCATION does not exist (it may have been removed previously)"
+	    fi
 	fi
 
 	if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
-	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-		echo "Purging $UNPACK_LOCATION"
-	    fi
+	    info "Purging $UNPACK_LOCATION"
 	    if [ -d "$UNPACK_LOCATION" ]; then
 		rm -rf "$UNPACK_LOCATION"
 	    fi

Modified: debcluster/configs/schroot/setup.d/05lvm
===================================================================
--- debcluster/configs/schroot/setup.d/05lvm	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/setup.d/05lvm	2010-09-25 06:26:11 UTC (rev 1802)
@@ -19,54 +19,56 @@
 
 set -e
 
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
 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
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
 fi
 
-if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-  VERBOSE="-v"
+if [ "$VERBOSE" = "verbose" ]; then
+    LVM_VERBOSE="-v"
 fi
 
 if [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
 
-    if [ $1 = "setup-start" ]; then
+    if [ $STAGE = "setup-start" ]; then
 
-	if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-	    lvcreate $VERBOSE --snapshot --name "$CHROOT_LVM_SNAPSHOT_NAME" \
+	if [ ! "$DEVTYPE" "$CHROOT_DEVICE" ]; then
+	    fatal "Device '$CHROOT_DEVICE' does not exist"
+	fi
+
+	if [ "$VERBOSE" = "verbose" ]; then
+	    lvcreate $LVM_VERBOSE --snapshot --name "$CHROOT_LVM_SNAPSHOT_NAME" \
 		"$CHROOT_DEVICE" $CHROOT_LVM_SNAPSHOT_OPTIONS
 	else
-	    lvcreate $VERBOSE --snapshot --name "$CHROOT_LVM_SNAPSHOT_NAME" \
+	    lvcreate $LVM_VERBOSE --snapshot --name "$CHROOT_LVM_SNAPSHOT_NAME" \
 		"$CHROOT_DEVICE" $CHROOT_LVM_SNAPSHOT_OPTIONS > /dev/null
 	fi
 
-    elif [ $1 = "setup-stop" ]; then
+    elif [ $STAGE = "setup-stop" ]; then
 
-	if [ -b "$CHROOT_LVM_SNAPSHOT_DEVICE" ]; then
+	if [ "$DEVTYPE" "$CHROOT_LVM_SNAPSHOT_DEVICE" ]; then
             # The lock needs to be dropped immediately before
             # destroying the device.  There is a small race here, but
             # the lock can't be dropped once the device has been
             # removed.
-	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-		echo "Removing device lock for $CHROOT_LVM_SNAPSHOT_DEVICE, owned by pid $PID"
-	    fi
+	    info "Removing device lock for $CHROOT_LVM_SNAPSHOT_DEVICE, owned by pid $PID"
             "$LIBEXEC_DIR/schroot-releaselock" \
 		--device="$CHROOT_LVM_SNAPSHOT_DEVICE" \
 		--pid=$PID || true
 
-	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-		lvremove $VERBOSE -f "$CHROOT_LVM_SNAPSHOT_DEVICE" || true
+	    if [ "$VERBOSE" = "verbose" ]; then
+		lvremove $LVM_VERBOSE -f "$CHROOT_LVM_SNAPSHOT_DEVICE" || true
 	    else
-		lvremove $VERBOSE -f "$CHROOT_LVM_SNAPSHOT_DEVICE" > /dev/null || true
+		lvremove $LVM_VERBOSE -f "$CHROOT_LVM_SNAPSHOT_DEVICE" > /dev/null || true
 	    fi
 	else
 	    # The block device no longer exists, or was never created,
 	    # for example on lvcreate failure.
-	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-		echo "$CHROOT_LVM_SNAPSHOT_DEVICE does not exist"
-	    fi
+	    warn "$CHROOT_LVM_SNAPSHOT_DEVICE does not exist (it may have been removed previously)"
 	fi
 
     fi

Modified: debcluster/configs/schroot/setup.d/05union
===================================================================
--- debcluster/configs/schroot/setup.d/05union	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/setup.d/05union	2010-09-25 06:26:11 UTC (rev 1802)
@@ -19,51 +19,51 @@
 
 set -e
 
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
     . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
 fi
 
 if [ -n "${CHROOT_UNION_TYPE}" ] && [ "${CHROOT_UNION_TYPE}" != 'none' ]; then
 
-    if [ $1 = "setup-start" ]; then
+    if [ $STAGE = "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
+	    fatal "$CHROOT_UNION_OVERLAY_DIRECTORY does not exist, and could not be created"
 	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
+	    fatal "$CHROOT_UNION_UNDERLAY_DIRECTORY does not exist, and could not be created"
 	fi
 
-    elif [ $1 = "setup-recover" ]; then
+    elif [ $STAGE = "setup-recover" ]; then
         if [ ! -d "${CHROOT_UNION_OVERLAY_DIRECTORY}" ]; then
-	    echo "Missing overlay directory for session: can't recover"
-	    exit 1
+	    fatal "Missing overlay directory for session: can't recover"
         fi
         if [ ! -d "${CHROOT_UNION_UNDERLAY_DIRECTORY}" ]; then
-	    echo "Missing underlay directory for session: can't recover"
-	    exit 1
+	    fatal "Missing underlay directory for session: can't recover"
         fi
 
-    elif [ $1 = "setup-stop" ]; then
+    elif [ $STAGE = "setup-stop" ]; then
         if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
-	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-		echo "Purging $CHROOT_UNION_OVERLAY_DIRECTORY"
-	    fi
+	    info "Purging $CHROOT_UNION_OVERLAY_DIRECTORY"
 	    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
+	    info "Removing $CHROOT_UNION_UNDERLAY_DIRECTORY"
 	    if [ -d "${CHROOT_UNION_UNDERLAY_DIRECTORY}" ]; then
-		rmdir "${CHROOT_UNION_UNDERLAY_DIRECTORY}"
+		if ! rmdir "${CHROOT_UNION_UNDERLAY_DIRECTORY}"; then
+		    warn "Please unmount any filesystems and remove any files under $CHROOT_UNION_UNDERLAY_DIRECTORY"
+		    fatal "Failed to remove $CHROOT_UNION_UNDERLAY_DIRECTORY (directory not empty)."
+		fi
 	    fi
 	fi
     fi

Modified: debcluster/configs/schroot/setup.d/10mount
===================================================================
--- debcluster/configs/schroot/setup.d/10mount	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/setup.d/10mount	2010-09-25 06:26:11 UTC (rev 1802)
@@ -20,11 +20,13 @@
 
 set -e
 
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
 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
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
 fi
 
 # Mount a filesystem
@@ -33,19 +35,17 @@
 # $3: mount location
 do_mount()
 {
-    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-	echo "Mounting $2 on $3"
-    fi
+    info "Mounting $2 on $3"
 
     if [ ! -d "$3" ]; then
 	mkdir -p "$3"
     fi
     if [ ! -d "$3" ]; then
-	echo "$3 does not exist, and could not be created"
-	exit 1
+	fatal "$3 does not exist, and could not be created"
     fi
 
-    mount $VERBOSE $1 "$2" "$3"
+    info "$MOUNT_VERBOSE $1 $2 $3"
+    mount $MOUNT_VERBOSE $1 "$2" "$3"
 }
 
 # Unmount all filesystems under specified location
@@ -57,12 +57,12 @@
 	if [ "x$mounts" != 'x' ]; then
             echo "$mounts" |
             while read mountloc; do
-		if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-                    echo "Unmounting $mountloc"
-		fi
+                info "Unmounting $mountloc"
 		umount "$mountloc" || exit 1
             done || exit 1
 	fi
+    else
+	warn "Mount location $1 no longer exists; skipping unmount"
     fi
 }
 
@@ -82,20 +82,23 @@
 	esac
     fi
 
-    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-	echo "Using '$CHROOT_UNION_TYPE' for filesystem union"
-    fi
+    info "Using '$CHROOT_UNION_TYPE' for filesystem union"
 
     # Try mounting fs
     mount -t "$CHROOT_UNION_TYPE" -o "$CHROOT_UNION_MOUNT_OPTIONS" "$CHROOT_NAME" "$1"
 }
 
-if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-    VERBOSE="-v"
+if [ "$VERBOSE" = "verbose" ]; then
+    MOUNT_VERBOSE="-v"
 #  FSCK_VERBOSE="-V"
 fi
 
-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" = "directory" ] \
+    || [ "$CHROOT_TYPE" = "file" ] \
+    || [ "$CHROOT_TYPE" = "loopback" ] \
+    || [ "$CHROOT_TYPE" = "block-device" ] \
+    || [ "$CHROOT_TYPE" = "lvm-snapshot" ] \
+    || [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
 
     if [ "${CHROOT_UNION_TYPE:-none}" != "none" ]; then
 	CREATE_UNION="yes"
@@ -103,59 +106,67 @@
 	CREATE_UNION="no"
     fi
 
-    case "$HOST_OS" in
-	freebsd* | k*bsd*-gnu) :
-	    BINDOPT="-t nullfs"
-	    ;;
-	*):
-	    BINDOPT="--bind"
-	    ;;
-    esac
+    if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
 
-    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
 	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=""
+		BINDOPT="-t nullfs"
 		;;
 	    *):
-		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
+		BINDOPT="--bind"
 		;;
 	esac
-    fi
 
-    if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
+	if [ "$CHROOT_TYPE" = "directory" ]; then
+	    CHROOT_MOUNT_OPTIONS="$BINDOPT"
+	    CHROOT_MOUNT_DEVICE="$CHROOT_DIRECTORY"
+	    if [ ! -d "$CHROOT_DIRECTORY" ]; then
+		fatal "Directory '$CHROOT_DIRECTORY' does not exist"
+	    fi
+	elif [ "$CHROOT_TYPE" = "file" ]; then
+	    CHROOT_MOUNT_OPTIONS="$BINDOPT"
+	    CHROOT_MOUNT_DEVICE="${CHROOT_FILE_UNPACK_DIR}/${SESSION_ID}"
+	elif [ "$CHROOT_TYPE" = "block-device" ]; then
+	    if [ ! "$DEVTYPE" "$CHROOT_DEVICE" ]; then
+		fatal "Device '$CHROOT_DEVICE' does not exist"
+	    fi
+	elif [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
+	    CHROOT_MOUNT_OPTIONS="$BINDOPT"
+	    CHROOT_MOUNT_DEVICE="$CHROOT_BTRFS_SNAPSHOT_NAME"
+	elif [ "$CHROOT_TYPE" = "loopback" ]; then
+	    if [ ! -f "$CHROOT_FILE" ]; then
+	    	fatal "File '$CHROOT_FILE' does not exist"
+	    fi
 
-        # fsck doesn't like being run non-interactively
-	#/sbin/fsck $FSCK_VERBOSE -n "$CHROOT_MOUNT_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="-o loop"
+		    else
+			CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
+			CHROOT_MOUNT_OPTIONS=""
+		    fi
+		    ;;
+	    esac
+	fi
 
         if [ ! -d "$CHROOT_MOUNT_LOCATION" ]; then
 	    mkdir -p "$CHROOT_MOUNT_LOCATION"
         fi
 	if [ ! -d "$CHROOT_MOUNT_LOCATION" ]; then
-	    echo "$CHROOT_MOUNT_LOCATION does not exist, and could not be created"
-	    exit 1
+	    fatal "$CHROOT_MOUNT_LOCATION does not exist, and could not be created"
 	fi
 
 	# If recovering, we want to remount all filesystems to ensure
 	# a sane state.
-	if [ $1 = "setup-recover" ]; then
+	if [ $STAGE = "setup-recover" ]; then
 	    if [ "$CREATE_UNION" = "yes" ]; then
 		do_umount_all "$CHROOT_UNION_UNDERLAY_DIRECTORY"
 	    fi
@@ -171,15 +182,14 @@
 
 	if [ -n "$FSTAB" ]; then
 	    if [ -f "$FSTAB" ]; then
-		"$LIBEXEC_DIR/schroot-mount" $VERBOSE \
+		"$LIBEXEC_DIR/schroot-mount" $MOUNT_VERBOSE \
 		    -f "$FSTAB" -m "$CHROOT_PATH"
 	    else
-		echo "fstab file '$FSTAB' does not exist"
-		exit 1
+		fatal "fstab file '$FSTAB' does not exist"
 	    fi
 	fi
 
-    elif [ $1 = "setup-stop" ]; then
+    elif [ $STAGE = "setup-stop" ]; then
 
 	do_umount_all "$CHROOT_MOUNT_LOCATION"
 	if [ "$CREATE_UNION" = "yes" ]; then

Modified: debcluster/configs/schroot/setup.d/15killprocs
===================================================================
--- debcluster/configs/schroot/setup.d/15killprocs	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/setup.d/15killprocs	2010-09-25 06:26:11 UTC (rev 1802)
@@ -20,11 +20,13 @@
 
 set -e
 
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
 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
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
 fi
 
 # Kill all processes that were run from within the chroot environment
@@ -32,22 +34,17 @@
 do_kill_all()
 {
     if [ -z "$1" ]; then
-	echo "No path for finding stray processes: not reaping processes in chroot"
-	exit 0
+	fatal "No path for finding stray processes: not reaping processes in chroot"
     fi
 
-    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-        echo "Killing processes run inside $1"
-    fi
+    info "Killing processes run inside $1"
     ls /proc | egrep '^[[:digit:]]+$' |
     while read pid; do
         root=$(readlink /proc/"$pid"/root || true)
         if [ "$root" = "$1" ]; then
-            if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-                exe=$(readlink /proc/"$pid"/exe || true)
-                echo "Killing left-over pid $pid (${exe##$1})"
-                echo "  Sending SIGTERM to pid $pid"
-            fi
+            exe=$(readlink /proc/"$pid"/exe || true)
+            info "Killing left-over pid $pid (${exe##$1})"
+            info "  Sending SIGTERM to pid $pid"
 
             /bin/kill -TERM "$pid" 2>/dev/null
 
@@ -55,15 +52,11 @@
             max=5
             while [ -d /proc/"$pid" ]; do
                 count=$(( $count + 1 ))
-                if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-                    echo "  Waiting for pid $pid to shut down... ($count/$max)"
-                fi
+                info "  Waiting for pid $pid to shut down... ($count/$max)"
                 sleep 1
                 # Wait for $max seconds for process to die before -9'ing it
                 if [ "$count" -eq "$max" ]; then
-                    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-                        echo "  Sending SIGKILL to pid $pid"
-                    fi
+                    info "  Sending SIGKILL to pid $pid"
                     /bin/kill -KILL "$pid" 2>/dev/null
                     sleep 1
                     break
@@ -73,6 +66,6 @@
     done
 }
 
-if [ $1 = "setup-recover" ] || [ $1 = "setup-stop" ]; then
+if [ $STAGE = "setup-recover" ] || [ $STAGE = "setup-stop" ]; then
     do_kill_all "$CHROOT_MOUNT_LOCATION"
 fi
\ No newline at end of file

Modified: debcluster/configs/schroot/setup.d/20copyfiles
===================================================================
--- debcluster/configs/schroot/setup.d/20copyfiles	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/setup.d/20copyfiles	2010-09-25 06:26:11 UTC (rev 1802)
@@ -19,15 +19,17 @@
 
 set -e
 
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
 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
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
 fi
 
-if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-  VERBOSE="--verbose"
+if [ "$VERBOSE" = "verbose" ]; then
+  CP_VERBOSE="--verbose"
 fi
 
 # Copy a file if the source and destination differ
@@ -43,7 +45,8 @@
 
             # Device and inode
 	    da=$(/usr/bin/stat --format="%d %i" "$1")
-	    db=$(/usr/bin/stat --format="%d %i" "$2")
+	    # This one can fail since it might not exist yet
+	    db=$(/usr/bin/stat --format="%d %i" "$2" 2>/dev/null || :)
 
 	    if [ "$da" = "$db" ]; then
 		COPY="false"
@@ -53,7 +56,8 @@
 	    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/')
+		cb=$(/usr/bin/md5sum "$2" 2>/dev/null || :)
+		cb=$(echo "$cb" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
 	        # Copy only if file contents differ
 		if [ "$ca" = "$cb" ]; then
 		    COPY="false"
@@ -64,20 +68,19 @@
 	# Copy only if files are different
 	if [ "$COPY" = "true" ]; then
 	    if [ -f "$1" ]; then
-		cp --preserve=all $VERBOSE "$1" "$2"
+		cp --preserve=all $CP_VERBOSE "$1" "$2"
 	    else
 	        # Copy non-regular file directly
-		cp -a $VERBOSE "$1" "$2"
+		cp -a $CP_VERBOSE "$1" "$2"
 	    fi
 	fi
 
     else
-	echo "Not copying nonexistent file: $file"
-	exit 1
+	fatal "Not copying nonexistent file: $file"
     fi
 }
 
-if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
+if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
 
     if [ -n "$COPYFILES" ]; then
 	if [ -f "$COPYFILES" ]; then
@@ -88,12 +91,11 @@
 		if echo "$file" | grep -q '^/'; then
 		    copy_file "$file" "${CHROOT_PATH}$file"
 		else
-		    echo "Not copying file with relative path: $file"
+		    warn "Not copying file with relative path: $file"
 		fi
 	    done < "$COPYFILES"
 	else
-	    echo "copyfiles file '$COPYFILES' does not exist"
-	    exit 1
+	    fatal "copyfiles file '$COPYFILES' does not exist"
 	fi
     fi
 

Modified: debcluster/configs/schroot/setup.d/20nssdatabases
===================================================================
--- debcluster/configs/schroot/setup.d/20nssdatabases	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/setup.d/20nssdatabases	2010-09-25 06:26:11 UTC (rev 1802)
@@ -19,29 +19,25 @@
 
 set -e
 
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
 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
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
 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
+    info "Copying $1 database to $2"
     getent "$1" > "$2"
 }
 
-if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
+if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
 
     if [ -n "$NSSDATABASES" ]; then
 	if [ -f "$NSSDATABASES" ]; then
@@ -49,11 +45,24 @@
 		if echo "$db" | egrep -q '^(#|$)' ; then
 		    continue
 		fi
+
+                # Device and inode
+		dr=$(/usr/bin/stat --format="%d %i" "/etc/$db")
+		# This one can fail since it might not exist yet
+		dc=$(/usr/bin/stat --format="%d %i" "${CHROOT_PATH}/etc/$db" 2>/dev/null || :)
+
+	        # If the database inside and outside the chroot is the
+	        # same, it's very likely that dup_nss would blank the
+	        # database, so skip it.
+		if [ "$dr" = "$dc" ]; then
+		    warn "$db files '/etc/$db' and '${CHROOT_PATH}/etc/$db' are the same file; skipping"
+		    continue;
+		fi
+
 		dup_nss "$db" "${CHROOT_PATH}/etc/$db"
 	    done < "$NSSDATABASES"
 	else
-	    echo "nssdatabases file '$NSSDATABASES' does not exist"
-	    exit 1
+	    fatal "nssdatabases file '$NSSDATABASES' does not exist"
 	fi
     fi
 

Modified: debcluster/configs/schroot/setup.d/50chrootname
===================================================================
--- debcluster/configs/schroot/setup.d/50chrootname	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/setup.d/50chrootname	2010-09-25 06:26:11 UTC (rev 1802)
@@ -19,21 +19,21 @@
 
 set -e
 
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
 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
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
 fi
 
-if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
+if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
 
 # Strip any UUID or ISO-8601 date and pid from the chroot name
   NAME=$(echo "${CHROOT_NAME}" | sed -e 's/-[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9]-[a-z0-9][a-z0-9][a-z0-9][a-z0-9]-[a-z0-9][a-z0-9][a-z0-9][a-z0-9]-[a-z0-9][a-z0-9][a-z0-9][a-z0-9]-[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9]//g' -e 's/-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]Z-[0-9][0-9]*//g')
 
-  if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-    echo "Setting chroot name to ${NAME}"
-  fi
+  info "Setting chroot name to ${NAME}"
 
   echo "${NAME}" > "${CHROOT_PATH}/etc/debian_chroot"
 

Modified: debcluster/configs/schroot/setup.d/99check
===================================================================
--- debcluster/configs/schroot/setup.d/99check	2010-09-23 09:55:10 UTC (rev 1801)
+++ debcluster/configs/schroot/setup.d/99check	2010-09-25 06:26:11 UTC (rev 1802)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright © 2005-2009  Roger Leigh <rleigh at debian.org>
+# Copyright © 2005-2010  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,128 +19,34 @@
 
 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
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
 
 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
+elif [ "$STATUS" = "ok" ]; then
+    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
 fi
 
+# Plain chroots should not be able to use scripts, but check anyway to
+# be safe.
+if [ $CHROOT_TYPE = "plain" ]; then
+    fatal "plain chroots may not run setup scripts; use directory instead"
+fi
+
 # Skip if run at inappropriate point.
-if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ] && [ "$(basename "$0")" = "99check" ]; then
+if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ] && [ "$(basename "$0")" = "99check" ]; then
     exit 0;
-elif [ $1 = "setup-stop" ] && [ "$(basename "$0")" = "00check" ]; then
+elif [ $STAGE = "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"
+info "STAGE=$STAGE"
+info "STATUS=$STATUS"
+if [ "$VERBOSE" = "verbose" ]; then
+    env | sort
 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" ] \
@@ -149,6 +55,5 @@
          && [ "$CHROOT_DIRECTORY" = "/" ] ) \
     || [ "$CHROOT_UNION_OVERLAY_DIRECTORY" = "/" ]
 then
-    echo "Invalid chroot mount path or directory"
-    exit 1
+    fatal "Invalid chroot mount path or directory"
 fi




More information about the Collab-qa-commits mailing list