plan9fox/rc/bin/9fs

57 lines
1.3 KiB
Text
Raw Normal View History

#!/bin/rc
# 9fs filesystem [mountpoint] - srv & mount filesystem, usually from plan 9
rfork e
switch($1){
case ''
echo usage: 9fs service '[mountpoint]' >[1=2]
exit usage
2011-04-22 20:14:08 +00:00
case 9fat
part=`{ls /dev/fs/9fat /dev/sd*/9fat >[2]/dev/null}
if(~ $#part 0) {
echo 'no 9fat partition found' >[1=2]
exit no.9fat
}
part=$part(1)
if(! test -f /srv/dos)
dossrv >/dev/null </dev/null >[2]/dev/null
unmount /n/9fat >/dev/null >[2]/dev/null
mount -c /srv/dos /n/9fat $part
unmount /n/9 >/dev/null >[2]/dev/null
mount -c /srv/dos /n/9 $part
case kfs
if(! test -f /srv/kfs)
disk/kfs
mount -c /srv/kfs /n/kfs
case dump
mount /srv/boot /n/dump dump >[2]/dev/null ||
mount /srv/boot /n/dump main/archive ||
mount /srv/boot /n/dump dump # again to print error
case snap
mount /srv/boot /n/snap main/snapshot
case other
mount -C /srv/boot /n/other other
case juke # ye olde file server
srv -q il!jukefs && mount /srv/il!jukefs /n/juke
case sources
srv -nq tcp!sources.cs.bell-labs.com sources /n/sources
case sourcesdump
9fs sources
mount -n /srv/sources /n/sourcesdump main/archive
case sourcessnap
9fs sources
mount -n /srv/sources /n/sourcessnap main/snapshot
case wiki
srv -m 'net!plan9.bell-labs.com!wiki' wiki /mnt/wiki
case *
switch($#*){
case 1
srv -m $1
case *
srv -m $1 $1 $2
}
}