From f89cef307df4194d95fe99f294219c34ce3007cb Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 9 Feb 2024 14:28:02 +0100 Subject: [PATCH] Specify DRIVER_ROOT consistently This change ensures that CLI tools that require the path to the driver root accept both the NVIDIA_DRIVER_ROOT and DRIVER_ROOT environment variables in addition to the --driver-root command line argument. Signed-off-by: Evan Lezar --- .../create-dev-char-symlinks/create-dev-char-symlinks.go | 2 +- .../system/create-device-nodes/create-device-nodes.go | 2 +- cmd/nvidia-ctk/system/print-ldcache/print-ldcache.go | 2 +- tools/container/toolkit/toolkit.go | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/nvidia-ctk/system/create-dev-char-symlinks/create-dev-char-symlinks.go b/cmd/nvidia-ctk/system/create-dev-char-symlinks/create-dev-char-symlinks.go index ad5c4af1..7d269b92 100644 --- a/cmd/nvidia-ctk/system/create-dev-char-symlinks/create-dev-char-symlinks.go +++ b/cmd/nvidia-ctk/system/create-dev-char-symlinks/create-dev-char-symlinks.go @@ -87,7 +87,7 @@ func (m command) build() *cli.Command { Usage: "The path to the driver root. `DRIVER_ROOT`/dev is searched for NVIDIA device nodes.", Value: "/", Destination: &cfg.driverRoot, - EnvVars: []string{"DRIVER_ROOT"}, + EnvVars: []string{"NVIDIA_DRIVER_ROOT", "DRIVER_ROOT"}, }, &cli.BoolFlag{ Name: "watch", diff --git a/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go b/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go index 8e4cf515..b9c58a39 100644 --- a/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go +++ b/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go @@ -69,7 +69,7 @@ func (m command) build() *cli.Command { Usage: "the path to the driver root. Device nodes will be created at `DRIVER_ROOT`/dev", Value: "/", Destination: &opts.driverRoot, - EnvVars: []string{"DRIVER_ROOT"}, + EnvVars: []string{"NVIDIA_DRIVER_ROOT", "DRIVER_ROOT"}, }, &cli.BoolFlag{ Name: "control-devices", diff --git a/cmd/nvidia-ctk/system/print-ldcache/print-ldcache.go b/cmd/nvidia-ctk/system/print-ldcache/print-ldcache.go index b12184c4..87493b7f 100644 --- a/cmd/nvidia-ctk/system/print-ldcache/print-ldcache.go +++ b/cmd/nvidia-ctk/system/print-ldcache/print-ldcache.go @@ -62,7 +62,7 @@ func (m command) build() *cli.Command { Usage: "the path to the driver root. Device nodes will be created at `DRIVER_ROOT`/dev", Value: "/", Destination: &opts.driverRoot, - EnvVars: []string{"DRIVER_ROOT"}, + EnvVars: []string{"NVIDIA_DRIVER_ROOT", "DRIVER_ROOT"}, }, } diff --git a/tools/container/toolkit/toolkit.go b/tools/container/toolkit/toolkit.go index 75b4629c..1db3a6f4 100644 --- a/tools/container/toolkit/toolkit.go +++ b/tools/container/toolkit/toolkit.go @@ -118,10 +118,11 @@ func main() { flags := []cli.Flag{ &cli.StringFlag{ - Name: "nvidia-driver-root", + Name: "driver-root", + Aliases: []string{"nvidia-driver-root"}, Value: DefaultNvidiaDriverRoot, Destination: &opts.DriverRoot, - EnvVars: []string{"NVIDIA_DRIVER_ROOT"}, + EnvVars: []string{"NVIDIA_DRIVER_ROOT", "DRIVER_ROOT"}, }, &cli.StringFlag{ Name: "driver-root-ctr-path",