]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - modules/porterbox/files/setup-dchroot
And say it even when hostarch matches its running kernel
[dsa-puppet.git] / modules / porterbox / files / setup-dchroot
index 0cba6fa12f1e5af1958e1dc22e0e269757aca444..10cc07e71b80378e975973b17eec781a371a86d0 100755 (executable)
@@ -40,6 +40,7 @@ OPTIONS:
     -m MIRROR  http mirror to use [$mirror]
     -b basedir place where to build the chroot/tarball [$basedir]
     -f         overwrite stuff.
+    -c         write config only.
     -h         this help.
 EOF
 }
@@ -69,7 +70,7 @@ genschrootconf() {
 
 cat << EOF
 [${suite}_${arch}-dchroot]
-description=Debian $suite chroot for $arch
+description=[${suite}_${arch}-dchroot] Debian $suite chroot for $arch
 type=file
 file=$target
 groups=Debian,guest
@@ -81,13 +82,12 @@ EOF
 
     if [ "$THISARCH" = "$arch" ]; then
         echo "aliases=$suite"
-    else
-        case "$arch" in
-            i386)
-                echo "personality=linux32"
-                ;;
-        esac
     fi
+    case "$arch" in
+        armel|armhf|i386|powerpc|s390|sparc)
+            echo "personality=linux32"
+            ;;
+    esac
     echo
 
     case "$suite" in
@@ -112,13 +112,14 @@ arch="$THISARCH"
 if [ -e /etc/schroot/dsa/default-mirror ]; then
     mirror=$(cat /etc/schroot/dsa/default-mirror )
 fi
-mirror="${mirror:-cdn.debian.net}"
+mirror="${mirror:-http://cdn.debian.net/debian}"
+configonly=""
 force=""
 basedir="/srv/chroot"
 declare -a cleanup
 trap do_cleanup EXIT
 
-while getopts "a:b:fhm:" OPTION
+while getopts "a:b:cfhm:" OPTION
 do
     case $OPTION in
         a)
@@ -127,6 +128,9 @@ do
         b)
             basedir="$OPTARG"
             ;;
+        c)
+            configonly="1"
+            ;;
         f)
             force="1"
             ;;
@@ -166,6 +170,8 @@ schrootconfig="/etc/schroot/chroot.d/${tuple}-dchroot"
 #
 genschrootconf "$suite" "$arch" "$target" | tee "$schrootconfig"
 
+if [ -n "$configonly" ]; then exit 0; fi
+
 rootdir=$(mktemp -d "$basedir/create-$suite-XXXXXX")
 cleanup+=("rm -r $rootdir")
 cleanup+=("umount $rootdir/sys")
@@ -176,7 +182,7 @@ debootstrap \
     --include="apt" \
     --variant=buildd \
     --arch="$arch" \
-    "$suite" "$rootdir" "http://$mirror/debian"
+    "$suite" "$rootdir" "$mirror"
 echo "$tuple" > $rootdir/etc/debian_chroot
 
 chroot "$rootdir" apt-get update
@@ -199,7 +205,7 @@ while true; do
 done
 EOF
 chmod +x "$rootdir/usr/local/sbin/policy-rc.d"
-chroot "$rootdir" apt-get install -y --no-install-recommends zsh locales-all build-essential vim fakeroot devscripts gdb
+chroot "$rootdir" apt-get install -y --no-install-recommends zsh locales-all build-essential less vim fakeroot devscripts gdb
 rm -f "$rootdir/etc/apt/sources.list" "$rootdir/etc/apt/sources.list.d/*"
 umount "$rootdir/sys" || true