shithub: x

ref: 54b29c4c7fcfde6b61972b5c8bb8df6fb59cdacd
dir: /mnt/

View raw version
#!/bin/rc
rfork e
. /sys/lib/x/lib.rc
usage = '
	x/mnt [[user@]host ...] 
'

fn mnt {
	user=(root $user)
	host=$1
	if(~ $host *@*){
		x=`'@'{echo -n $host}
		user=$x(1)
		host=$x(2)
	}
	for(u in $user){
		userhost=$u@$host
		mount -c /srv/$userhost /n/x/$userhost >[2]/dev/null \
		|| sshfs -s $userhost -m /n/x/$userhost -r / $userhost
	}
}

hosts=$*
if(~ $#hosts 0)
	hosts=`{x/path -l}
if(~ $#hosts 0)
	usage
if(! ls /n | grep -s '^/n/x$')
	mntgen /n/x
for(h in $hosts)
	mnt `{x/path -l $h}