Plan 9 from Bell Labs’s /usr/web/sources/contrib/someone/root/rc/bin/importsrv

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


#!/bin/rc
# importsrv system [mntpt] - import but first look for /srv file to mount.
#	be careful about exit status so we can invoke this from mkfiles.
rfork e
switch ($#*) {
case 2
	mntpt=$2
case 1
	mntpt=/n/$1
case *
	echo usage: $0 system >[1=2]
	exit usage
}
sys=$1
srv=`{echo $sys.$user | sed 's/^tcp!//'}

#if (test -e $mntpt/adm)		# unsafe optimisation
#	exit ''
mount -cC /srv/$srv $mntpt >[2]/dev/null
if (~ $status '')
	exit ''
rm -f /srv/$srv
# permissions don't work right via srv, thus use import
import -s $srv $sys / $mntpt && mount -cC /srv/$srv $mntpt

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.