1
0
mirror of https://github.com/rancher/os.git synced 2025-09-18 16:27:31 +00:00

scripts/run: create an empty raw disk image if not present

use autoformat with formatzero=true to format the disk
This commit is contained in:
Ivan Mikushin
2015-07-28 21:56:04 +05:00
parent 5c84f36d79
commit de3bfed810

View File

@@ -74,7 +74,9 @@ find . | cpio -H newc -o > ${INITRD_TEST}
if [ ! -e ${HD} ]; then if [ ! -e ${HD} ]; then
mkdir -p $(dirname ${HD}) mkdir -p $(dirname ${HD})
gzip -dc ${HD_GZ} > ${HD} if [ "$UNAME" == "Darwin" ]; then qemu-img create -f raw -o size=10G ${HD}
elif [ "$UNAME" == "Linux" ]; then gzip -dc ${HD_GZ} > ${HD};
fi
fi fi
mkdir -p $(dirname $USER_DATA) mkdir -p $(dirname $USER_DATA)
@@ -92,7 +94,7 @@ else
done done
fi fi
KERNEL_ARGS="quiet rancher.password=rancher console=ttyS0 ${QEMU_APPEND}" KERNEL_ARGS="rancher.password=rancher console=ttyS0 ${QEMU_APPEND}"
if [ "$UNAME" == "Darwin" ] && [ -x $(which xhyve) ]; then if [ "$UNAME" == "Darwin" ] && [ -x $(which xhyve) ]; then
@@ -109,8 +111,9 @@ if [ "$UNAME" == "Darwin" ] && [ -x $(which xhyve) ]; then
-l com1,stdio \ -l com1,stdio \
-s 2:0,virtio-net \ -s 2:0,virtio-net \
-s 3,ahci-cd,${CLOUD_CONFIG_ISO} \ -s 3,ahci-cd,${CLOUD_CONFIG_ISO} \
-s 4,virtio-blk,${HD} \
-U a01fb25c-3a19-4759-a47a-2e353e51807d \ -U a01fb25c-3a19-4759-a47a-2e353e51807d \
-f kexec,${KERNEL},${INITRD_TEST},"earlyprintk=serial elevator=noop ${KERNEL_ARGS}" -f kexec,${KERNEL},${INITRD_TEST},"earlyprintk=serial elevator=noop rancher.state.formatzero=true rancher.state.autoformat=[/dev/sda,/dev/vda] ${KERNEL_ARGS}"
elif [ "$UNAME" == "Linux" ] && [ -x $(which qemu-system-x86_64) ]; then elif [ "$UNAME" == "Linux" ] && [ -x $(which qemu-system-x86_64) ]; then
exec qemu-system-x86_64 -serial stdio \ exec qemu-system-x86_64 -serial stdio \