mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00

Podman machine is only intended for amd64 and arm64 architectures, set the correct buildtags so that the `pkg/machine`, `pkg/machine/qemu` and `pkg/machine/libvirt` packages compile correctly. [NO TESTS NEEDED] Fixes #10625 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
28 lines
658 B
Go
28 lines
658 B
Go
// +build amd64,linux arm64,linux amd64,darwin arm64,darwin
|
|
|
|
package machine
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os/exec"
|
|
"strings"
|
|
)
|
|
|
|
// CreateSSHKeys makes a priv and pub ssh key for interacting
|
|
// the a VM.
|
|
func CreateSSHKeys(writeLocation string) (string, error) {
|
|
if err := generatekeys(writeLocation); err != nil {
|
|
return "", err
|
|
}
|
|
b, err := ioutil.ReadFile(writeLocation + ".pub")
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return strings.TrimSuffix(string(b), "\n"), nil
|
|
}
|
|
|
|
// generatekeys creates an ed25519 set of keys
|
|
func generatekeys(writeLocation string) error {
|
|
return exec.Command("ssh-keygen", "-N", "", "-t", "ed25519", "-f", writeLocation).Run()
|
|
}
|