shithub: x

ref: 020e88c686a75f53c7238f3b8bd3b94319789248
dir: /mnt/

View raw version
#!/bin/rc

rfork e

fn usage {
	echo usage: x/mnt [[user@]host ...] >[1=2]
	exit usage
}

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
		if(! test -e /srv/$userhost)
			sshfs -M -r / -s $userhost $userhost
		mount -c /srv/$userhost /x/$userhost
	}
}

hosts=$*
if(~ $#hosts 0)
	hosts=`{x/path -l}
if(~ $#hosts 0)
	usage
for(h in $hosts)
	mnt $h