aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-27 07:48:50 -0500
committerGitHub <noreply@github.com>2022-01-27 07:48:50 -0500
commit5659b0734c628f3f42fd976b6ce91372be3019ae (patch)
tree4f259d6360a4711981d1564b709249d67a7fbb06 /utils
parent0d96c46c7c4de3f4464e8d55b6134b9bd082cf34 (diff)
parent77cd38d40c00290873226d610fc47098232b7c7a (diff)
downloadpodman-5659b0734c628f3f42fd976b6ce91372be3019ae.tar.gz
podman-5659b0734c628f3f42fd976b6ce91372be3019ae.tar.bz2
podman-5659b0734c628f3f42fd976b6ce91372be3019ae.zip
Merge pull request #12867 from cdoern/scp
switch podman image scp from depending on machinectl to just os/exec
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/utils.go b/utils/utils.go
index caf63c975..52586b937 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -238,3 +238,18 @@ func CreateSCPCommand(cmd *exec.Cmd, command []string) *exec.Cmd {
cmd.Stdout = os.Stdout
return cmd
}
+
+// LoginUser starts the user process on the host so that image scp can use systemd-run
+func LoginUser(user string) (*exec.Cmd, error) {
+ sleep, err := exec.LookPath("sleep")
+ if err != nil {
+ return nil, err
+ }
+ machinectl, err := exec.LookPath("machinectl")
+ if err != nil {
+ return nil, err
+ }
+ cmd := exec.Command(machinectl, "shell", "-q", user+"@.host", sleep, "inf")
+ err = cmd.Start()
+ return cmd, err
+}