def install_dependencies()

in linux/install_gpu_driver.py [0:0]


def install_dependencies(system: System, version: str):
    """
    Installs the driver dependencies to the system.
    This function may restart the system after installing some of the packages,
    in such situations the script should just be started again.
    """
    if DEPENDENCIES_INSTALLED_FLAG.is_file():
        return

    reboot_flag = False

    if system in (System.CentOS, System.RHEL, System.Rocky):
        reboot_flag = install_dependencies_centos_rhel_rocky(system, version)
    elif system in (System.Debian, System.Ubuntu):
        reboot_flag = install_dependencies_debian_ubuntu(system, version)
    elif system == System.SUSE:
        reboot_flag = install_dependencies_sles(system, version)
    else:
        raise RuntimeError("Unsupported operating system!")

    if reboot_flag:
        reboot()
    else:
        with DEPENDENCIES_INSTALLED_FLAG.open(mode="w") as flag:
            flag.write("1")

    if system == System.CentOS:
        # Both supported CentOS versions require reboot after this step
        reboot()