diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-10-07 14:02:54 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-10-09 23:39:18 +0200 |
commit | 5963077e93937046b6b13d6f1da8c1f932c0e6ff (patch) | |
tree | 9666910e2f6d3c25dcafe0f8dbb35f01027e36db /cmd/podman/shared/create.go | |
parent | 3ba3e1c7510d1780b6527a4aa52e40ac2c5b576a (diff) | |
download | podman-5963077e93937046b6b13d6f1da8c1f932c0e6ff.tar.gz podman-5963077e93937046b6b13d6f1da8c1f932c0e6ff.tar.bz2 podman-5963077e93937046b6b13d6f1da8c1f932c0e6ff.zip |
cli: support --systemd=always
it enforces the systemd mode also when the command name doesn't match
/usr/sbin/init or systemd.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'cmd/podman/shared/create.go')
-rw-r--r-- | cmd/podman/shared/create.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go index 675dfbad6..7c56db8db 100644 --- a/cmd/podman/shared/create.go +++ b/cmd/podman/shared/create.go @@ -662,9 +662,17 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod. return nil, errors.Errorf("invalid image-volume type %q. Pick one of bind, tmpfs, or ignore", c.String("image-volume")) } - var systemd bool - if command != nil && c.Bool("systemd") && (command[0] == "/usr/sbin/init" || (filepath.Base(command[0]) == "systemd")) { - systemd = true + systemd := c.String("systemd") == "always" + if !systemd && command != nil { + x, err := strconv.ParseBool(c.String("systemd")) + if err != nil { + return nil, errors.Wrapf(err, "cannot parse bool %s", c.String("systemd")) + } + if x && (command[0] == "/usr/sbin/init" || (filepath.Base(command[0]) == "systemd")) { + systemd = true + } + } + if systemd { if signalString == "" { stopSignal, err = signal.ParseSignal("RTMIN+3") if err != nil { |