Update jlmkr.py

This commit is contained in:
Jip-Hop 2023-02-28 22:17:20 +01:00
parent 845b1b404c
commit de51c05825
1 changed files with 11 additions and 1 deletions

View File

@ -170,6 +170,13 @@ def start_jail(jail_name):
Failed to run nvidia-container-cli. Failed to run nvidia-container-cli.
Unable to mount the nvidia driver files.""")) Unable to mount the nvidia driver files."""))
if len(nvidia_driver_files):
additional_nvidia_library = '/usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1'
if os.path.exists(additional_nvidia_library):
# Add libnvidia-ml.so.1
# Not listed by nvidia-container-cli, but required
nvidia_driver_files.append(additional_nvidia_library)
for file_path in nvidia_driver_files: for file_path in nvidia_driver_files:
if not file_path: if not file_path:
# Skip empty strings # Skip empty strings
@ -647,7 +654,8 @@ def delete_jail(jail_name):
if check_jail_name_available(jail_name, False): if check_jail_name_available(jail_name, False):
eprint(f"A jail with name {jail_name} does not exist.") eprint(f"A jail with name {jail_name} does not exist.")
else: else:
check = input(f'\nCAUTION: Type "{jail_name}" to confirm jail deletion!\n\n') or "" check = input(
f'\nCAUTION: Type "{jail_name}" to confirm jail deletion!\n\n') or ""
if check == jail_name: if check == jail_name:
jail_path = get_jail_path(jail_name) jail_path = get_jail_path(jail_name)
print(f"\nTrying to stop {jail_name} if it was running...") print(f"\nTrying to stop {jail_name} if it was running...")
@ -659,6 +667,7 @@ def delete_jail(jail_name):
else: else:
eprint("Wrong name, nothing happened.") eprint("Wrong name, nothing happened.")
def list_jails(): def list_jails():
""" """
List all available and running jails. List all available and running jails.
@ -676,6 +685,7 @@ def list_jails():
print("\nCurrently running:\n") print("\nCurrently running:\n")
subprocess.run(['machinectl', 'list']) subprocess.run(['machinectl', 'list'])
def main(): def main():
if os.stat(__file__).st_uid != 0: if os.stat(__file__).st_uid != 0:
fail("This script should be owned by the root user...") fail("This script should be owned by the root user...")