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.

run.sh 1.2 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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+=" -nodefaults"
  42. cfg+=" -drive file=${DISK},media=disk,format=raw,if=virtio"
  43. cfg+=" -enable-kvm"
  44. cfg+=" -m 2048"
  45. cfg+=" -usb"
  46. cfg+=" -device usb-tablet"
  47. cfg+=" -nic user"
  48. cfg+=" -vga virtio"
  49. cfg+=" -k en-us"
  50. #cfg+=" -vnc :0"
  51. case $boot in
  52. c)
  53. echo "booting CD with empty disk"
  54. rm -f ${DISK}
  55. dd if=/dev/zero "of=${DISK}" bs=1M count=0 seek=24576
  56. cfg+=" -drive file=${iso},media=cdrom,if=none,id=cd"
  57. cfg+=" -device virtio-scsi-pci -device scsi-cd,drive=cd"
  58. cfg+=" -boot d"
  59. ;;
  60. d)
  61. echo "booting disk with no CD"
  62. cfg+=" -boot c"
  63. ;;
  64. esac
  65. qemu-system-x86_64 $cfg