Support building chroots that debootstrap does not know yet
[mirror/dsa-puppet.git] / modules / porterbox / files / setup-dchroot
index d763f59..61d91b2 100755 (executable)
@@ -236,6 +236,14 @@ fi
 rootdir=$(mktemp -d "$builddir/create-$suite-XXXXXX")
 cleanup+=("rm -r $rootdir")
 cleanup+=("umount $rootdir/sys")
+script=/usr/share/debootstrap/scripts/"$suite"
+if ! [ -e "$script" ]; then
+    if [ -z "$ubuntu" ]; then
+        script=/usr/share/debootstrap/scripts/sid
+    else
+        script=/usr/share/debootstrap/scripts/gutsy
+    fi
+fi
 
 set -x
 debootstrap \
@@ -243,8 +251,9 @@ debootstrap \
     --include="apt" \
     --variant=buildd \
     --arch="$arch" \
-    "$suite" "$rootdir" "$mirror"
-echo "$tuple" > $rootdir/etc/debian_chroot
+    "$suite" "$rootdir" "$mirror" "$script"
+echo "$tuple" > "$rootdir/etc/debian_chroot"
+echo "force-unsafe-io" > "$rootdir/etc/dpkg/dpkg.cfg.d/force-unsafe-io"
 
 chroot "$rootdir" apt-get update
 chroot "$rootdir" apt-get install -y --force-yes --no-install-recommends policyrcd-script-zg2