Add selection for ext3/ext4 as worker's root disk-image filesystem.
authorJan-Simon Möller <jsmoeller@linuxfoundation.org>
Wed, 17 Mar 2010 18:07:16 +0000 (19:07 +0100)
committerJan-Simon Möller <jsmoeller@linuxfoundation.org>
Fri, 26 Mar 2010 14:51:55 +0000 (15:51 +0100)
Signed-off-by: Martin Mohring <martinmohring@linuxfoundation.org>
Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
build

diff --git a/build b/build
index 2cfd1a1..63aca50 100755 (executable)
--- a/build
+++ b/build
@@ -198,10 +198,12 @@ Known Parameters:
               This must be set to the same value if the buildroot is re-used.
 
   --vmdisk-autosetup
-  --vmdisk-rootsize  <size in GB>
-  --vmdisk-swapsize  <size in GB>
+  --vmdisk-rootsize   <size in GB>
+  --vmdisk-swapsize   <size in GB>
+  --vmdisk-filesystem <ext3|ext4>
   --vmdisk-force                       [forces (re-)setup]
               Enable automatic setup of VM root/swap files
+
   --debug
               enable creation of a debuginfo package
 
@@ -705,6 +707,10 @@ while test -n "$1"; do
       *-vmdisk-force)
         VMDISK_FORCE=true
       ;;
+      *-vmdisk-filesystem)
+        VMDISK_FILESYSTEM="$ARG"
+        shift
+      ;;
       *-rpmlist)
        RPMLIST="--rpmlist $ARG"
        BUILD_RPMS=
@@ -931,34 +937,38 @@ if test -n "$LIST_STATE" ; then
     cleanup_and_exit $ERR
 fi
 
+if test "ext4" = "$VMDISK_FILESYSTEM"; then
+    vm_img_mkfs='mkfs.ext4 -m 0 -q -F'
+    #$vm_img_tunefs
+fi
 
 if test -z "$RUNNING_IN_VM" ; then
     if test -n "$VM_IMAGE" ; then
        if test "$VM_IMAGE" = 1 ; then
            VM_IMAGE="$BUILD_ROOT.img"
        fi
-        if test -n "$VMDISK_AUTOSETUP"; then
-            if test -n "$VMDISK_ROOTSIZE" -a -n "$VMDISK_SWAPSIZE" ; then
-                if test -e "$VM_IMAGE" -a -e "$VM_SWAP" -a ! "$VMDISK_FORCE"; then
-                    echo "$BUILD_ROOT and $VM_SWAP present, skipping autosetup without --vmdisk-force being set."
-                else
-                    # assuming GB for size ! thus root=4 swap=1 
-                    # setup VM_IMAGE
-                    dd if=/dev/zero of="$VM_IMAGE" bs=1 count=1 seek=$(( ${VMDISK_ROOTSIZE} * 1024 * 1024 * 1024 )) || cleanup_and_exit 3
-                    $vm_img_mkfs $VM_IMAGE || cleanup_and_exit 3
-                    if test -n "$vm_img_tunefs" ; then
-                        $vm_img_tunefs $VM_IMAGE || cleanup_and_exit 3
-                    fi
-                    # setup VM_SWAP
-                    dd if=/dev/zero of="$VM_SWAP" bs=1 count=1 seek=$(( ${VMDISK_SWAPSIZE} * 1024 * 1024 * 1024 )) || cleanup_and_exit 3
-                    mkswap "$VM_SWAP" || cleanup_and_exit 3
-                fi
+    if test -n "$VMDISK_AUTOSETUP"; then
+        if test -n "$VMDISK_ROOTSIZE" -a -n "$VMDISK_SWAPSIZE" ; then
+            if test -e "$VM_IMAGE" -a -e "$VM_SWAP" -a ! "$VMDISK_FORCE"; then
+                echo "$BUILD_ROOT and $VM_SWAP present, skipping autosetup without --vmdisk-force being set."
             else
-                echo "--vmdisk-autosetup used, but either --vmdisk-rootsize or --vmdisk-swapsize not set."
-                cleanup_and_exit 3
-                # error, bad build(-host) setup
+                # assuming GB for size ! thus root=4 swap=1 
+                # setup VM_IMAGE
+                dd if=/dev/zero of="$VM_IMAGE" bs=1 count=1 seek=$(( ${VMDISK_ROOTSIZE} * 1024 * 1024 * 1024 )) || cleanup_and_exit 3
+                $vm_img_mkfs $VM_IMAGE || cleanup_and_exit 3
+                if test -n "$vm_img_tunefs" ; then
+                    $vm_img_tunefs $VM_IMAGE || cleanup_and_exit 3
+                fi
+                # setup VM_SWAP
+                dd if=/dev/zero of="$VM_SWAP" bs=1 count=1 seek=$(( ${VMDISK_SWAPSIZE} * 1024 * 1024 * 1024 )) || cleanup_and_exit 3
+                mkswap "$VM_SWAP" || cleanup_and_exit 3
             fi
+        else
+            echo "--vmdisk-autosetup used, but either --vmdisk-rootsize or --vmdisk-swapsize not set."
+            cleanup_and_exit 3
+            # error, bad build(-host) setup
         fi
+    fi
        if test ! -e "$VM_IMAGE" ; then
            echo "you need to create a file system on $VM_IMAGE first"
            cleanup_and_exit 3
@@ -969,7 +979,7 @@ if test -z "$RUNNING_IN_VM" ; then
            echo "Creating filesystem on $VM_IMAGE"
            $vm_img_mkfs $VM_IMAGE || cleanup_and_exit 3
            if test -n "$vm_img_tunefs" ; then
-               $vm_img_tunefs $VM_IMAGE || cleanup_and_exit 3
+                 $vm_img_tunefs $VM_IMAGE || cleanup_and_exit 3
            fi
        fi
        mkdir_build_root