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.
 
 
 

62 lines
963 B

  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. case $boot in
  41. c)
  42. echo "booting CD with empty disk"
  43. rm -f disk.img
  44. dd if=/dev/zero "of=${DISK}" bs=1M count=0 seek=10240
  45. cfg="-cdrom ${iso} -hda ${DISK} -boot d"
  46. ;;
  47. d)
  48. echo "booting disk with no CD"
  49. cfg="-hda ${DISK} -boot c"
  50. ;;
  51. esac
  52. qemu-system-x86_64 -enable-kvm -m 1024 -vga vmware $cfg