#!/bin/rc # # usage example: [user=USER] -f chgrp staff foo # # coded by Kenar # # # we must guess where our file root came from # but how ? # Hint 1: # we have in /rc/bin/termrc # fileserver=... # where ... is fossil or kfs # temporally we believe this. # fn confirm { for(x in $*){ if(! test -e $x){ echo $x not exist exit error } } } if(~ $#* 0){ echo 'usage: -f command [args ...]' exit usage } fscmd=(kfs.cmd cwfs.cmd hjfs.cmd fscons) fs=`{ls -p /srv/^$fscmd >[2] /dev/null} #echo $fs switch($fs(1)){ case kfs.cmd confirm /srv/kfs.cmd disk/kfscmd allow $* disk/kfscmd disallow case cwfs.cmd confirm /srv/cwfs.cmd echo allow $user >> /srv/cwfs.cmd $* echo disallow >> /srv/cwfs.cmd case hjfs.cmd confirm /srv/hjfs.cmd echo allow >> /srv/hjfs.cmd $* echo disallow >> /srv/hjfs.cmd case fscons fossil rfork # equiv. rfork ens confirm /n/f /srv/fscons if(! test -e /srv/f) echo srv -APW f | con /srv/fscons if(! test -e /n/f/adm/users) mount /srv/f /n/f if(! test -e /n/f/adm/users){ echo cannot mount /n/f exit error } w=`{pwd} r=/n/f for( x in (386 rc sys adm lib usr mail dist)) bind -c $r/$x /$x cd $w $* case * echo fileserver has no value } exit # # don't rely on $fileserver # switch($fileserver){ case kfs confirm /srv/kfs.cmd disk/kfscmd allow $* disk/kfscmd disallow case cwfs confirm /srv/cwfs.cmd echo allow $user >> /srv/cwfs.cmd $* echo disallow >> /srv/cwfs.cmd case hjfs confirm /srv/hjfs.cmd echo allow >> /srv/hjfs.cmd $* echo disallow >> /srv/hjfs.cmd case fossil rfork # equiv. rfork ens confirm /n/f /srv/fscons if(! test -e /srv/f) echo srv -APW f | con /srv/fscons if(! test -e /n/f/adm/users) mount /srv/f /n/f if(! test -e /n/f/adm/users){ echo cannot mount /n/f exit error } w=`{pwd} r=/n/f for( x in (386 rc sys adm lib usr mail dist)) bind -c $r/$x /$x cd $w $* case * echo fileserver has no value }