summaryrefslogtreecommitdiffstats
path: root/share/hooks
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2020-03-01 14:34:21 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2020-03-01 14:34:21 +0000
commit1b34b79bf1dde375792a2b7218513f065b7125e9 (patch)
treeb355da7742b56f8dbbb8e2161299477d647026e0 /share/hooks
parentCorrecting permissions of pre-start.unlink-console.sh hook. (diff)
downloadcompute-tools-1b34b79bf1dde375792a2b7218513f065b7125e9.tar.xz
compute-tools-1b34b79bf1dde375792a2b7218513f065b7125e9.zip
Adding post-start hook to set nvidia device ownership.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share/hooks')
-rwxr-xr-xshare/hooks/post-start.chown-nvidia.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/share/hooks/post-start.chown-nvidia.sh b/share/hooks/post-start.chown-nvidia.sh
new file mode 100755
index 0000000..457b6e5
--- /dev/null
+++ b/share/hooks/post-start.chown-nvidia.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+if grep -qs nvidia /var/lib/machines/"${NAME}"/etc/group
+then
+ chroot "/var/lib/machines/${NAME}" chown root:nvidia "/dev/nvidia*"
+fi