ref: 3519f1d58ff78407227adb5a3a202d7a4e626a93
dir: /bin/rc/urexport/
#!/bin/rc uhost=$1 srvname=$2 srvrem=$3 if(~ $#uhost 0) { echo 'usage: urexport host [srv [srvrem]]' exit 'usage' } if(! ~ $#srvname 0 && ! test -f /srv/$srvname) exit $srvname does not exist if not if(~ $#srvrem 0) srvrem=srvname if(~ $#srvname 0) { ipipe='/n/unixhub/fs!'^$uhost^'0' opipe='/n/unixhub/fs!'^$uhost^'1' } if not { ipipe='/n/unixhub/'^$srvname^'!'^$uhost^'!0' opipe='/n/unixhub/'^$srvname^'!'^$uhost^'!1' } if(! test -f /srv/unixhub) { hubfs -t -s unixhub -m /n/unixhub touch /n/unixhub/ctl } if not mount -c /srv/unixhub /n/unixhub if(test -f $ipipe) rm $ipipe touch $ipipe if(test -f $opipe) rm $opipe touch $opipe if(~ $#srvname 0) { exportfs -r / <$ipipe >$opipe & } if not { mount /srv/$srvname /n/$srvrem exportfs -r /n/$srvrem <$ipipe >$opipe & } if(~ $#srvname 0) { ssh $uhost .local/bin/socat \ unix-listen:srv/term.$apid - >$ipipe <$opipe & } if not { ssh $uhost .local/bin/socat \ unix-listen:srv/$srvrem - >$ipipe <$opipe & }