aboutsummaryrefslogtreecommitdiff
path: root/bin/mount
blob: 0fbb1bfd59b5f07a97914a6e0219b0a2894492e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/local/plan9/bin/rc

if(! ~ $#* 2){
	echo 'usage: mount addr mtpt' >[1=2]
	exit usage
}
switch(`{uname}){
case Linux
	if(9 grep -si '	9p(2000)?$' /proc/filesystems){
		if(u test -S $1)
			exec u mount -t 9p -o trans'='unix,uname'='$USER $1 $2
		exec u mount -t 9p -o trans'='tcp,uname'='$USER $1 $2
	}
	if(9 grep -si '	fuse$' /proc/filesystems)
		exec 9pfuse $1 $2
	echo 'don''t know how to mount (no 9p, no fuse)' >[1=2]
case FreeBSD
	if(kldstat|9 grep -si ' fuse')
		exec 9pfuse $1 $2
	echo 'don''t know how to mount (no fuse)' >[1=2]
case Darwin
	version=`{sw_vers -productVersion|cut -d. -f1,2}
	if(sysctl fuse.version >[2]/dev/null |9 grep -si 'fuse.version' ||
	   sysctl macfuse.version.number >[2]/dev/null |9 grep -si 'fuse.version' ||
	   sysctl osxfuse.version.number >[2]/dev/null |9 grep -si 'fuse.version' ||
	   test -d /System/Library/Extensions/fusefs.kext ||
	   test -d /Library/Filesystems/osxfuse.fs/Contents/Extensions/$version/osxfuse.kext ||
	   test -d /Library/Filesystems/osxfusefs.fs/Support/osxfusefs.kext ||
	   test -d /opt/local/Library/Filesystems/osxfuse.fs ||
	   test -d /Library/Filesystems/fusefs.fs/Support/fusefs.kext)
		exec 9pfuse $1 $2
	echo 'don''t know how to mount (no fuse)' >[1=2]
case *
	echo 'can''t mount on' `{uname} >[1=2]
}
exit nomount