usb 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/bin/rc
  2. rfork en
  3. . funcs
  4. if (test -e /srv/fossil -o -e /srv/fossil.open) {
  5. echo $0: /srv/fossil* exists, not safe to start a new one >[1=2]
  6. exit fossil-already-running
  7. }
  8. sd=sdXX
  9. dev=/dev/$sd
  10. target=plan9-usb
  11. disk=$outputdir^/$target.img
  12. #gb=1024*1024*1024
  13. #size=$gb^*1
  14. #size=131072
  15. size=260000
  16. data=$dev/data
  17. plan9=$dev/plan9
  18. 9fat=$dev/9fat
  19. fossil=$dev/fossil
  20. {
  21. echo bootfile'='sdB0!9fat!9pcf
  22. echo nobootprompt'='local!$dev/fossil
  23. echo
  24. echo nvram'='$dev/nvram
  25. echo debugboot'='1
  26. echo *nodumpstack'='1
  27. echo *noe820print'='1
  28. echo *nomp'='1
  29. echo
  30. echo mouseport'='ask
  31. echo monitor'='ask
  32. echo vgasize'='ask
  33. echo user'='glenda
  34. } > /tmp/plan9.ini
  35. #dd -if /dev/zero -of $disk -bs 1 -seek $size -count 1
  36. dd -if /dev/zero -of $disk -bs 8192 -count $size
  37. chmod +t $disk
  38. disk/partfs $disk
  39. disk/mbr -m $build/386/mbr $data
  40. disk/fdisk -baw $data
  41. disk/prep -bw -a^(9fat nvram fossil) $plan9
  42. disk/format -b $build/386/pbs -d -r 2 $9fat $build/386/9bootfat $build/386/9pcf $build/386/9pccpuf /tmp/plan9.ini
  43. # this is the guts of a:, but placed here to insulate us from changes that might be made to it.
  44. if(! test -f /srv/dos)
  45. dossrv >/dev/null </dev/null >[2]/dev/null
  46. unmount /n/a >[2]/dev/null
  47. mount -c /srv/dos /n/a $9fat
  48. mkdir -p /n/a/efi/boot
  49. cp $build/386/*.efi /n/a/efi/boot
  50. unmount /n/a
  51. rm /tmp/9load
  52. rm /tmp/plan9.ini
  53. fossil/flfmt -y $fossil
  54. {
  55. echo fsys main config
  56. echo fsys main open -Va -c 32768
  57. echo srv fossil
  58. echo srv -APW fossil.open
  59. echo srv -Ap fscons.open
  60. echo fsys main
  61. } | fossil/conf -w $fossil
  62. fossil/fossil -f $fossil
  63. bind /n/harvey /n/dist
  64. mount -c /srv/fossil.open /n/newfs
  65. echo fsys main create /active/adm adm sys d775 >>/srv/fscons.open
  66. echo fsys main create /active/adm/users adm sys 664 >>/srv/fscons.open
  67. echo uname upas :upas >>/srv/fscons.open
  68. echo users -w >>/srv/fscons.open
  69. for(i in dist dist/replica dist/replica/client)
  70. echo fsys main create /active/$i sys sys d775 >>/srv/fscons.open
  71. echo fsys main create /active/dist/replica/client/plan9.db sys sys 664 >>/srv/fscons.open
  72. echo fsys main create /active/dist/replica/client/plan9.log sys sys a664 >>/srv/fscons.open
  73. replica/pull $build/sys/lib/dist/pc/inst/replcfg
  74. unmount /n/newfs
  75. sleep 8
  76. echo fsys all sync >>/srv/fscons.open
  77. sleep 8
  78. echo fsys all halt >>/srv/fscons.open
  79. sleep 8
  80. rm -f /srv/^(fossil fossil.open fscons fscons.open)
  81. sleep 8
  82. kill fossil2 | rc
  83. #bzip2 -c9 $disk > $disk.bz2 && rm $disk