aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-05-16 15:55:48 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-05-16 15:58:46 +0200
commit4b480240573be4cd8fe04505b6a435a6aa454f86 (patch)
treedbd8c2f514db6d6858cf74eb0fd51e2a32541d5b /cmd
parent2bb1487a00d23bb38314b7d7ee861952b7c6517e (diff)
downloadpodman-4b480240573be4cd8fe04505b6a435a6aa454f86.tar.gz
podman-4b480240573be4cd8fe04505b6a435a6aa454f86.tar.bz2
podman-4b480240573be4cd8fe04505b6a435a6aa454f86.zip
unshare: use rootless from libpod
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/unshare.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd/podman/unshare.go b/cmd/podman/unshare.go
index 1db647dba..b9ae8dd6b 100644
--- a/cmd/podman/unshare.go
+++ b/cmd/podman/unshare.go
@@ -6,7 +6,7 @@ import (
"os"
"os/exec"
- "github.com/containers/buildah/pkg/unshare"
+ "github.com/containers/libpod/pkg/rootless"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -30,9 +30,13 @@ func init() {
flags.SetInterspersed(false)
}
+func unshareEnv() []string {
+ return append(os.Environ(), "_CONTAINERS_USERNS_CONFIGURED=done")
+}
+
// unshareCmd execs whatever using the ID mappings that we want to use for ourselves
func unshareCmd(c *cobra.Command, args []string) error {
- if isRootless := unshare.IsRootless(); !isRootless {
+ if isRootless := rootless.IsRootless(); !isRootless {
return errors.Errorf("please use unshare with rootless")
}
// exec the specified command, if there is one
@@ -45,10 +49,9 @@ func unshareCmd(c *cobra.Command, args []string) error {
args = []string{shell}
}
cmd := exec.Command(args[0], args[1:]...)
- cmd.Env = unshare.RootlessEnv()
+ cmd.Env = unshareEnv()
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
- unshare.ExecRunnable(cmd)
- return nil
+ return cmd.Run()
}