build.bash 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/bash
  2. set -e
  3. # Download Plan 9
  4. if [ ! -e 9legacy.iso ] && [ ! -e 9legacy.iso.bz2 ]; then
  5. curl -L --fail -O https://github.com/Harvey-OS/harvey/releases/download/9legacy/9legacy.iso.bz2
  6. fi
  7. if [ ! -e 9legacy.iso ]; then
  8. bunzip2 -k 9legacy.iso.bz2
  9. fi
  10. # Get the Go program source fetched
  11. (cd ../sys/src/cmd/go && sh fetchrepos.sh)
  12. # Make directories as needed
  13. (cd ..; bash ./build/mkdirs)
  14. rm -f harvey.tgz
  15. (cd ..; tar --format ustar --exclude './build' --exclude harvey.tgz --exclude .git --exclude '9legacy.iso*' -czf harvey.tgz *)
  16. FLAG_KVM=""
  17. case $(uname -s) in
  18. "Linux") FLAG_KVM="-accel kvm" ;;
  19. esac
  20. expect <<EOF
  21. spawn qemu-system-i386 $FLAG_KVM -nographic -net user -net nic,model=virtio -m 4096 -vga none -cdrom 9legacy.iso -boot d -hda ../harvey.tgz
  22. expect -exact "Selection:"
  23. send "2\n"
  24. expect -exact "Plan 9"
  25. sleep 5
  26. expect -timeout 600 "root is from (tcp, local)"
  27. send "local\n"
  28. expect -exact "mouseport is (ps2, ps2intellimouse, 0, 1, 2)\[ps2\]:"
  29. send "ps2intellimouse\n"
  30. expect -re "vgasize .*:"
  31. send "1280x1024x32\n"
  32. expect -re "monitor is .*:"
  33. send "vesa\n"
  34. # Mount the host's fileserver
  35. #expect -exact "term% "
  36. #send "9fs tcp!10.0.2.2!5640 /n/harvey\n"
  37. set timeout 2400
  38. # 9fs is fucking slow, so let's be stupid
  39. expect -exact "term% "
  40. send "ramfs -u -m /n/harvey\n"
  41. expect -exact "term% "
  42. send "ramfs -u -m /tmp\n"
  43. expect -exact "term% "
  44. send "cd /n/harvey\n"
  45. expect -exact "term% "
  46. send "gunzip < /dev/sdC0/data | tar x\n"
  47. expect -exact "term% "
  48. send "srv -c tcp!10.0.2.2!5640 host /n/host\n"
  49. expect -exact "term% "
  50. send "bind -a /n/harvey/sys/go/bin/plan9_386 /bin\n"
  51. # Go to the build dir
  52. expect -exact "term% "
  53. send "cd /n/harvey/build/scripts\n"
  54. # build the ISO
  55. expect -exact "term% "
  56. send "rc build && rc repl && rc iso\n"
  57. expect -exact "term% "
  58. send "time fcp /tmp/dist/plan9-new.iso.bz2 /n/host/\n"
  59. # and shut down
  60. expect -exact "term% "
  61. send "fshalt\n"
  62. expect -exact "done halting"
  63. exit
  64. EOF
  65. rm ../harvey.tgz