Add configuration for podmansh

Use the configuration parameters from the newly introduced
PodmanshConfig struct. This allows podmansh to be configured via
configuration files.

Signed-off-by: phoenix <felix.niederwanger@suse.com>
This commit is contained in:
phoenix 2024-05-13 15:33:14 +02:00
parent 4fd425429b
commit 23c830704d
No known key found for this signature in database
GPG Key ID: 31860289A704FB3C
1 changed files with 3 additions and 2 deletions

View File

@ -43,12 +43,13 @@ func main() {
if filepath.Base(os.Args[0]) == registry.PodmanSh ||
(len(os.Args[0]) > 0 && filepath.Base(os.Args[0][1:]) == registry.PodmanSh) {
shell := strings.TrimPrefix(os.Args[0], "-")
cfg := registry.PodmanConfig()
args := []string{shell, "exec", "-i", "--wait", strconv.FormatUint(uint64(registry.PodmanConfig().ContainersConfDefaultsRO.Engine.PodmanshTimeout), 10)}
args := []string{shell, "exec", "-i", "--wait", strconv.FormatUint(uint64(cfg.ContainersConfDefaultsRO.PodmanshTimeout()), 10)}
if term.IsTerminal(0) || term.IsTerminal(1) || term.IsTerminal(2) {
args = append(args, "-t")
}
args = append(args, registry.PodmanSh, "/bin/sh")
args = append(args, cfg.ContainersConfDefaultsRO.Podmansh.Container, cfg.ContainersConfDefaultsRO.Podmansh.Shell)
if len(os.Args) > 1 {
args = append(args, os.Args[1:]...)
}