@@ -28,20 +28,18 @@ import (
2828 log "github.com/sirupsen/logrus"
2929
3030 "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk-installer/container/operator"
31+ "github.com/NVIDIA/nvidia-container-toolkit/internal/config"
3132)
3233
3334type executable struct {
3435 requiresKernelModule bool
3536 path string
3637 symlink string
37- args []string
3838 env map [string ]string
3939}
4040
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 )
4543
4644 executables := []executable {
4745 {
@@ -56,7 +54,7 @@ func (t *toolkitInstaller) collectExecutables(destDir string) ([]Installer, erro
5654 path : runtime .Path ,
5755 requiresKernelModule : true ,
5856 env : map [string ]string {
59- "XDG_CONFIG_HOME" : configHome ,
57+ config . FilePathOverrideEnvVar : configFilePath ,
6058 },
6159 }
6260 executables = append (executables , e )
@@ -72,7 +70,9 @@ func (t *toolkitInstaller) collectExecutables(destDir string) ([]Installer, erro
7270 executable {
7371 path : "nvidia-container-runtime-hook" ,
7472 symlink : "nvidia-container-toolkit" ,
75- args : []string {fmt .Sprintf ("-config %s" , configPath )},
73+ env : map [string ]string {
74+ config .FilePathOverrideEnvVar : configFilePath ,
75+ },
7676 },
7777 )
7878
@@ -94,7 +94,6 @@ func (t *toolkitInstaller) collectExecutables(destDir string) ([]Installer, erro
9494 Source : executablePath ,
9595 WrappedExecutable : dotRealFilename ,
9696 CheckModules : executable .requiresKernelModule ,
97- Args : executable .args ,
9897 Envvars : map [string ]string {
9998 "PATH" : strings .Join ([]string {destDir , "$PATH" }, ":" ),
10099 },
@@ -124,7 +123,6 @@ type wrapper struct {
124123 Envvars map [string ]string
125124 WrappedExecutable string
126125 CheckModules bool
127- Args []string
128126}
129127
130128type render struct {
165163{{$key}}={{$value}} \
166164{{- end }}
167165 {{ .DestDir }}/{{ .WrappedExecutable }} \
168- {{- range $arg := .Args }}
169- {{$arg}} \
170- {{- end }}
171166 "$@"
172167`
173168
0 commit comments