mirror of
https://github.com/containers/podman.git
synced 2025-10-15 02:06:42 +08:00
Use set for systemd commands
Signed-off-by: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
@ -164,7 +164,12 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
|
||||
}
|
||||
|
||||
if len(command) > 0 {
|
||||
if command[0] == "/usr/sbin/init" || command[0] == "/sbin/init" || command[0] == "/usr/local/sbin/init" || (filepath.Base(command[0]) == "systemd") {
|
||||
useSystemdCommands := map[string]bool{
|
||||
"/sbin/init": true,
|
||||
"/usr/sbin/init": true,
|
||||
"/usr/local/sbin/init": true,
|
||||
}
|
||||
if useSystemdCommands[command[0]] || (filepath.Base(command[0]) == "systemd") {
|
||||
useSystemd = true
|
||||
}
|
||||
}
|
||||
|
@ -704,7 +704,12 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "cannot parse bool %s", c.String("systemd"))
|
||||
}
|
||||
if x && (command[0] == "/usr/sbin/init" || command[0] == "/sbin/init" || command[0] == "/usr/local/sbin/init" || (filepath.Base(command[0]) == "systemd")) {
|
||||
useSystemdCommands := map[string]bool{
|
||||
"/sbin/init": true,
|
||||
"/usr/sbin/init": true,
|
||||
"/usr/local/sbin/init": true,
|
||||
}
|
||||
if x && (useSystemdCommands[command[0]] || (filepath.Base(command[0]) == "systemd")) {
|
||||
systemd = true
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user