diff --git a/README.md b/README.md index 8cde2d1..2b65609 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,10 @@ To add this SSH provider from the CLI, use the `provider add` command. For examp devpod provider add https://github.com/loft-sh/devpod-provider-ssh/releases/download/$CURRENT_VERSION/provider.yaml ``` -For more detail, see the [DevPod Documentation](https://devpod.sh/docs/managing-providers/what-are-providers). \ No newline at end of file +## Compatibility + +We only support Linux machine as remote hosts. + +# Extra + +For more detail, see the [DevPod Documentation](https://devpod.sh/docs/managing-providers/what-are-providers). diff --git a/pkg/ssh/ssh.go b/pkg/ssh/ssh.go index 32a18a7..f352aa7 100644 --- a/pkg/ssh/ssh.go +++ b/pkg/ssh/ssh.go @@ -93,7 +93,19 @@ func Init(provider *SSHProvider) error { return fmt.Errorf("error: ssh output mismatch") } + // We only support running on Linux ssh servers + out = new(bytes.Buffer) + err = execSSHCommand(provider, "uname", out) + if err != nil { + return returnSSHError(provider, "uname") + } + if out.String() != "Linux\n" { + fmt.Println(out.String()) + return fmt.Errorf("error: SSH provider only works on Linux servers") + } + // If we're root, we won't have problems + out = new(bytes.Buffer) err = execSSHCommand(provider, "id -ru", out) if err != nil { return returnSSHError(provider, "id -ru") @@ -103,6 +115,7 @@ func Init(provider *SSHProvider) error { } // check that we have access to AGENT_PATH + out = new(bytes.Buffer) agentDir := path.Dir(provider.Config.AgentPath) err1 := execSSHCommand(provider, "mkdir -p "+agentDir, out) err2 := execSSHCommand(provider, "test -w "+agentDir, out)