From: Peter Palfrader <peter@palfrader.org>
Date: Sat, 12 Jul 2014 09:56:32 +0000 (+0200)
Subject: Move some of the porterbox schroot logic to the schroot module that is shared with... 
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f9edc08d80cae5ea635ba30159133155ecdc23d7;p=dsa-puppet.git

Move some of the porterbox schroot logic to the schroot module that is shared with buildd
---

diff --git a/modules/porterbox/files/schroot-dsa/config b/modules/porterbox/files/schroot-dsa/config
deleted file mode 100644
index ba94f6fe..00000000
--- a/modules/porterbox/files/schroot-dsa/config
+++ /dev/null
@@ -1,52 +0,0 @@
-# Settings for "dsa" profile.
-
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-FSTAB="/etc/schroot/dsa/fstab"
-[ -e "$FSTAB" ] || FSTAB="/etc/schroot/default/fstab"
-
-COPYFILES="/etc/schroot/dsa/copyfiles"
-[ -e "$COPYFILES" ] || COPYFILES="/etc/schroot/default/copyfiles"
-
-NSSDATABASES="/etc/schroot/dsa/nssdatabases"
-[ -e "$NSSDATABASES" ] || NSSDATABASES="/etc/schroot/default/nssdatabases"
-
-
-# added by weasel:
-if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
-    case $CHROOT_DESCRIPTION in
-        "["*-*_*-dchroot"]"*)
-            chroot_type="$CHROOT_DESCRIPTION"; chroot_type="${chroot_type#\[}"; chroot_type="${chroot_type%%]*}"
-            suitevariant_arch_tuple="${chroot_type%%-dchroot-*}"
-            suitevariant=${suitevariant_arch_tuple%_*}
-            SUITE_BASE=${suitevariant%-*}
-            SUITE_VARIANT=${suitevariant##*-}
-        ;;
-        "["*_*-dchroot"]"*)
-            chroot_type="$CHROOT_DESCRIPTION"; chroot_type="${chroot_type#\[}"; chroot_type="${chroot_type%%]*}"
-            SUITE_BASE="${chroot_type%%_*}"
-        ;;
-        *)
-            if [ "$STAGE" = "setup-start" ]; then
-               echo >&2 "Unable to parse chroot description for what kind of chroot you want."
-               exit 1
-            fi
-        ;;
-    esac
-fi
-
-CHROOT_FILE_UNPACK_DIR=/srv/chroot/schroot-unpack
-
-if [ -e /etc/schroot/dsa/default-mirror ]; then
-    MIRROR=$(cat /etc/schroot/dsa/default-mirror )
-fi
-MIRROR=${MIRROR:-cdn.debian.net}
-
-if [ "$(basename "$0")" = "00check" ] &&
-   [ "$CHROOT_TYPE" = "file" ] &&
-   [ "$STAGE" = "setup-start" ]; then
-        echo "Untarring chroot environment.  This might take a minute or two."
-fi
diff --git a/modules/porterbox/files/schroot-dsa/fstab b/modules/porterbox/files/schroot-dsa/fstab
deleted file mode 100644
index d199237c..00000000
--- a/modules/porterbox/files/schroot-dsa/fstab
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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,bind        0       0
-/sys		/sys		none    rw,bind        0       0
-/dev            /dev            none    rw,bind         0       0
-/dev/pts	/dev/pts	none	rw,bind		0	0
-/home		/home		none	rw,bind		0	0
-/tmp		/tmp		none	rw,bind		0	0
-tmpfs-shm	/dev/shm	tmpfs	defaults,size=64m	0 0
-
-# It may be desirable to have access to /run, especially if you wish
-# to run additional services in the chroot.  However, note that this
-# may potentially cause undesirable behaviour on upgrades, such as
-# killing services on the host.
-#/run		/run		none	rw,bind		0	0
-#/run/lock	/run/lock	none	rw,bind		0	0
-#/dev/shm	/dev/shm	none	rw,bind		0	0
-#/run/shm	/run/shm	none	rw,bind		0	0
diff --git a/modules/porterbox/files/schroot-dsa/fstab-freebsd b/modules/porterbox/files/schroot-dsa/fstab-freebsd
deleted file mode 100644
index 61fae346..00000000
--- a/modules/porterbox/files/schroot-dsa/fstab-freebsd
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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		linprocfs	defaults	0	0
-dev		/dev		devfs	rw,bind		0	0
-dev		/dev/fd		fdescfs	rw,bind		0	0
-/home		/home		nullfs	rw		0	0
-/tmp		/tmp		nullfs	rw		0	0
-
-# It may be desirable to have access to /run, especially if you wish
-# to run additional services in the chroot.  However, note that this
-# may potentially cause undesirable behaviour on upgrades, such as
-# killing services on the host.
-#/run		/run		nullfs	rw		0	0
-#/run/lock	/run/lock	nullfs	rw		0	0
diff --git a/modules/porterbox/files/schroot-setup.d/99porterbox-extra-apt-options b/modules/porterbox/files/schroot-setup.d/99porterbox-extra-apt-options
deleted file mode 100755
index db240dac..00000000
--- a/modules/porterbox/files/schroot-setup.d/99porterbox-extra-apt-options
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-# by weasel
-
-set -e
-
-[ "$CHROOT_PROFILE" = "dsa" ] || exit 0
-
-. "$SETUP_DATA_DIR/common-data"
-. "$SETUP_DATA_DIR/common-functions"
-
-if [ -f "${CHROOT_SCRIPT_CONFIG:-}" ]; then
-    . "$CHROOT_SCRIPT_CONFIG"
-fi
-
-
-if [ "$1" = "setup-start" ] || [ "$1" = "setup-recover" ]; then
-	TGT="${CHROOT_PATH}/etc/apt/apt.conf.d/local-schroot"
-	rm -f "$TGT"
-	cat > "$TGT" << EOF
-APT::Install-Recommends 0;
-Acquire::http::Pipeline-Depth "0";
-Acquire::Languages "none";
-Acquire::PDiffs "false";
-EOF
-#Acquire  {
-#     http { Proxy "http://10.213.12.1:3128/"; };
-#     ftp { Proxy "http://10.213.12.1:3128/"; };
-#}
-fi
diff --git a/modules/porterbox/files/schroot-setup.d/99porterbox-extra-sources b/modules/porterbox/files/schroot-setup.d/99porterbox-extra-sources
deleted file mode 100755
index 2bdff1bb..00000000
--- a/modules/porterbox/files/schroot-setup.d/99porterbox-extra-sources
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/bash
-
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-# by weasel
-
-set -e
-
-[ "$CHROOT_PROFILE" = "dsa" ] || exit 0
-
-. "$SETUP_DATA_DIR/common-data"
-. "$SETUP_DATA_DIR/common-functions"
-
-if [ -f "${CHROOT_SCRIPT_CONFIG:-}" ]; then
-    . "$CHROOT_SCRIPT_CONFIG"
-elif [ -f "$CHROOT_PROFILE_DIR/config" ]; then
-    . "$CHROOT_PROFILE_DIR/config"
-else
-    fatal "Cannot find config script"
-fi
-
-
-if [ "$1" = "setup-start" ] || [ "$1" = "setup-recover" ]; then
-  SRCL="${CHROOT_PATH}/etc/apt/sources.list.d/auto.list"
-  rm -f "$SRCL"
-  mirror=${MIRROR:-http://cdn.debian.net/debian}
-
-  case "${SUITE_BASE:-}" in
-    experimental)
-      echo "deb     $mirror sid main" >> "$SRCL"
-      echo "deb-src $mirror sid main" >> "$SRCL"
-      ;;
-    sid|jessie)
-      ;;
-    *)
-      echo "deb     http://security.debian.org/ ${SUITE_BASE}/updates main" >> "$SRCL"
-      echo "deb-src http://security.debian.org/ ${SUITE_BASE}/updates main" >> "$SRCL"
-      ;;
-  esac
-  echo "deb     $mirror ${SUITE_BASE} main" >> "$SRCL"
-  echo "deb-src $mirror ${SUITE_BASE} main" >> "$SRCL"
-
-  case "${SUITE_VARIANT:-}" in
-    backports)
-      case "${SUITE_BASE:-}" in
-        squeeze)
-          echo "deb     http://backports.debian.org/debian-backports/ ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
-          echo "deb-src http://backports.debian.org/debian-backports/ ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
-          ;;
-        *)
-          echo "deb     $mirror ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
-          echo "deb-src $mirror ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
-          ;;
-      esac
-      ;;
-  esac
-  echo "o To install build dependencies run"
-  echo "  dd-schroot-cmd -c ${SESSION_ID} apt-get update"
-  echo "  followed by build-dep/install as appropriate in the host system."
-  echo "o If you started this session with schroot -b, please do not forget to run"
-  echo "  schroot --end-session -c ${SESSION_ID}"
-  echo "  when you no longer need this environment."
-fi
diff --git a/modules/porterbox/manifests/init.pp b/modules/porterbox/manifests/init.pp
index 5f3383ae..80179857 100644
--- a/modules/porterbox/manifests/init.pp
+++ b/modules/porterbox/manifests/init.pp
@@ -1,39 +1,6 @@
 class porterbox {
 	include schroot
-	# FIXME: Refactor this to a common class when something else needs it
-	package { 'moreutils':
-		ensure => installed
-	}
 
-	file { '/etc/schroot/dsa':
-		ensure => directory,
-		require => Package['schroot'],
-	}
-	file { '/etc/schroot/dsa/config':
-		source  => 'puppet:///modules/porterbox/schroot-dsa/config',
-	}
-	if ! ($::debarchitecture in ['kfreebsd-amd64', 'kfreebsd-i386']) {
-		file { '/etc/schroot/dsa/fstab':
-			source  => 'puppet:///modules/porterbox/schroot-dsa/fstab',
-		}
-	} else {
-		file { '/etc/schroot/dsa/fstab':
-			source  => 'puppet:///modules/porterbox/schroot-dsa/fstab-freebsd',
-		}
-	}
-	file { '/etc/schroot/dsa/default-mirror':
-		content => template('porterbox/default-mirror.erb'),
-	}
-	file { '/etc/schroot/setup.d/99porterbox-extra-apt-options':
-		mode    => '0555',
-		source  => 'puppet:///modules/porterbox/schroot-setup.d/99porterbox-extra-apt-options',
-		require => Package['schroot'],
-	}
-	file { '/etc/schroot/setup.d/99porterbox-extra-sources':
-		mode    => '0555',
-		source  => 'puppet:///modules/porterbox/schroot-setup.d/99porterbox-extra-sources',
-		require => Package['schroot'],
-	}
 	file { '/usr/local/bin/dd-schroot-cmd':
 		mode    => '0555',
 		source  => 'puppet:///modules/porterbox/dd-schroot-cmd',
diff --git a/modules/porterbox/templates/default-mirror.erb b/modules/porterbox/templates/default-mirror.erb
deleted file mode 100644
index a5822f9a..00000000
--- a/modules/porterbox/templates/default-mirror.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-<%=
-ninfo = scope.lookupvar('site::nodeinfo')
-if ninfo['hoster'].has_key?('mirror-debian') then
-    ninfo['hoster']['mirror-debian']
-else
-    'http://cdn.debian.net/debian'
-end
-%>
diff --git a/modules/schroot/files/schroot-dsa/config b/modules/schroot/files/schroot-dsa/config
new file mode 100644
index 00000000..ba94f6fe
--- /dev/null
+++ b/modules/schroot/files/schroot-dsa/config
@@ -0,0 +1,52 @@
+# Settings for "dsa" profile.
+
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
+##
+
+FSTAB="/etc/schroot/dsa/fstab"
+[ -e "$FSTAB" ] || FSTAB="/etc/schroot/default/fstab"
+
+COPYFILES="/etc/schroot/dsa/copyfiles"
+[ -e "$COPYFILES" ] || COPYFILES="/etc/schroot/default/copyfiles"
+
+NSSDATABASES="/etc/schroot/dsa/nssdatabases"
+[ -e "$NSSDATABASES" ] || NSSDATABASES="/etc/schroot/default/nssdatabases"
+
+
+# added by weasel:
+if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
+    case $CHROOT_DESCRIPTION in
+        "["*-*_*-dchroot"]"*)
+            chroot_type="$CHROOT_DESCRIPTION"; chroot_type="${chroot_type#\[}"; chroot_type="${chroot_type%%]*}"
+            suitevariant_arch_tuple="${chroot_type%%-dchroot-*}"
+            suitevariant=${suitevariant_arch_tuple%_*}
+            SUITE_BASE=${suitevariant%-*}
+            SUITE_VARIANT=${suitevariant##*-}
+        ;;
+        "["*_*-dchroot"]"*)
+            chroot_type="$CHROOT_DESCRIPTION"; chroot_type="${chroot_type#\[}"; chroot_type="${chroot_type%%]*}"
+            SUITE_BASE="${chroot_type%%_*}"
+        ;;
+        *)
+            if [ "$STAGE" = "setup-start" ]; then
+               echo >&2 "Unable to parse chroot description for what kind of chroot you want."
+               exit 1
+            fi
+        ;;
+    esac
+fi
+
+CHROOT_FILE_UNPACK_DIR=/srv/chroot/schroot-unpack
+
+if [ -e /etc/schroot/dsa/default-mirror ]; then
+    MIRROR=$(cat /etc/schroot/dsa/default-mirror )
+fi
+MIRROR=${MIRROR:-cdn.debian.net}
+
+if [ "$(basename "$0")" = "00check" ] &&
+   [ "$CHROOT_TYPE" = "file" ] &&
+   [ "$STAGE" = "setup-start" ]; then
+        echo "Untarring chroot environment.  This might take a minute or two."
+fi
diff --git a/modules/schroot/files/schroot-setup.d/99porterbox-extra-apt-options b/modules/schroot/files/schroot-setup.d/99porterbox-extra-apt-options
new file mode 100755
index 00000000..db240dac
--- /dev/null
+++ b/modules/schroot/files/schroot-setup.d/99porterbox-extra-apt-options
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
+##
+
+# by weasel
+
+set -e
+
+[ "$CHROOT_PROFILE" = "dsa" ] || exit 0
+
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
+if [ -f "${CHROOT_SCRIPT_CONFIG:-}" ]; then
+    . "$CHROOT_SCRIPT_CONFIG"
+fi
+
+
+if [ "$1" = "setup-start" ] || [ "$1" = "setup-recover" ]; then
+	TGT="${CHROOT_PATH}/etc/apt/apt.conf.d/local-schroot"
+	rm -f "$TGT"
+	cat > "$TGT" << EOF
+APT::Install-Recommends 0;
+Acquire::http::Pipeline-Depth "0";
+Acquire::Languages "none";
+Acquire::PDiffs "false";
+EOF
+#Acquire  {
+#     http { Proxy "http://10.213.12.1:3128/"; };
+#     ftp { Proxy "http://10.213.12.1:3128/"; };
+#}
+fi
diff --git a/modules/schroot/files/schroot-setup.d/99porterbox-extra-sources b/modules/schroot/files/schroot-setup.d/99porterbox-extra-sources
new file mode 100755
index 00000000..2bdff1bb
--- /dev/null
+++ b/modules/schroot/files/schroot-setup.d/99porterbox-extra-sources
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
+##
+
+# by weasel
+
+set -e
+
+[ "$CHROOT_PROFILE" = "dsa" ] || exit 0
+
+. "$SETUP_DATA_DIR/common-data"
+. "$SETUP_DATA_DIR/common-functions"
+
+if [ -f "${CHROOT_SCRIPT_CONFIG:-}" ]; then
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ -f "$CHROOT_PROFILE_DIR/config" ]; then
+    . "$CHROOT_PROFILE_DIR/config"
+else
+    fatal "Cannot find config script"
+fi
+
+
+if [ "$1" = "setup-start" ] || [ "$1" = "setup-recover" ]; then
+  SRCL="${CHROOT_PATH}/etc/apt/sources.list.d/auto.list"
+  rm -f "$SRCL"
+  mirror=${MIRROR:-http://cdn.debian.net/debian}
+
+  case "${SUITE_BASE:-}" in
+    experimental)
+      echo "deb     $mirror sid main" >> "$SRCL"
+      echo "deb-src $mirror sid main" >> "$SRCL"
+      ;;
+    sid|jessie)
+      ;;
+    *)
+      echo "deb     http://security.debian.org/ ${SUITE_BASE}/updates main" >> "$SRCL"
+      echo "deb-src http://security.debian.org/ ${SUITE_BASE}/updates main" >> "$SRCL"
+      ;;
+  esac
+  echo "deb     $mirror ${SUITE_BASE} main" >> "$SRCL"
+  echo "deb-src $mirror ${SUITE_BASE} main" >> "$SRCL"
+
+  case "${SUITE_VARIANT:-}" in
+    backports)
+      case "${SUITE_BASE:-}" in
+        squeeze)
+          echo "deb     http://backports.debian.org/debian-backports/ ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
+          echo "deb-src http://backports.debian.org/debian-backports/ ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
+          ;;
+        *)
+          echo "deb     $mirror ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
+          echo "deb-src $mirror ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
+          ;;
+      esac
+      ;;
+  esac
+  echo "o To install build dependencies run"
+  echo "  dd-schroot-cmd -c ${SESSION_ID} apt-get update"
+  echo "  followed by build-dep/install as appropriate in the host system."
+  echo "o If you started this session with schroot -b, please do not forget to run"
+  echo "  schroot --end-session -c ${SESSION_ID}"
+  echo "  when you no longer need this environment."
+fi
diff --git a/modules/schroot/manifests/init.pp b/modules/schroot/manifests/init.pp
index e746990f..2e22db30 100644
--- a/modules/schroot/manifests/init.pp
+++ b/modules/schroot/manifests/init.pp
@@ -6,18 +6,47 @@ class schroot {
 	package { 'debootstrap':
 		ensure => installed,
 	}
-
-	file { '/etc/schroot/mount-defaults':
-		content => template('schroot/etc/schroot/mount-defaults.erb'),
-		require => Package['schroot'],
+	package { 'moreutils':
+		ensure => installed
 	}
+
 	file { '/etc/default/schroot':
 		source  => 'puppet:///modules/schroot/default-schroot',
 		require => Package['schroot']
 	}
 
+	file { '/etc/schroot/mount-defaults':
+		content => template('schroot/mount-defaults.erb'),
+		require => Package['schroot'],
+	}
 	file { '/etc/schroot/default/nssdatabases':
 		source  => 'puppet:///modules/schroot/nssdatabases',
 		require => Package['schroot']
 	}
+
+	file { '/etc/schroot/setup.d/99porterbox-extra-apt-options':
+		mode    => '0555',
+		source  => 'puppet:///modules/schroot/schroot-setup.d/99porterbox-extra-apt-options',
+		require => Package['schroot'],
+	}
+	file { '/etc/schroot/setup.d/99porterbox-extra-sources':
+		mode    => '0555',
+		source  => 'puppet:///modules/schroot/schroot-setup.d/99porterbox-extra-sources',
+		require => Package['schroot'],
+	}
+
+	file { '/etc/schroot/dsa':
+		ensure => directory,
+		require => Package['schroot'],
+	}
+	file { '/etc/schroot/dsa/default-mirror':
+		content => template('schroot/default-mirror.erb'),
+	}
+	file { '/etc/schroot/dsa/config':
+		source  => 'puppet:///modules/schroot/schroot-dsa/config',
+	}
+	file { '/etc/schroot/dsa/fstab':
+		content => template('schroot/schroot-dsa/fstab.erb'),
+		require => Package['schroot'],
+	}
 }
diff --git a/modules/schroot/templates/default-mirror.erb b/modules/schroot/templates/default-mirror.erb
new file mode 100644
index 00000000..a5822f9a
--- /dev/null
+++ b/modules/schroot/templates/default-mirror.erb
@@ -0,0 +1,8 @@
+<%=
+ninfo = scope.lookupvar('site::nodeinfo')
+if ninfo['hoster'].has_key?('mirror-debian') then
+    ninfo['hoster']['mirror-debian']
+else
+    'http://cdn.debian.net/debian'
+end
+%>
diff --git a/modules/schroot/templates/etc/schroot/mount-defaults.erb b/modules/schroot/templates/etc/schroot/mount-defaults.erb
deleted file mode 100644
index 9dc2d518..00000000
--- a/modules/schroot/templates/etc/schroot/mount-defaults.erb
+++ /dev/null
@@ -1,22 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-# mount.defaults: 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>
-<% if scope.lookupvar('site::nodeinfo')['ldap'].has_key?('architecture') and scope.lookupvar('site::nodeinfo')['ldap']['architecture'][0].start_with?('kfreebsd') -%>
-# kFreeBSD version
-proc		/proc		linprocfs	defaults	0	0
-dev		/dev		devfs	rw,bind		0	0
-dev		/dev/fd		fdescfs	rw,bind		0	0
-sys		/sys		linsysfs	defaults	0	0
-<% else -%>
-# Linux version
-proc            /proc           proc    defaults        0       0
-/dev/pts        /dev/pts        none    rw,bind         0       0
-tmpfs           /dev/shm        tmpfs   defaults        0       0
-<% end %>
-
diff --git a/modules/schroot/templates/mount-defaults.erb b/modules/schroot/templates/mount-defaults.erb
new file mode 100644
index 00000000..9dc2d518
--- /dev/null
+++ b/modules/schroot/templates/mount-defaults.erb
@@ -0,0 +1,22 @@
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
+##
+# mount.defaults: 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>
+<% if scope.lookupvar('site::nodeinfo')['ldap'].has_key?('architecture') and scope.lookupvar('site::nodeinfo')['ldap']['architecture'][0].start_with?('kfreebsd') -%>
+# kFreeBSD version
+proc		/proc		linprocfs	defaults	0	0
+dev		/dev		devfs	rw,bind		0	0
+dev		/dev/fd		fdescfs	rw,bind		0	0
+sys		/sys		linsysfs	defaults	0	0
+<% else -%>
+# Linux version
+proc            /proc           proc    defaults        0       0
+/dev/pts        /dev/pts        none    rw,bind         0       0
+tmpfs           /dev/shm        tmpfs   defaults        0       0
+<% end %>
+
diff --git a/modules/schroot/templates/schroot-dsa/fstab.erb b/modules/schroot/templates/schroot-dsa/fstab.erb
new file mode 100644
index 00000000..2e2cd1b0
--- /dev/null
+++ b/modules/schroot/templates/schroot-dsa/fstab.erb
@@ -0,0 +1,25 @@
+# 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>
+
+<% if scope.lookupvar('site::nodeinfo')['ldap'].has_key?('architecture') and scope.lookupvar('site::nodeinfo')['ldap']['architecture'][0].start_with?('kfreebsd') -%>
+# kFreeBSD version
+proc		/proc		linprocfs	defaults	0	0
+dev		/dev		devfs	rw,bind		0	0
+dev		/dev/fd		fdescfs	rw,bind		0	0
+/home		/home		nullfs	rw		0	0
+/tmp		/tmp		nullfs	rw		0	0
+
+<% else -%>
+# Linux version
+/proc		/proc		none	rw,bind		0	0
+/sys		/sys		none	rw,bind		0	0
+/dev		/dev		none	rw,bind		0	0
+/dev/pts	/dev/pts	none	rw,bind		0	0
+/home		/home		none	rw,bind		0	0
+/tmp		/tmp		none	rw,bind		0	0
+tmpfs-shm	/dev/shm	tmpfs	defaults,size=64m	0 0
+
+<% end %>