command.bash 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. set -e
  2. # Download Plan 9
  3. if [ ! -e 9legacy.iso ] && [ ! -e 9legacy.iso.bz2 ]; then
  4. curl -L --fail -O https://github.com/Harvey-OS/harvey/releases/download/9legacy/9legacy.iso.bz2
  5. fi
  6. if [ ! -e 9legacy.iso ]; then
  7. bunzip2 -k 9legacy.iso.bz2
  8. fi
  9. expect <<EOF
  10. spawn qemu-system-i386 -nographic -net user -net nic,model=virtio -m 1024 -vga none -cdrom 9legacy.iso -boot d
  11. expect -exact "Selection:"
  12. send "2\n"
  13. expect -exact "Plan 9"
  14. sleep 5
  15. expect -timeout 600 "root is from (tcp, local)"
  16. send "local\n"
  17. expect -exact "mouseport is (ps2, ps2intellimouse, 0, 1, 2)\[ps2\]:"
  18. send "ps2intellimouse\n"
  19. expect -re "vgasize .*:"
  20. send "1280x1024x32\n"
  21. expect -re "monitor is .*:"
  22. send "vesa\n"
  23. # Mount the host's fileserver
  24. expect -exact "term% "
  25. send "9fs tcp!10.0.2.2!5640 /n/harvey\n"
  26. # Now run a command
  27. expect -exact "term% "
  28. send "ls -l /n/harvey/\n"
  29. expect -exact "term% "
  30. send "ls -l /n/harvey/build\n"
  31. expect -exact "term% "
  32. send "ls -l /n/harvey/build/go\n"
  33. # make go available in the image
  34. expect -exact "term% "
  35. # this will make a /go appear, along with all the other stuff we don't want,
  36. # but hey ...
  37. # one option is to great build/go/go and build in there, and then bind that
  38. # in /n/harvey/build/go in /, in which case there will be a /go.
  39. send "bind -a /n/harvey/build /\n"
  40. expect -exact "term% "
  41. send "ls -l /\n"
  42. expect -exact "term% "
  43. send "ls -l /go\n"
  44. # and shut down
  45. expect -exact "term% "
  46. send "fshalt\n"
  47. expect -exact "done halting"
  48. exit
  49. EOF