2013-08-17 22:28:49 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# try to boot the ISO in qemu
|
|
|
|
. config || exit 0
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
cat <<EOF
|
|
|
|
usage: $0 [-i iso] <-c | -d>
|
|
|
|
|
|
|
|
-c Make an empty disk image and boot from CD
|
|
|
|
-d Boot the disk image
|
|
|
|
-i Path to iso
|
|
|
|
EOF
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
boot=""
|
|
|
|
iso="${OUTPUT}"
|
|
|
|
|
|
|
|
while getopts cdi: flag; do
|
|
|
|
case $flag in
|
|
|
|
c)
|
|
|
|
boot="c$boot"
|
|
|
|
;;
|
|
|
|
d)
|
|
|
|
boot="d$boot"
|
|
|
|
;;
|
|
|
|
i)
|
|
|
|
iso="$OPTARG"
|
|
|
|
;;
|
|
|
|
?)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
case $boot in
|
|
|
|
?)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2016-06-28 11:48:35 -04:00
|
|
|
cfg=""
|
2016-06-28 16:14:01 -04:00
|
|
|
|
|
|
|
cfg+=" -drive file=${DISK},media=disk,format=raw,if=virtio"
|
|
|
|
cfg+=" -enable-kvm"
|
|
|
|
cfg+=" -m 2048"
|
|
|
|
cfg+=" -usbdevice tablet"
|
|
|
|
|
|
|
|
cfg+=" -vga vmware"
|
|
|
|
#cfg+=" -vnc :0"
|
|
|
|
|
2013-08-17 22:28:49 -04:00
|
|
|
case $boot in
|
|
|
|
c)
|
|
|
|
echo "booting CD with empty disk"
|
2013-08-18 23:33:33 -04:00
|
|
|
rm -f ${DISK}
|
2016-07-03 00:20:49 -04:00
|
|
|
dd if=/dev/zero "of=${DISK}" bs=1M count=0 seek=30720
|
2016-06-28 16:14:01 -04:00
|
|
|
cfg+=" -drive file=${iso},media=cdrom,if=none,id=cd"
|
|
|
|
cfg+=" -device virtio-scsi-pci -device scsi-cd,drive=cd"
|
2016-06-28 11:48:35 -04:00
|
|
|
cfg+=" -boot d"
|
2013-08-17 22:28:49 -04:00
|
|
|
;;
|
|
|
|
d)
|
|
|
|
echo "booting disk with no CD"
|
2016-06-28 11:48:35 -04:00
|
|
|
cfg+=" -boot c"
|
2013-08-17 22:28:49 -04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-06-28 16:14:01 -04:00
|
|
|
qemu-system-x86_64 $cfg
|