1
0
mirror of https://github.com/rancher/os.git synced 2025-08-17 22:38:22 +00:00
os/scripts/run
Darren Shepherd 5675644d9f Add operator
2021-10-20 10:58:54 -07:00

56 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e -x
mkdir -p build
cd build
if [ ! -e disk.img ]; then
qemu-img create -f qcow2 disk.img 40g
fi
touch meta-data
touch user-data
rm -f seed.iso
mkisofs -output seed.iso -volid cidata -joliet -rock user-data meta-data
BOOT=
if [ "$1" = "pxe" ]; then
shift 1
if [ ! -e ipxe.cfg ]; then
if [ ! -e ../dist/artifacts/rancheros-dev.ipxe ]; then
make -C .. package
fi
if [ -e ../dist/artifacts/rancheros-dev.ipxe ]; then
cp ../dist/artifacts/rancheros-dev.ipxe ipxe.cfg
fi
fi
BOOT="-boot cn"
if [ ! -e dev ]; then
ln -s ../dist/artifacts dev
fi
fi
if [ "$1" == "" ] && [ ! -e output.iso ]; then
make -C .. build iso
fi
#-bios /usr/share/qemu/OVMF.fd \
qemu-system-x86_64 \
$BOOT \
-enable-kvm \
-m ${MEMORY:=4096} \
-machine accel=${ACCEL:="kvm"} \
-smp cores=4 \
-nographic \
-serial mon:stdio \
-rtc base=utc,clock=rt \
-chardev socket,path=qga.sock,server,nowait,id=qga0 \
-nic user,tftp=./,bootfile=/ipxe.cfg,hostfwd=tcp:127.0.0.1:2222-:22 \
-device virtio-serial \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
-drive if=virtio,media=disk,file=disk.img \
-drive if=ide,media=cdrom,file=${1:-output.iso} \
-drive if=ide,media=cdrom,file=seed.iso