From a8eaf3e3e59c1cca50fa6261207273023fb797a1 Mon Sep 17 00:00:00 2001 From: the man Date: Thu, 26 Sep 2024 23:26:49 +0000 Subject: [PATCH] cpu: allow user to set path of cpuns Users might not be able to install cpuns in the limited set of paths sshd looks in. Add a switch, cpuns, to allow them to indicate the proper location. This works: cpu -cpuns ~/go/bin/cpuns -nfs=true -namespace="" -sp 22 -key ~/.ssh/id_rsa a3mega-a3meganodeset-0 Don't stress about all the switches: they can be easily set in .ssh/config Signed-off-by: the man --- cmds/cpu/cpu.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmds/cpu/cpu.go b/cmds/cpu/cpu.go index abc9b43..38968b2 100644 --- a/cmds/cpu/cpu.go +++ b/cmds/cpu/cpu.go @@ -31,7 +31,8 @@ const defaultPort = "17010" var ( defaultKeyFile = filepath.Join(os.Getenv("HOME"), ".ssh/cpu_rsa") - // For the ssh server part + // cpuns might not be in the limited search path of ssdhd. Allow users to set it. + cpuns = flag.String("cpuns", "cpuns", "command to run to build cpu namespace") debug = flag.Bool("d", false, "enable debug prints") dbg9p = flag.Bool("dbg9p", false, "show 9p io") dump = flag.Bool("dump", false, "Dump copious output, including a 9p trace, to a temp file at exit") @@ -49,7 +50,7 @@ var ( srvnfs = flag.Bool("nfs", false, "start nfs") cpioRoot = flag.String("cpio", "", "cpio initrd") - ssh = flag.Bool("ssh", false, "ssh only, no internal 9p, nfs, or mounts") + ssh = flag.Bool("ssh", false, "ssh only, no internal 9p, nfs, or mounts") sshd = flag.Bool("sshd", false, "server is sshd, not cpud") // v allows debug printing. @@ -153,7 +154,7 @@ func newCPU(host string, args ...string) (retErr error) { if *sshd && *srvnfs { env := append(os.Environ(), "CPU_PWD="+os.Getenv("PWD")) envargs := "-env=" + strings.Join(env, "\n") - args = append([]string{"cpuns", envargs}, args...) + args = append([]string{*cpuns, envargs}, args...) } c := client.Command(host, args...) defer func() {