1
0

9fs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/rc
  2. # 9fs filesystem [mountpoint] - srv & mount filesystem, usually from plan 9
  3. rfork e
  4. switch($1){
  5. case ''
  6. echo usage: 9fs service '[mountpoint]' >[1=2]
  7. exit usage
  8. case kfs
  9. if(! test -f /srv/kfs)
  10. disk/kfs
  11. mount -c /srv/kfs /n/kfs
  12. case dump
  13. mount /srv/boot /n/dump dump >[2]/dev/null ||
  14. mount /srv/boot /n/dump main/archive ||
  15. mount /srv/boot /n/dump dump # again to print error
  16. case snap
  17. mount /srv/boot /n/snap main/snapshot
  18. case other
  19. mount -C /srv/boot /n/other other
  20. case juke # ye olde file server
  21. srv -q il!jukefs && mount /srv/il!jukefs /n/juke
  22. case sources
  23. srv -nq tcp!sources.cs.bell-labs.com sources /n/sources
  24. case sourcesdump
  25. 9fs sources
  26. mount -n /srv/sources /n/sourcesdump main/archive
  27. case sourcessnap
  28. 9fs sources
  29. mount -n /srv/sources /n/sourcessnap main/snapshot
  30. # arbitrary venti archives
  31. case vac:*
  32. vacfs <{echo $1}
  33. case *.vac
  34. if (test -e $1)
  35. score=$1
  36. if not if (! ~ $1 /* && test -e $home/lib/vac/$1)
  37. score=$home/lib/vac/$1
  38. if not if (! ~ $1 /* && test -e /lib/vac/$1)
  39. score=/lib/vac/$1
  40. if not {
  41. echo $0: $1: no such score file >[1=2]
  42. exit 'no score file'
  43. }
  44. vacfs -m /n/`{basename $1 .vac} `{cat $score}
  45. case wiki
  46. srv -m 'net!plan9.bell-labs.com!wiki' wiki /mnt/wiki
  47. case *
  48. switch($#*){
  49. case 1
  50. srv -m $1
  51. case *
  52. srv -m $1 $1 $2
  53. }
  54. }