download 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/rc
  2. # prereq: mountfs
  3. # desc: download or continue to download the distribution archives
  4. switch($1) {
  5. case checkready
  6. devs=(`{cat /net/ipifc/*/status >[2]/dev/null |
  7. grep -v '127\.0\.0\.1' |
  8. sed 's/ .*//'})
  9. if(~ $#devs 0) {
  10. download=notdone
  11. export download
  12. }
  13. if(~ $mountdist done){
  14. download=notdone
  15. export download
  16. }
  17. case go
  18. if(! test -f /srv/cs) {
  19. log starting cs, dns
  20. logprog ndb/cs >>/srv/log >[2=1]
  21. logprog ndb/dns -r >>/srv/log >[2=1]
  22. }
  23. if(! test -f /net/cs) {
  24. logprog mount -a /srv/cs /net
  25. logprog mount -a /srv/dns /net
  26. }
  27. # BUG make restartable
  28. echo 'Downloading distribution package...'
  29. baropt='-w 145,129,445,168'
  30. if(~ textinst 1)
  31. baropt=-t
  32. if(! hget -vo /n/newfs/dist/_plan9.iso.bz2 $installurl/plan9.iso.bz2 |[2] bargraph $baropt 'downloading '^plan9.iso.bz2)
  33. exit
  34. mv /n/newfs/dist/_plan9.iso.bz2 /n/newfs/dist/plan9.iso.bz2
  35. if(~ $fstype fossil){
  36. echo fsys main sync >>/srv/fscons
  37. }
  38. echo 'The distribution is downloaded.'
  39. srvmedia=()
  40. mountmedia=(mount /srv/fossil /n/distmedia)
  41. distmediadir=/dist
  42. export distmediadir mountmedia distmedia
  43. case checkdone
  44. if(! test -f /n/newfs/dist/plan9.iso.bz2) {
  45. download=notdone
  46. export download
  47. }
  48. }