|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #!/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
-
- case $boot in
- c)
- echo "booting CD with empty disk"
- rm -f disk.img
- dd if=/dev/zero "of=${DISK}" bs=1M count=0 seek=10240
- cfg="-cdrom ${iso} -hda ${DISK} -boot d"
- ;;
- d)
- echo "booting disk with no CD"
- cfg="-hda ${DISK} -boot c"
- ;;
- esac
-
- qemu-system-x86_64 -enable-kvm -m 1024 -vga vmware $cfg
|