From f3080181ac22c00831676b3e5f9b9a64a70aab32 Mon Sep 17 00:00:00 2001 From: BlackNoxis Date: Sat, 6 Jun 2015 21:26:46 +0300 Subject: [gpu-detector] fixed the gpu hardware detector --- sys-apps/gpu-detector/files/gpu-configuration | 88 ++++++++---------------- sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild | 7 +- sys-apps/gpu-detector/gpu-detector-4.ebuild | 24 +++++++ 3 files changed, 55 insertions(+), 64 deletions(-) create mode 100644 sys-apps/gpu-detector/gpu-detector-4.ebuild (limited to 'sys-apps') diff --git a/sys-apps/gpu-detector/files/gpu-configuration b/sys-apps/gpu-detector/files/gpu-configuration index 2f816efe..8e55cb8d 100755 --- a/sys-apps/gpu-detector/files/gpu-configuration +++ b/sys-apps/gpu-detector/files/gpu-configuration @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- import os +import errno import subprocess try: from subprocess import getoutput @@ -15,7 +16,7 @@ xorgfile = "/etc/X11/xorg.conf" lspci = '/usr/sbin/lspci' nvidia_settings = "/usr/share/applications/nvidia-settings.desktop" -device_id_prefix = "RogentosVga" +device_id_prefix = "KogaionVga" nvidia_option_prefix = "--nvidia-opt--" screen_layout_sections = [] device_sections = [] @@ -235,23 +236,6 @@ def setup_radeon_kms(): else: print("I was about to modprobe radeon modeset=1") -def remove_tar_members_from_sys(tarpath): - import tarfile - tar = tarfile.open(tarpath) - for el in sorted(tar.getnames(), reverse = True): - el = "/%s" % (el,) - if os.path.isfile(el): - try: - os.remove(el) - except OSError: - pass - if os.path.isdir(el): - try: - os.rmdir(el) - except OSError: - pass - tar.close() - def generate_fglrx_steps(videocard, cardnumber, total_cards, bus_id): print("AMD!") print("total supported AMD cards: %s" % (len(fglrx_supported),)) @@ -344,43 +328,19 @@ def deploy_nvidia_xxxxxx_drivers(ver): continue if pkg.startswith("x11-drivers:nvidia-drivers-" + ver): _packages.append(pkg) - elif pkg.startswith("x11-drivers:nvidia-userspace" + ver): + elif pkg.startswith("x11-drivers:nvidia-userspace-" + ver): _packages.append(pkg) packages = [os.path.join(drivers_dir, x) for x in _packages] - package_names = ["x11-drivers/nvidia-drivers", - "x11-drivers/nvidia-userspace"] if not packages: return False - from entropy.client.interfaces import Client - _entropy = Client() - - # prepare system - for package_name in package_names: - inst_repo = _entropy.installed_repository() - package_id, result = inst_repo.atomMatch(package_name) - if package_id == -1: - continue - content = inst_repo.retrieveContentIter(package_id) - for myfile, ftype in content: - try: - os.remove(myfile) - except (OSError, IOError): - pass - - if hasattr(_entropy,"destroy"): - _entropy.destroy() + rc = subprocess.call(["/usr/bin/equo", "install", "--nodeps"] + packages) + if rc: + return False - for package_file in packages: - # remove old garbage - copy over - create module - subprocess.call( - ["tar", "xjf", package_file, "-C", "/"]) - # try to check driver status now - rc = check_if_proprietary_driver_system_is_healthy("nvidia") - if not rc: - remove_tar_members_from_sys(package_file) - return rc + # try to check driver status now + return check_if_proprietary_driver_system_is_healthy("nvidia") efivars_loaded = False def is_efi(): @@ -430,7 +390,7 @@ Section "Device" # UseEvents is causing segmentation faults with # NVIDIA 6xxx, 7xxx and >=275.xx.xx drivers #Option "UseEvents" "True" - Option "LogoPath" "/usr/share/backgrounds/rogentoslinux-nvidia.png" + Option "LogoPath" "/usr/share/backgrounds/kogaionlinux-nvidia.png" EndSection """ % (device_id_prefix, cardnum, xdriver, bus_id_mark, bus_id,)) @@ -541,17 +501,19 @@ def setup_nvidia_drivers(card_id): ("96", nvidia_173xx_supported,), ("71", nvidia_173xx_supported,), ) - for ver, lst in drivers_map: - if card_id not in lst: - continue - print("NVIDIA %s driver selected" % (ver,)) - drv_string = ver - if livecd: - rc = deploy_nvidia_xxxxxx_drivers(ver) - if rc: - print("NVIDIA %s deployed correctly" % (ver,)) - done_legacy = True - break + + if not nvidia_disablelegacy: + for ver, lst in drivers_map: + if card_id not in lst: + continue + print("NVIDIA %s driver selected" % (ver,)) + drv_string = ver + if livecd: + rc = deploy_nvidia_xxxxxx_drivers(ver) + if rc: + print("NVIDIA %s deployed correctly" % (ver,)) + done_legacy = True + break if not done_legacy: drv_string = '[latest]' @@ -562,7 +524,11 @@ def setup_nvidia_drivers(card_id): print("NVIDIA proprietary driver %s is loaded" % (drv_string,)) if done_legacy: - os.makedirs("/lib/nvidia/legacy") + try: + os.makedirs("/lib/nvidia/legacy") + except OSError as err: + if err.errno != errno.EEXIST: + raise with open("/lib/nvidia/legacy/running", "w") as f: f.write("%s" % (drv_string,)) diff --git a/sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild b/sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild index 405d693b..290a2a03 100644 --- a/sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild +++ b/sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild @@ -1,15 +1,16 @@ # Copyright 2004-2010 Sabayon +# Copyright 2015 Kogaion Team # Distributed under the terms of the GNU General Public License v2 -DESCRIPTION="Sabayon live tool for X.Org video driver configuration" -HOMEPAGE="http://www.sabayon.org" +DESCRIPTION="Sabayon-based live tool for X.Org video driver configuration" +HOMEPAGE="http://www.rogentos.ro" SRC_URI="" LICENSE="GPL-2" SLOT="0" KEYWORDS="x86 amd64 ppc" IUSE="" -RDEPEND=">=app-misc/rogentoslive-tools-1.0 +RDEPEND=">=app-misc/kogaion-live-1.0 !>sys-apps/gpu-detector-2.6" DEPEND="" diff --git a/sys-apps/gpu-detector/gpu-detector-4.ebuild b/sys-apps/gpu-detector/gpu-detector-4.ebuild new file mode 100644 index 00000000..9b01cc94 --- /dev/null +++ b/sys-apps/gpu-detector/gpu-detector-4.ebuild @@ -0,0 +1,24 @@ +# Copyright 2004-2013 Sabayon +# Distributed under the terms of the GNU General Public License v2 + +DESCRIPTION="Configures your GPU when autodetection fails do to it" +HOMEPAGE="http://www.rogentos.ro" +SRC_URI="" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="x86 amd64 ppc" +IUSE="" + +RDEPEND="app-misc/kogaion-live" +DEPEND="${RDEPEND}" + +src_unpack () { + cd "${WORKDIR}" + cp "${FILESDIR}"/gpu-configuration . -p +} + +src_install () { + cd "${WORKDIR}" + exeinto /sbin/ + doexe gpu-configuration +} -- cgit v1.2.3