From ae23b1330103b1e7f89475fa6115a3931a5c334f Mon Sep 17 00:00:00 2001 From: Jip-Hop <2871973+Jip-Hop@users.noreply.github.com> Date: Sat, 27 Jan 2024 04:23:46 +0100 Subject: [PATCH] Just ask for GPU passthrough --- jlmkr.py | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/jlmkr.py b/jlmkr.py index 51b14cd..488db32 100755 --- a/jlmkr.py +++ b/jlmkr.py @@ -330,7 +330,7 @@ def start_jail(jail_name, check_startup_enabled=False): # - how to call the option to enable ip_forward and bridge-nf-call? # TODO: always add --bind-ro=/sys/module? Or only for privileged jails? # https://manpages.debian.org/bookworm/manpages/sysfs.5.en.html - + if config.get("docker_compatible") == "1": # Enable ip forwarding on the host (docker needs it) print(1, file=open("/proc/sys/net/ipv4/ip_forward", "w")) @@ -720,29 +720,15 @@ def create_jail(jail_name, distro="debian", release="bookworm"): gpu_passthrough_intel = 0 - if os.path.exists("/dev/dri"): - print("Detected the presence of an intel GPU.\n") - if agree("Passthrough the intel GPU?", "n"): - gpu_passthrough_intel = 1 + if agree("Passthrough the intel GPU (if present)?", "n"): + gpu_passthrough_intel = 1 + + print() gpu_passthrough_nvidia = 0 - if ( - subprocess.run( - ["modprobe", "nvidia-current-uvm"], - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, - ).returncode - == 0 - ): - nvidia_detected = True - else: - nvidia_detected = False - - if nvidia_detected: - print("Detected the presence of an nvidia GPU.\n") - if agree("Passthrough the nvidia GPU?", "n"): - gpu_passthrough_nvidia = 1 + if agree("Passthrough the nvidia GPU (if present)?", "n"): + gpu_passthrough_nvidia = 1 print( dedent(