shithub: x

Download patch

ref: 267ce690411b7d536cef42ccdc96220ea800ad06
parent: b6a519453224239b129fa481f598946fe61e21c8
author: kvik <kvik@a-b.xyz>
date: Sat Jun 22 08:55:41 EDT 2019

add x/mnt and x/run

--- /dev/null
+++ b/mnt
@@ -1,0 +1,24 @@
+#!/bin/rc
+
+rfork e
+
+fn usage {
+	echo usage: x/mnt [user@]host >[1=2]
+	exit usage
+}
+
+users=(root $user)
+if(! ~ $#* 1)
+	usage
+host=$1
+if(~ $host *@*){
+	x=`'@'{echo -n $host}
+	users=$x(1)
+	host=$x(2)
+}
+for(u in $users){
+	userhost=$u@$host
+	if(! test -e /srv/$userhost)
+		sshfs -M -r / -s $userhost $userhost
+	mount -c /srv/$userhost /x/$userhost
+}
--- /dev/null
+++ b/run
@@ -1,0 +1,6 @@
+#!/bin/rc
+rfork e
+rpath=`{x/path -P}
+cmd=$"*
+cmd=`{awk 'BEGIN{printf("sh -c ''cd %s; %s''", ENVIRON["rpath"], ENVIRON["cmd"])}'}
+ssh `{x/path -l} $"cmd