Plan 9 from Bell Labs’s /usr/web/sources/contrib/arisawa/misc/-f

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

#
#	usage example: -f chgrp saff 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.
#

if(~ $#* 0){
	echo 'usage: -f command [args ...]'
	exit usage
}

switch($fileserver){
case kfs
	if(! test -e /srv/kfs.cmd){
		echo '/srv/kfs.cmd not exist'
		exit error
	}
	disk/kfscmd allow
	$*
	disk/kfscmd disallow
case fossil
	rfork  # equiv. rfork ens
	if(! test -e /n/f){
		echo '/n/f not exist'
		exit error
	}
	if(! test -e /srv/fscons){
		echo '/srv/fscons not exist'
		exit error
	}
	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))
		bind $r/$x /$x
	cd $w
	$*
case *
	echo fileserver has no value
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.