You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

74 lines
1.2 KiB

  1. #!/bin/bash
  2. # try to boot the ISO in qemu
  3. . config || exit 0
  4. usage() {
  5. cat <<EOF
  6. usage: $0 [-i iso] <-c | -d>
  7. -c Make an empty disk image and boot from CD
  8. -d Boot the disk image
  9. -i Path to iso
  10. EOF
  11. exit 0
  12. }
  13. boot=""
  14. iso="${OUTPUT}"
  15. while getopts cdi: flag; do
  16. case $flag in
  17. c)
  18. boot="c$boot"
  19. ;;
  20. d)
  21. boot="d$boot"
  22. ;;
  23. i)
  24. iso="$OPTARG"
  25. ;;
  26. ?)
  27. usage
  28. ;;
  29. esac
  30. done
  31. case $boot in
  32. ?)
  33. ;;
  34. *)
  35. usage
  36. ;;
  37. esac
  38. set -e
  39. set -x
  40. cfg=""
  41. cfg+=" -drive file=${DISK},media=disk,format=raw,if=virtio"
  42. cfg+=" -enable-kvm"
  43. cfg+=" -m 2048"
  44. cfg+=" -usbdevice tablet"
  45. cfg+=" -vga vmware"
  46. #cfg+=" -vnc :0"
  47. case $boot in
  48. c)
  49. echo "booting CD with empty disk"
  50. rm -f ${DISK}
  51. dd if=/dev/zero "of=${DISK}" bs=1M count=0 seek=10240
  52. cfg+=" -drive file=${iso},media=cdrom,if=none,id=cd"
  53. cfg+=" -device virtio-scsi-pci -device scsi-cd,drive=cd"
  54. cfg+=" -boot d"
  55. ;;
  56. d)
  57. echo "booting disk with no CD"
  58. cfg+=" -boot c"
  59. ;;
  60. esac
  61. qemu-system-x86_64 $cfg