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