From 6cbd6ae1bd1670b352393e8e677e11e187c19206 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan-Simon=20M=C3=B6ller?= Date: Wed, 17 Mar 2010 19:07:16 +0100 Subject: [PATCH] Add selection for ext3/ext4 as worker's root disk-image filesystem. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Mohring Signed-off-by: Jan-Simon Möller --- build | 54 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/build b/build index 2cfd1a1..63aca50 100755 --- 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 - --vmdisk-swapsize + --vmdisk-rootsize + --vmdisk-swapsize + --vmdisk-filesystem --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 -- 2.7.4