]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
pass dchroot type in description
authorPeter Palfrader <peter@palfrader.org>
Mon, 22 Apr 2013 20:33:45 +0000 (22:33 +0200)
committerPeter Palfrader <peter@palfrader.org>
Mon, 22 Apr 2013 20:33:53 +0000 (22:33 +0200)
modules/porterbox/files/schroot-dsa/config
modules/porterbox/files/setup-dchroot

index 172cae4986080ac1bcd0f7f7e37e7ed75e89724c..cd47ce2330a28d96258ead34bf8a3a0431c83423 100644 (file)
@@ -9,15 +9,21 @@
 
 # added by weasel:
 if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
-    case $CHROOT_NAME in
-        *-*_*-dchroot-*)
-            suitevariant_arch_tuple=${CHROOT_NAME%%-dchroot-*}
+    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-*)
-            SUITE_BASE=${CHROOT_NAME%%_*}
+        "["*_*-dchroot"]"*)
+            chroot_type="$CHROOT_DESCRIPTION"; chroot_type="${chroot_type#[}"; chroot_type="${chroot_type%%]*}"
+            SUITE_BASE="${chroot_type%%_*}"
+        ;;
+        *)
+            echo >&2 "Unable to parse chroot description for what kind of chroot you want."
+            exit 1
         ;;
     esac
 fi
index 862e99f1397f4d9c6aa59c18e3674b6b5f063470..f1925a21ee6c0d23bd2845af774c001cb14345c1 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
@@ -113,12 +114,13 @@ if [ -e /etc/schroot/dsa/default-mirror ]; then
     mirror=$(cat /etc/schroot/dsa/default-mirror )
 fi
 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 +129,9 @@ do
         b)
             basedir="$OPTARG"
             ;;
+        c)
+            configonly="1"
+            ;;
         f)
             force="1"
             ;;
@@ -166,6 +171,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")