make.bash 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. # Copyright 2015 The Go Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style
  3. # license that can be found in the LICENSE file.
  4. # We don't actually use this right now, but it's a way to automatically
  5. # install from an ISO onto a disk image, which seems worth keeping.
  6. set -e
  7. ls -l
  8. file *
  9. ls /usr/bin/qemu*
  10. # Download Plan 9
  11. if [ ! -e 9legacy.iso.bz2 ]; then
  12. curl --fail -O http://9legacy.org/download/9legacy.iso.bz2
  13. # sha1sum -c 9legacy.iso.sha1
  14. fi
  15. if [ ! -e 9legacy.iso ]; then
  16. bunzip2 -k 9legacy.iso.bz2
  17. fi
  18. # Initialize disk image.
  19. rm -f disk.raw
  20. qemu-img create -f raw disk.raw 1G
  21. # Run the installer to create the disk image.
  22. expect <<EOF
  23. spawn qemu-system-i386 -nographic -net user -net nic,model=virtio -m 1024 -vga none -drive if=none,id=hd,file=disk.raw,media=disk,cache=writeback -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd -cdrom 9legacy.iso -boot d
  24. expect -exact "Selection:"
  25. send "1\n"
  26. expect -exact "Plan 9"
  27. sleep 5
  28. # Need to wait for the kernel to boot.
  29. expect -timeout 600 -exact "use DMA for ide drives\[yes\]:"
  30. send "\n"
  31. expect -exact "mouseport is (ps2, ps2intellimouse, 0, 1, 2)\[ps2\]:"
  32. send "ps2intellimouse\n"
  33. expect -re "vgasize .*:"
  34. send "1280x1024x32\n"
  35. expect -re "monitor is .*:"
  36. send "vesa\n"
  37. expect -exact "% "
  38. send "inst/textonly\n"
  39. expect -exact "Task to do \[configfs\]:"
  40. send "\n"
  41. expect -exact "File system (fossil, fossil+venti)\[fossil\]:"
  42. send "\n"
  43. expect -exact "Task to do \[partdisk\]:"
  44. send "\n"
  45. expect -exact "Disk to partition (sd00, sdD0)\[no default\]:"
  46. send "sd00\n"
  47. expect -exact "Install mbr \(y, n\)\[no default\]:"
  48. send "y\n"
  49. expect -exact ">>> "
  50. send "w\n"
  51. expect -exact ">>> "
  52. send "q\n"
  53. expect -exact "Task to do \[prepdisk\]:"
  54. send "\n"
  55. expect -exact "Plan 9 partition to subdivide \(/dev/sd00/plan9\)\[/dev/sd00/plan9\]:"
  56. send "\n"
  57. expect -exact ">>> "
  58. send "w\n"
  59. expect -exact ">>> "
  60. send "q\n"
  61. expect -exact "Task to do \[fmtfossil\]:"
  62. send "\n"
  63. expect -exact "Fossil partition to format \(/dev/sd00/fossil\)\[/dev/sd00/fossil\]:"
  64. send "\n"
  65. expect -exact "Task to do \[mountfs\]:"
  66. send "\n"
  67. expect -exact "Fossil partition \(/dev/sd00/fossil\)\[/dev/sd00/fossil\]:"
  68. send "\n"
  69. expect -exact "Task to do \[configdist\]:"
  70. send "\n"
  71. expect -exact "Distribution is from \(local, net\)\[local\]:"
  72. send "\n"
  73. expect -exact "Task to do \[mountdist\]:"
  74. send "\n"
  75. expect -exact "Distribution disk \[no default\]:"
  76. send "/dev/sdD0/data\n"
  77. expect -exact "Location of archives \[browse\]:"
  78. send "/\n"
  79. expect -exact "Task to do \[copydist\]:"
  80. send "\n"
  81. # Need to wait for the copy to finish.
  82. expect -timeout 600 -exact "Task to do \[bootsetup\]:"
  83. send "\n"
  84. expect -exact "Enable boot method (floppy, plan9, win9x, winnt)\[no default\]:"
  85. send "plan9\n"
  86. expect -exact "Install the Plan 9 master boot record (y, n)\[no default\]:"
  87. send "y\n"
  88. expect -exact "Task to do \[finish\]:"
  89. send "\n"
  90. expect -exact "Feel free to turn off your computer."
  91. exit
  92. EOF
  93. ## Configuration.
  94. #expect <<EOF
  95. #spawn qemu-system-i386 -nographic -net user -net nic,model=virtio -m 1024 -vga none -drive if=none,id=hd,file=disk.raw -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd -cdrom 9legacy.iso -boot c
  96. #expect -exact "Plan 9"
  97. #sleep 5
  98. ## Need to wait for the kernel to boot.
  99. #expect -timeout 600 -exact "term% "
  100. #send "\n"
  101. #expect -exact "term% "
  102. #send "mkdir /cfg/helix\n"
  103. #expect -exact "term% "
  104. #send "dircp /cfg/example /cfg/helix\n"
  105. #expect -exact "term% "
  106. #send "echo ip/ipconfig -o mtu >>/cfg/helix/cpurc\n"
  107. #expect -exact "term% "
  108. #send "echo ndb/dns -r >>/cfg/helix/cpurc\n"
  109. #expect -exact "term% "
  110. #send "echo echo remove 10.0.0.0 /104 10.0.0.0 '>'/net/iproute >>/cfg/helix/cpurc\n"
  111. #expect -exact "term% "
  112. #send "echo ramfs -su >>/cfg/helix/cpustart\n"
  113. #expect -exact "term% "
  114. #send "echo mount -c /srv/ramfs /tmp >>/cfg/helix/cpustart\n"
  115. #expect -exact "term% "
  116. #send "echo aux/randfs -m /dev >>/cfg/helix/cpustart\n"
  117. #expect -exact "term% "
  118. #send "echo kill timesync '|' rc >>/cfg/helix/cpustart\n"
  119. #expect -exact "term% "
  120. #send "echo echo downloading git >>/cfg/helix/cpustart\n"
  121. #expect -exact "term% "
  122. #send "echo hget http://9legacy.org/9legacy/tools/git '>'/usr/glenda/bin/rc/git >>/cfg/helix/cpustart\n"
  123. #expect -exact "term% "
  124. #send "echo chmod +x /usr/glenda/bin/rc/git >>/cfg/helix/cpustart\n"
  125. #expect -exact "term% "
  126. #send "echo bind -a /usr/glenda/bin/rc /bin >>/cfg/helix/cpustart\n"
  127. #
  128. #expect -exact "term% "
  129. #send "auth/wrkey\n"
  130. #expect -exact "authid: "
  131. #send "glenda\n"
  132. #expect -exact "authdom: "
  133. #send "harvey\n"
  134. #expect -exact "auth password: "
  135. #send "glenda123\n"
  136. #expect -exact "secstore password: "
  137. #send "glenda123\n"
  138. #expect -exact "term% "
  139. #send "fshalt\n"
  140. #expect -exact "done halting"
  141. #exit
  142. #EOF
  143. #
  144. #
  145. # expect <<EOF
  146. # spawn qemu-system-i386 -machine accel=kvm -nographic -net user -net nic,model=virtio -m 1024 -vga none -drive if=none,id=hd,file=disk.raw -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd -cdrom 9legacy.iso -boot c
  147. # expect -exact "Plan 9"
  148. # sleep 5
  149. # # Need to wait for the kernel to boot.
  150. # expect -timeout 600 -exact "term% "
  151. # send "\n"
  152. # expect -exact "term% "
  153. # send "echo 'aux/listen1 tcp!*!17007 /bin/exportfs -a &' >>/cfg/helix/cpurc\n"
  154. # expect -exact "term% "
  155. # send "echo 'aux/listen1 tcp!*!17010 /bin/cpu -R &' >>/cfg/helix/cpurc\n"
  156. # expect -exact "term% "
  157. # send "mkdir /usr/glenda/bin/amd64\n"
  158. # expect -exact "term% "
  159. # send "9fat:\n"
  160. # expect -exact "term% "
  161. # send "cp /amd64/9k10cpuf /n/9fat\n"
  162. # expect -exact "term% "
  163. # send "sed s/9pcf/9k10cpuf/ /n/9fat/plan9.ini >/tmp/plan9.ini\n"
  164. # expect -exact "term% "
  165. # send "mv /tmp/plan9.ini /n/9fat/plan9.ini\n"
  166. # expect -exact "term% "
  167. # send "sed s/sd00/$disk/ /n/9fat/plan9.ini >/tmp/plan9.ini\n"
  168. # expect -exact "term% "
  169. # send "mv /tmp/plan9.ini /n/9fat/plan9.ini\n"
  170. # expect -exact "term% "
  171. # send "unmount /n/9fat\n"
  172. # expect -exact "term% "
  173. # send "fossil/conf /dev/sd00/fossil | sed s/sd00/$disk/ >/tmp/fossil.conf\n"
  174. # expect -exact "term% "
  175. # send "fossil/conf -w /dev/sd00/fossil /tmp/fossil.conf\n"
  176. # expect -exact "term% "
  177. # send "rm /tmp/fossil.conf\n"
  178. # expect -exact "term% "
  179. # send "fshalt\n"
  180. # expect -exact "done halting"
  181. #exit
  182. #EOF
  183. echo
  184. echo "Done. QEMU image is disk.raw."