#!/usr/bin/python3

import os
import subprocess

#NVIDIA
driver = "/usr/share/live-installer/nvidia-driver.tar.gz"
if "install-nvidia" in subprocess.getoutput("cat /proc/cmdline") and os.path.exists(driver):
    print("Installing NVIDIA driver...")
    try:
        os.system("tar zxvf %s" % driver)
        os.system("DEBIAN_FRONTEND=noninteractive dpkg -i --force-depends nvidia-driver/*.deb")
        os.system("rm -rf nvidia-driver")
    except Exception as e:
        print("Failed to install NVIDIA driver: ", e)
