diff --git a/meson.build b/meson.build index 6f044bb..653a3d3 100644 --- a/meson.build +++ b/meson.build @@ -18,12 +18,12 @@ subid_dep = cc.find_library('subid', has_headers: ['shadow/subid.h']) go = find_program('go') go_md2man = find_program('go-md2man') -podman = find_program('podman') bats = find_program('bats', required: false) codespell = find_program('codespell', required: false) htpasswd = find_program('htpasswd', required: false) openssl = find_program('openssl', required: false) +podman = find_program('podman', required: false) shellcheck = find_program('shellcheck', required: false) skopeo = find_program('skopeo', required: false) diff --git a/src/cmd/root.go b/src/cmd/root.go index 304b03d..9975ccc 100644 --- a/src/cmd/root.go +++ b/src/cmd/root.go @@ -166,7 +166,7 @@ func preRun(cmd *cobra.Command, args []string) error { logrus.Debugf("TOOLBOX_PATH is %s", toolboxPath) - if err := migrate(); err != nil { + if err := migrate(cmd, args); err != nil { return err } @@ -211,13 +211,18 @@ func rootRun(cmd *cobra.Command, args []string) error { return rootRunImpl(cmd, args) } -func migrate() error { +func migrate(cmd *cobra.Command, args []string) error { logrus.Debug("Migrating to newer Podman") if utils.IsInsideContainer() { return nil } + if cmdName, completionCmdName := cmd.Name(), completionCmd.Name(); cmdName == completionCmdName { + logrus.Debugf("Migration not needed: command %s doesn't need it", cmdName) + return nil + } + configDir, err := os.UserConfigDir() if err != nil { logrus.Debugf("Migrating to newer Podman: failed to get the user config directory: %s", err)