From 846d4c2e0139d75d3ff082b9140921dcd657149c Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 11 Aug 2020 13:29:17 +0200 Subject: Use set for systemd commands Signed-off-by: Christian Heimes --- pkg/specgen/generate/container_create.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pkg/specgen/generate') diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index a9eae94af..ec32ab47d 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -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 } } -- cgit v1.2.3-54-g00ecf