#!/bin/rc# 9fs filesystem [mountpoint] - srv & mount filesystem, usually from plan 9rfork enflag=-nif(~ $1 -a){ shift nflag=()}switch($1){case '' echo usage: 9fs service '[mountpoint]' >[1=2] exit usagecase kfs if(! test -f /srv/kfs) disk/kfs mount -c /srv/kfs /n/kfscase 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 errorcase snap mount /srv/boot /n/snap main/snapshotcase other mount -C /srv/boot /n/other othercase juke # ye olde file server srv -q il!jukefs && mount /srv/il!jukefs /n/jukecase sources srv $nflag -q tcp!sources.cs.bell-labs.com sources /n/sourcescase sourcesdump 9fs sources mount $nflag /srv/sources /n/sourcesdump main/archivecase sourcessnap 9fs sources mount $nflag /srv/sources /n/sourcessnap main/snapshot# arbitrary venti archivescase vac:* vacfs <{echo $1}case *.vac if (test -e $1) score=$1 if not if (! ~ $1 /* && test -e $home/lib/vac/$1) score=$home/lib/vac/$1 if not if (! ~ $1 /* && test -e /lib/vac/$1) score=/lib/vac/$1 if not { echo $0: $1: no such score file >[1=2] exit 'no score file' } vacfs -m /n/`{basename $1 .vac} `{cat $score}case wiki srv -m 'net!plan9.bell-labs.com!wiki' wiki /mnt/wikicase cwiki srv -m 'net!wiki.coraid.com!wiki' wiki /mnt/wikicase coraid import -E ssl minooka.coraid.com / /n/coraid bind -q /n/coraid/n/other/quanstro /n/other/quanstro # if(! ~ $sysname ladd && ! test -f /net.alt/arp) # import -p ladd /net.alt /net.alt # import -p -E ssl /net.alt/tcp!minooka.coraid.com / /n/coraidcase quanstro mount /srv/boot /n/quanstrocase quanstrodump mount /srv/boot /n/quanstrodump dumpcase leffe import -E ssl leffe.cs.bell-labs.com / /n/leffecase nix srv -m sources.lsub.org nix.$user && mount /srv/nix.$user /n/nix && bind /n/nix/nix /n/nixcase nixpatch srv -m patches.lsub.org nixpatch.$user && mount /srv/nixpatch.$user /n/nixpatchcase atta import -E ssl atom.9atom.org / /n/attacase atom # import -E ssl atom.9atom.org /n/atom /n/atom srv $nflag -q tcp!atom.9atom.org atom && mount $nflag /srv/atom /n/atom atomcase atomdump # mount $nflag 9fs atom && mount /srv/atom /n/atomdump atomdumpcase * switch($#*){ case 1 srv -m $1 case * srv -m $1 $1 $2 }}
#!/bin/rc
# 9fs filesystem [mountpoint] - srv & mount filesystem, usually from plan 9
rfork e
nflag=-n
if(~ $1 -a){
shift
nflag=()
}
switch($1){
case ''
echo usage: 9fs service '[mountpoint]' >[1=2]
exit usage
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 $nflag -q tcp!sources.cs.bell-labs.com sources /n/sources
case sourcesdump
9fs sources
mount $nflag /srv/sources /n/sourcesdump main/archive
case sourcessnap
9fs sources
mount $nflag /srv/sources /n/sourcessnap main/snapshot
# arbitrary venti archives
case vac:*
vacfs <{echo $1}
case *.vac
if (test -e $1)
score=$1
if not if (! ~ $1 /* && test -e $home/lib/vac/$1)
score=$home/lib/vac/$1
if not if (! ~ $1 /* && test -e /lib/vac/$1)
score=/lib/vac/$1
if not {
echo $0: $1: no such score file >[1=2]
exit 'no score file'
}
vacfs -m /n/`{basename $1 .vac} `{cat $score}
case wiki
srv -m 'net!plan9.bell-labs.com!wiki' wiki /mnt/wiki
case cwiki
srv -m 'net!wiki.coraid.com!wiki' wiki /mnt/wiki
case coraid
import -E ssl minooka.coraid.com / /n/coraid
bind -q /n/coraid/n/other/quanstro /n/other/quanstro
# if(! ~ $sysname ladd && ! test -f /net.alt/arp)
# import -p ladd /net.alt /net.alt
# import -p -E ssl /net.alt/tcp!minooka.coraid.com / /n/coraid
case quanstro
mount /srv/boot /n/quanstro
case quanstrodump
mount /srv/boot /n/quanstrodump dump
case leffe
import -E ssl leffe.cs.bell-labs.com / /n/leffe
case nix
srv -m sources.lsub.org nix.$user && mount /srv/nix.$user /n/nix &&
bind /n/nix/nix /n/nix
case nixpatch
srv -m patches.lsub.org nixpatch.$user && mount /srv/nixpatch.$user /n/nixpatch
case atta
import -E ssl atom.9atom.org / /n/atta
case atom
# import -E ssl atom.9atom.org /n/atom /n/atom
srv $nflag -q tcp!atom.9atom.org atom &&
mount $nflag /srv/atom /n/atom atom
case atomdump
# mount $nflag
9fs atom && mount /srv/atom /n/atomdump atomdump
case *
switch($#*){
case 1
srv -m $1
case *
srv -m $1 $1 $2
}
}