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.
 
 
 

66 lines
1.1 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. case $boot in
  42. c)
  43. echo "booting CD with empty disk"
  44. rm -f ${DISK}
  45. dd if=/dev/zero "of=${DISK}" bs=1M count=0 seek=10240
  46. cfg+=" -drive file=${iso},index=1,media=cdrom"
  47. cfg+=" -drive file=${DISK},index=0,media=disk,format=raw"
  48. cfg+=" -boot d"
  49. ;;
  50. d)
  51. echo "booting disk with no CD"
  52. cfg+=" -drive file=${DISK},index=0,media=disk,format=raw"
  53. cfg+=" -boot c"
  54. ;;
  55. esac
  56. qemu-system-x86_64 -enable-kvm -m 2048 -vga vmware $cfg