plan9port/bin/mount

30 lines
774 B
Text
Raw Normal View History

2006-07-23 02:46:53 +00:00
#!/usr/local/plan9/bin/rc
if(! ~ $#* 2){
echo 'usage: mount addr mtpt' >[1=2]
exit usage
}
switch(`{uname}){
case Linux
if(lsmod|9 grep -si '^9p(2000)? '){
if(u test -S $1)
exec u mount -t 9p -o proto'='unix,name'='$USER $1 $2
exec u mount -t 9p -o proto'='tcp,name'='$USER $1 $2
2006-07-23 02:46:53 +00:00
}
if(lsmod|9 grep -si '^fuse ')
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
if(sysctl fuse.version >[2=1] |9 grep -si 'fuse.version' ||
test -d /System/Library/Extensions/fusefs.kext)
exec 9pfuse $1 $2
echo 'don''t know how to mount (no fuse)' >[1=2]
2006-07-23 02:46:53 +00:00
case *
echo 'can''t mount on' `{uname} >[1=2]
}
exit nomount