summaryrefslogtreecommitdiff
path: root/cmd/podman/unshare.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-06-25 08:40:19 -0500
committerbaude <bbaude@redhat.com>2019-06-27 07:56:24 -0500
commit8561b996447793999a6465f9b9e3f0f7bbea2c6a (patch)
tree133cf8d959934eac882535e6b572aee5d0acf3c5 /cmd/podman/unshare.go
parent58a1777f518657ff12744bb69ccf2dab3d429625 (diff)
downloadpodman-8561b996447793999a6465f9b9e3f0f7bbea2c6a.tar.gz
podman-8561b996447793999a6465f9b9e3f0f7bbea2c6a.tar.bz2
podman-8561b996447793999a6465f9b9e3f0f7bbea2c6a.zip
libpod removal from main (phase 2)
this is phase 2 for the removal of libpod from main. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/unshare.go')
-rw-r--r--cmd/podman/unshare.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/cmd/podman/unshare.go b/cmd/podman/unshare.go
index 4a4e371db..31ce441f4 100644
--- a/cmd/podman/unshare.go
+++ b/cmd/podman/unshare.go
@@ -1,4 +1,4 @@
-// +build linux
+// +build !remoteclient
package main
@@ -8,8 +8,7 @@ import (
"os/exec"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/cmd/podman/libpodruntime"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/rootless"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -41,10 +40,10 @@ func init() {
flags.SetInterspersed(false)
}
-func unshareEnv(config *libpod.RuntimeConfig) []string {
+func unshareEnv(graphroot, runroot string) []string {
return append(os.Environ(), "_CONTAINERS_USERNS_CONFIGURED=done",
- fmt.Sprintf("CONTAINERS_GRAPHROOT=%s", config.StorageConfig.GraphRoot),
- fmt.Sprintf("CONTAINERS_RUNROOT=%s", config.StorageConfig.RunRoot))
+ fmt.Sprintf("CONTAINERS_GRAPHROOT=%s", graphroot),
+ fmt.Sprintf("CONTAINERS_RUNROOT=%s", runroot))
}
// unshareCmd execs whatever using the ID mappings that we want to use for ourselves
@@ -63,7 +62,7 @@ func unshareCmd(c *cliconfig.PodmanCommand) error {
c.InputArgs = []string{shell}
}
- runtime, err := libpodruntime.GetRuntime(getContext(), c)
+ runtime, err := adapter.GetRuntime(getContext(), c)
if err != nil {
return err
}
@@ -73,7 +72,7 @@ func unshareCmd(c *cliconfig.PodmanCommand) error {
}
cmd := exec.Command(c.InputArgs[0], c.InputArgs[1:]...)
- cmd.Env = unshareEnv(runtimeConfig)
+ cmd.Env = unshareEnv(runtimeConfig.StorageConfig.GraphRoot, runtimeConfig.StorageConfig.RunRoot)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr