ref: f3afdf563f784c0a5703496f48c1a72dff4617f4
dir: /9fs/
#!/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 case 9fat esp pidos dos if(~ $#2 1) part=`{ls $2 >[2]/dev/null} if not if(~ $1 pidos) part=`{ls /dev/sdM*/dos >[2]/dev/null} if not part=`{ls /dev/fs/$1 /dev/sd*/$1 >[2]/dev/null} if(~ $#part 0) { echo 'no '$1' partition found' >[1=2] exit no.$1 } part=$part(1) if(! test -f /srv/dos) dossrv >/dev/null </dev/null >[2]/dev/null unmount /n/$1 >/dev/null >[2]/dev/null mount -c /srv/dos /n/$1 $part if(~ $1 9fat){ unmount /n/9 >/dev/null >[2]/dev/null mount -c /srv/dos /n/9 $part } case dump other mount -C /srv/boot /n/$1 $1 case sources srv -nqC tcp!9p.io sources /n/sources case sourcesdump 9fs sources mount -nC /srv/sources /n/sourcesdump main/archive case sourcessnap 9fs sources mount -nC /srv/sources /n/sourcessnap main/snapshot case atom srv -nq tcp!atom.9atom.org atom && mount -nC /srv/atom /n/atom atom case atomdump 9fs atom && mount -nC /srv/atom /n/atomdump atomdump case 9pio srv -nq tcp!9p.io 9pio && mount -nC /srv/9pio /n/9pio case 9front 9fs tcp!9front.org!9000 for(i in 9front fqa iso lists sites extra) bind /n/9front.org!9000/$i /n/$i case 9contrib 9fs contrib.9front.org /n/contrib case 9grep 9fs tcp!9front.org!7734 bind -b /n/9front.org!7734 /n/lists case 9registry srv tcp!registry.9p.zone!6675 registry /n/registry case 9disk srv -c tcp!9p.zone!9991 9p.zone.disk /n/disk case 9chat srv tcp!chat.9p.zone!9990 gridchat /n/chat case sdf srv -nq tcp!9p.sdf.org sdf && mount -nC /srv/sdf /usr/sdf bind -a /usr/sdf/bin /bin bind -a /usr/sdf/rc /bin # 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 kfs if(! test -f /srv/kfs) disk/kfs mount -c /srv/kfs /n/kfs case wiki srv -m 'net!9p.io!wiki' wiki /mnt/wiki case *!snip srv -cnmq tcp!^`{echo $1 | sed 's/snip$/17037/'} $1 /n/$1 # Shortcut for 9srv case 9srv srv -q tcp!9srv.net 9srv /n/9srv # plan9 pastebin case 9paste srv -n fs.9paste.net 9paste /n/9paste # Our other is a fossil with snapshots (but no dumps). case other 9fs 9srv mount -cC /srv/9srv /n/other other/active case othersnap 9fs other mount -C /srv/9srv /n/othersnap other/snapshot # That "other" has a bunch of CD/DVD images. Shortcut to mount. case cd if(~ $#* 1) echo 'Please specify a cd image.' >[1=2] if not { 9fs other 9660srv 9660.^$user mount /srv/9660.^$user /n/^$2 /n/other/^$2^.iso } # Cooperating unix hosts case ssh:* if(test -e $home/lib/uname) { t=`{echo $1 | sed 's/^ssh://'} user=`{grep '^'$t' ' $home/lib/uname | sed 's/'$t' +([^@]+)@.+$/\1/'} host=`{grep '^'$t' ' $home/lib/uname | sed 's/'$t' +[^@]+@(.+)$/\1/'} } srvssh -u /1/bin/u9fs $host $t /n/$t case nntp:* t=`{echo $1 | sed 's/^nntp://'} nntpfs -m /n/$t $t case * switch($#*){ case 1 srv -m $1 case * srv -m $1 $1 $2 } }