Skip to content

Commit

Permalink
cpu: allow user to set path of cpuns
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rminnichcodeu committed Sep 26, 2024
1 parent 011dc37 commit a8eaf3e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmds/cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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.
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit a8eaf3e

Please sign in to comment.