mount (1527B)
1 #!/usr/local/plan9/bin/rc 2 3 if(! ~ $#* 2){ 4 echo 'usage: mount addr mtpt' >[1=2] 5 exit usage 6 } 7 switch(`{uname}){ 8 case Linux 9 if(9 grep -si ' 9p(2000)?$' /proc/filesystems){ 10 if(u test -S $1) 11 exec u mount -t 9p -o trans'='unix,uname'='$USER $1 $2 12 exec u mount -t 9p -o trans'='tcp,uname'='$USER $1 $2 13 } 14 if(9 grep -si ' fuse$' /proc/filesystems) 15 exec 9pfuse $1 $2 16 echo 'don''t know how to mount (no 9p, no fuse)' >[1=2] 17 case FreeBSD 18 if(kldstat|9 grep -si ' fuse') 19 exec 9pfuse $1 $2 20 echo 'don''t know how to mount (no fuse)' >[1=2] 21 case Darwin 22 version=`{sw_vers -productVersion|cut -d. -f1,2} 23 major_version = `{echo $version|cut -d. -f1} 24 if(sysctl fuse.version >[2]/dev/null |9 grep -si 'fuse.version' || 25 sysctl macfuse.version.number >[2]/dev/null |9 grep -si 'fuse.version' || 26 sysctl osxfuse.version.number >[2]/dev/null |9 grep -si 'fuse.version' || 27 test -d /System/Library/Extensions/fusefs.kext || 28 test -d /Library/Filesystems/osxfuse.fs/Contents/Extensions/$version/osxfuse.kext || 29 test -d /Library/Filesystems/macfuse.fs/Contents/Extensions/$version/macfuse.kext || 30 test -d /Library/Filesystems/macfuse.fs/Contents/Extensions/$major_version/macfuse.kext || 31 test -d /Library/Filesystems/osxfusefs.fs/Support/osxfusefs.kext || 32 test -d /opt/local/Library/Filesystems/osxfuse.fs || 33 test -d /Library/Filesystems/fusefs.fs/Support/fusefs.kext) 34 exec 9pfuse $1 $2 35 echo 'don''t know how to mount (no fuse)' >[1=2] 36 case * 37 echo 'can''t mount on' `{uname} >[1=2] 38 } 39 exit nomount