Skip to content

Commit

Permalink
Merge pull request #15 from loft-sh/fix/compatibility_linux
Browse files Browse the repository at this point in the history
fix: better highlight Linux compatibility
  • Loading branch information
89luca89 authored Sep 18, 2023
2 parents e084aae + 0ca0adc commit 708772a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
## 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).
13 changes: 13 additions & 0 deletions pkg/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down

0 comments on commit 708772a

Please sign in to comment.