@@ -28,20 +28,18 @@ import (
28
28
log "github.com/sirupsen/logrus"
29
29
30
30
"github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk-installer/container/operator"
31
+ "github.com/NVIDIA/nvidia-container-toolkit/internal/config"
31
32
)
32
33
33
34
type executable struct {
34
35
requiresKernelModule bool
35
36
path string
36
37
symlink string
37
- args []string
38
38
env map [string ]string
39
39
}
40
40
41
- func (t * toolkitInstaller ) collectExecutables (destDir string ) ([]Installer , error ) {
42
- configHome := filepath .Join (destDir , ".config" )
43
- configDir := filepath .Join (configHome , "nvidia-container-runtime" )
44
- configPath := filepath .Join (configDir , "config.toml" )
41
+ func (t * ToolkitInstaller ) collectExecutables (destDir string ) ([]Installer , error ) {
42
+ configFilePath := t .ConfigFilePath (destDir )
45
43
46
44
executables := []executable {
47
45
{
@@ -56,7 +54,7 @@ func (t *toolkitInstaller) collectExecutables(destDir string) ([]Installer, erro
56
54
path : runtime .Path ,
57
55
requiresKernelModule : true ,
58
56
env : map [string ]string {
59
- "XDG_CONFIG_HOME" : configHome ,
57
+ config . FilePathOverrideEnvVar : configFilePath ,
60
58
},
61
59
}
62
60
executables = append (executables , e )
@@ -72,7 +70,9 @@ func (t *toolkitInstaller) collectExecutables(destDir string) ([]Installer, erro
72
70
executable {
73
71
path : "nvidia-container-runtime-hook" ,
74
72
symlink : "nvidia-container-toolkit" ,
75
- args : []string {fmt .Sprintf ("-config %s" , configPath )},
73
+ env : map [string ]string {
74
+ config .FilePathOverrideEnvVar : configFilePath ,
75
+ },
76
76
},
77
77
)
78
78
@@ -94,7 +94,6 @@ func (t *toolkitInstaller) collectExecutables(destDir string) ([]Installer, erro
94
94
Source : executablePath ,
95
95
WrappedExecutable : dotRealFilename ,
96
96
CheckModules : executable .requiresKernelModule ,
97
- Args : executable .args ,
98
97
Envvars : map [string ]string {
99
98
"PATH" : strings .Join ([]string {destDir , "$PATH" }, ":" ),
100
99
},
@@ -124,7 +123,6 @@ type wrapper struct {
124
123
Envvars map [string ]string
125
124
WrappedExecutable string
126
125
CheckModules bool
127
- Args []string
128
126
}
129
127
130
128
type render struct {
165
163
{{$key}}={{$value}} \
166
164
{{- end }}
167
165
{{ .DestDir }}/{{ .WrappedExecutable }} \
168
- {{- range $arg := .Args }}
169
- {{$arg}} \
170
- {{- end }}
171
166
"$@"
172
167
`
173
168
0 commit comments