From bdf78c39f2bd71296d85da2f0b4a0b7a9624e20c Mon Sep 17 00:00:00 2001 From: Luca Di Maio Date: Fri, 4 Aug 2023 22:14:07 +0200 Subject: [PATCH] init: add /run/host/etc to nvidia search path for integration. Fix #848 Signed-off-by: Luca Di Maio --- distrobox-init | 13 ++++++++++++- docs/usage/distrobox-ephemeral.md | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/distrobox-init b/distrobox-init index eb074e8be7..56523426c3 100755 --- a/distrobox-init +++ b/distrobox-init @@ -751,7 +751,7 @@ EOF fi done # shellcheck disable=SC2086 - pacman -S --needed --noconfirm ${install_pkg} + pacman -S --noconfirm ${install_pkg} # Ensure we have tzdata installed and populated, sometimes container # images blank the zoneinfo directory, so we reinstall the package to @@ -1195,6 +1195,17 @@ done if [ "${nvidia}" -eq 1 ]; then printf "distrobox: Setting up host's nvidia drivers integration...\n" + # First we find all non-lib files we need in /etc/ + # - confs + # - icd files + # - egl files + NVIDIA_ETC="$(find /run/host/etc/ \ + -type f -iname "*nvidia*" -print || :)" + for nvidia_file in ${NVIDIA_ETC}; do + dest_file="$(printf "%s" "${nvidia_file}" | sed 's|/run/host||g')" + mount_bind "${nvidia_file}" "${dest_file}" ro + done + # First we find all non-lib files we need, this includes # - binaries # - confs diff --git a/docs/usage/distrobox-ephemeral.md b/docs/usage/distrobox-ephemeral.md index 215a201496..e2c24f5372 100644 --- a/docs/usage/distrobox-ephemeral.md +++ b/docs/usage/distrobox-ephemeral.md @@ -30,8 +30,8 @@ You can also use [flags from **distrobox-create**](distrobox-create.md) to custo # SEE ALSO - man distrobox-create distrobox-create --help + man distrobox-create # ENVIRONMENT VARIABLES