diff --git a/README.md b/README.md index 3b20e15..88f693b 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,25 @@ -

nvidia-auto-installer-for-fedora

-

A CLI tool which lets you install proprietary NVIDIA drivers and much more easily on Fedora 32 and above

+

NVIDIA Auto Installer for Fedora Linux

+

A CLI tool which lets you install proprietary NVIDIA drivers and much more easily on Fedora Linux (32 or above, ELN or Rawhide)

- - - - + + + +

-## Requirements -* Active internet connection -* Fedora 32 or above +

+ +

-## Installation +### Requirements +* Active internet connection +* Fedora Linux (32 or above, ELN or Rawhide) +* Device with a discrete NVIDIA GPU -If you use Fedora (32, 33, 34 ELN, Rawhide or above), CentOS (Stream 8 or above), RHEL (8 or above), Mageia (7, Cauldron or above), OpenSUSE (Leap or Tumbleweed) - you can install NVIDIA Auto Installer for Fedora by enabling my COPR repository. Simply execute the following commands in succession to install the tool. +### Installation +If you use Fedora Linux (32 or above, ELN or Rawhide) - you can install NVIDIA Auto Installer for Fedora by enabling my +COPR repository. Simply execute the following commands in succession to install the tool. ```shell # dnf install dnf-plugins-core -y @@ -22,61 +27,396 @@ If you use Fedora (32, 33, 34 ELN, Rawhide or above), CentOS (Stream 8 or above) # dnf install nvautoinstall -y ``` -## Usage +### Usage 1. Make sure you have a working internet connection 2. Install the tool from COPR with the above instructions 3. Execute `nvautoinstall` to check installation modes 4. Run the installation modes according to your needs 5. Give stars to the repository if you found this helpful -## Modes of installation +### Modes of installation Active internet connection and superuser privilege is required to execute the following installation modes. -- **`sudo nvautoinstall --rpmadd`** -This mode enables the RPM Fusion NVIDIA drivers repository. -- **`sudo nvautoinstall --driver`** -This mode simply installs the NVIDIA drivers (with x86_64 deps only). Enabling the RPM Fusion NVIDIA drivers repository is mandatory before doing this. -- **`sudo nvautoinstall --x86lib`** -This mode installs only the x86 libraries for Xorg. Enabling the RPM Fusion NVIDIA drivers repository and installing the basic drivers are mandatory before doing this. -- **`sudo nvautoinstall --nvrepo`** -This mode enables the official NVIDIA repository for CUDA software. -- **`sudo nvautoinstall --plcuda`** -This mode installs only the CUDA support softwares. Enabling the RPM Fusion NVIDIA drivers and NVIDIA official repository, and installing the basic drivers are mandatory before doing this. -- **`sudo nvautoinstall --ffmpeg`** -This mode installs only the FFMPEG acceleration. Enabling the RPM Fusion NVIDIA drivers repository and installing the basic drivers are mandatory before doing this. -- **`sudo nvautoinstall --vulkan`** -This mode installs only the Vulkan renderer. Enabling the RPM Fusion NVIDIA drivers repository and installing the basic drivers are mandatory before doing this. -- **`sudo nvautoinstall --vidacc`** -This mode installs only the VDPAU/VAAPI acceleration. Enabling the RPM Fusion NVIDIA drivers repository and installing the basic drivers are mandatory before doing this. -- **`sudo nvautoinstall --getall`** -This mode installs all the above packages. (Not been implemented yet) -- **`sudo nvautoinstall --cheksu`** -This mode allows you to check the current user privilege level. You can use this tool effectively only when you have logged in as a root or sudo user. -- **`sudo nvautoinstall --compat`** -This mode allows you to check your hardware and host compatibility. The tool would check your hardware and host and tell if your device is supported by the tool or not. -- **`sudo nvautoinstall --primec`** -This mode allows you to toggle the PRIME offloading to render all display elements using the discrete card. This has only been tested on Workstation variant of Fedora. +- **`sudo nvautoinstall rpmadd`** + This mode enables the RPM Fusion NVIDIA drivers repository. +- **`sudo nvautoinstall driver`** + This mode simply installs the NVIDIA drivers. Enabling the RPM Fusion NVIDIA drivers repository is mandatory before + doing this. +- **`sudo nvautoinstall nvrepo`** + This mode enables the official NVIDIA repository for CUDA software. +- **`sudo nvautoinstall plcuda`** + This mode installs only the CUDA support softwares. Enabling the RPM Fusion NVIDIA drivers and NVIDIA official + repository, and installing the basic drivers are mandatory before doing this. +- **`sudo nvautoinstall ffmpeg`** + This mode installs only the FFMPEG acceleration. Enabling the RPM Fusion NVIDIA drivers repository and installing the + basic drivers are mandatory before doing this. +- **`sudo nvautoinstall vulkan`** + This mode installs only the Vulkan renderer. Enabling the RPM Fusion NVIDIA drivers repository and installing the + basic drivers are mandatory before doing this. +- **`sudo nvautoinstall vidacc`** + This mode installs only the VDPAU/VAAPI acceleration. Enabling the RPM Fusion NVIDIA drivers repository and + installing the basic drivers are mandatory before doing this. +- **`sudo nvautoinstall getall`** + This mode installs all the above packages. (Not been implemented yet) +- **`sudo nvautoinstall cheksu`** + This mode allows you to check the current user privilege level. You can use this tool effectively only when you have + logged in as a root or sudo user. +- **`sudo nvautoinstall compat`** + This mode allows you to check your hardware and host compatibility. The tool would check your hardware and host and + tell if your device is supported by the tool or not. +- **`sudo nvautoinstall primec`** + This mode allows you to toggle the PRIME offloading to render all display elements using the discrete card. This has + only been tested on Workstation variant of Fedora Linux. - **`sudo nvautoinstall --version`** -This mode would show the tool version and exit out. + This mode shows the tool version and exits out. - **`sudo nvautoinstall --help`** -This mode would show the help message and exit out. + This mode shows the help message and exits out. -## Note +### Note * Active internet connection is required to download drivers. * Requires secure boot to be turned off in UEFI systems. * Requires superuser access for repo addition and driver setup. -* The drivers are fetched from the RPMFusion repository. +* The drivers are fetched from the RPM Fusion repository. * Use discretion while using this on other spins. -* Only tested on 9XX/10XX/20XX series discrete cards. -* Use discretion while installing with older cards. +* Only tested on 9XX/10XX/20XX/30XX series discrete NVIDIA cards. +* Use discretion while installing with older discrete NVIDIA cards. * No additional configuration is required for Optimus setups. * Native support for PRIME configuration on Optimus. -## Coming soon +### Coming soon * CLI "Launch using Dedicated Graphics Card" option. * Intuitive mode switching for hybrid graphics. * Distinct mode for using integrated or discrete GPU. * Experimental support for RHEL 8 and CentOS 8. * Support for older cards by active querying at NVIDIA. -## Disclaimer -This tool has been tried and tested multiple times and is expected to work flawlessly in Fedora Workstation 32 or above. It has not been tested on any of the spins yet so proceed with caution. While the chances of things going wrong is pretty slim but still you would want to make backups, should things do not go as expected. As always, you are choosing to use this tool at your will and you cannot hold me responsible for any mishap there may occur due to the misuse of this tool. +### Disclaimer +This tool has been tried and tested multiple times and is expected to work flawlessly in Fedora Linux (32 or above, +ELN or Rawhide). It has not been tested on any of the spins yet so you are requested to proceed with caution. While the +chances of things going wrong is pretty slim, you would still want to make backups, should things do not go as expected. +As always, you are choosing to use this tool at your will and you cannot hold me responsible for any mishap that may +occur due to the misuse of this tool. + +### Previews + +#### Starting without any command + +``` +$ nvautoinstall +``` + +``` +Usage: nvautoinstall [OPTIONS] COMMAND [ARGS]... + +Options: + --version Show the version and exit. + --help Show this message and exit. + +Commands: + cheksu Check the user privilege level. + compat Check your system compatibility. + driver Install the NVIDIA driver. + ffmpeg Install only the FFMPEG support software. + getall Install all the above packages. + nvrepo Enable the official NVIDIA repository for CUDA. + plcuda Install only the CUDA support software. + primec Setup PRIME support. + rpmadd Enable the RPM Fusion NVIDIA drivers repository. + vidacc Install only the VDPAU/VAAPI acceleration. + vulkan Install only the Vulkan support software. +``` + +#### Checking superuser permissions + +``` +$ sudo nvautoinstall cheksu +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING SUPERUSER PERMISSIONS... +[ ✓ ] Superuser permission is available + This tool is expected to work correctly here +[ ✗ ] Leaving installer +``` + +#### Checking the system compatibility + +``` +$ sudo nvautoinstall compat +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING FOR GPU COMPATIBILITY... +[ ! ] Compatibility infomation was obtained +[ ✓ ] One or more active NVIDIA GPUs were detected + 01:00.0 VGA compatible controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile / Max-Q] (rev a1) + 04:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Picasso/Raven 2 [Radeon Vega Series / Radeon Vega Mobile Series] (rev c2) +[ ✓ ] An Optimus Dual GPU setup was detected +[ ★ ] GATHERING CURRENT HOST INFORMATION... +[ ! ] Host information was gathered + System: Linux v5.15.6-100.fc34.x86_64 + Hostname: 038e97fb8ac6 + Version: #1 SMP Wed Dec 1 13:41:51 UTC 2021 + Distribution: Fedora Linux x86_64 +[ ★ ] CHECKING FOR HOST COMPATIBILITY... +[ ✓ ] Supported OS detected + This tool is expected to work correctly here +[ ✗ ] Leaving installer +``` + +#### Handling drivers installation + +``` +$ sudo nvautoinstall driver +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING SUPERUSER PERMISSIONS... +[ ✓ ] Superuser privilege acquired +[ ★ ] CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY... +[ ! ] RPM Fusion repository for Proprietary NVIDIA Driver was detected +[ ★ ] ATTEMPTING CONNECTION TO RPM FUSION SERVERS... +[ ✓ ] Connection to RPM Fusion servers was established +[ ★ ] LOOKING FOR EXISTING DRIVER PACKAGES... +[ ! ] No existing NVIDIA driver packages were detected +[ ★ ] INSTALLING PROPRIETARY DRIVERS... +..... +..... +..... +[ ✓ ] Driver package installation completed +[ ✗ ] Leaving installer +``` + +#### Installing FFMPEG support software + +``` +$ sudo nvautoinstall ffmpeg +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING SUPERUSER PERMISSIONS... +[ ✓ ] Superuser privilege acquired +[ ★ ] CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY... +[ ! ] RPM Fusion repository for Proprietary NVIDIA Driver was detected +[ ★ ] ATTEMPTING CONNECTION TO RPM FUSION SERVERS... +[ ✓ ] Connection to RPM Fusion servers was established +[ ★ ] LOOKING FOR EXISTING DRIVER PACKAGES... + xorg-x11-drv-nvidia-kmodsrc-495.44-4.fc35.x86_64 + xorg-x11-drv-nvidia-libs-495.44-4.fc35.x86_64 + akmod-nvidia-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-495.44-4.fc35.x86_64 + nvidia-settings-495.44-1.fc35.x86_64 +[ ! ] A total of 5 driver packages were detected +[ ★ ] INSTALLING NVENC/NVDEC FOR FFMPEG ACCELERATION... +..... +..... +..... +[ ✓ ] NVENC/NVDEC for FFMPEG acceleration were successfully installed +[ ✗ ] Leaving installer +``` + +#### Installing all the above packages + +``` +$ sudo nvautoinstall getall +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING SUPERUSER PERMISSIONS... +[ ✓ ] Superuser privilege acquired +[ ★ ] FULL FLEDGED INSTALLATION BEGINNING... + This mode is yet to be implemented +[ ✗ ] Leaving installer +``` + +#### Enabling the official NVIDIA repository for CUDA + +``` +$ sudo nvautoinstall nvrepo +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING SUPERUSER PERMISSIONS... +[ ✓ ] Superuser privilege acquired +[ ★ ] CHECKING AVAILABILITY OF OFFICIAL CUDA REPOSITORY... +[ ! ] Official CUDA repository was not detected +[ ! ] Repository enabling is required +[ ★ ] ATTEMPTING CONNECTION TO NVIDIA SERVERS... +[ ✓ ] Connection to NVIDIA servers was established +[ ★ ] INSTALLING OFFICIAL CUDA REPOSITORY... +[ ✓ ] Official CUDA repository was enabled +[ ★ ] REFRESHING REPOSITORY LIST... +..... +[ ✓ ] Repositories have been refreshed +[ ★ ] DISABLING NVIDIA DRIVER MODULE... +..... +..... +..... +[ ✓ ] NVIDIA DRIVER module has been disabled +[ ✗ ] Leaving installer +``` + +#### Installing CUDA support software + +``` +$ sudo nvautoinstall plcuda +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING SUPERUSER PERMISSIONS... +[ ✓ ] Superuser privilege acquired +[ ★ ] CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY... +[ ! ] RPM Fusion repository for Proprietary NVIDIA Driver was detected +[ ★ ] ATTEMPTING CONNECTION TO RPM FUSION SERVERS... +[ ✓ ] Connection to RPM Fusion servers was established +[ ★ ] LOOKING FOR EXISTING DRIVER PACKAGES... + xorg-x11-drv-nvidia-kmodsrc-495.44-4.fc35.x86_64 + xorg-x11-drv-nvidia-libs-495.44-4.fc35.x86_64 + akmod-nvidia-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-495.44-4.fc35.x86_64 + nvidia-settings-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-cuda-libs-495.44-4.fc35.x86_64 +[ ! ] A total of 6 driver packages were detected +[ ★ ] CHECKING AVAILABILITY OF OFFICIAL CUDA REPOSITORY... +[ ! ] Official CUDA repository was detected +[ ★ ] ATTEMPTING CONNECTION TO NVIDIA SERVERS... +[ ✓ ] Connection to NVIDIA servers was established +[ ★ ] INSTALLING RPM FUSION METAPACKAGE FOR CUDA... +..... +..... +..... +[ ✓ ] RPM Fusion CUDA metapackage was successfully installed +[ ★ ] INSTALLING NVIDIA CUDA CORE PACKAGES... +..... +..... +..... +[ ✓ ] NVIDIA CUDA core packages were successfully installed +[ ✗ ] Leaving installer +``` + +#### Setting up PRIME support + +``` +$ sudo nvautoinstall primec +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING SUPERUSER PERMISSIONS... +[ ✓ ] Superuser privilege acquired +[ ★ ] CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY... +[ ! ] RPM Fusion repository for Proprietary NVIDIA Driver was detected +[ ★ ] ATTEMPTING CONNECTION TO RPM FUSION SERVERS... +[ ✓ ] Connection to RPM Fusion servers was established +[ ★ ] LOOKING FOR EXISTING DRIVER PACKAGES... + xorg-x11-drv-nvidia-kmodsrc-495.44-4.fc35.x86_64 + xorg-x11-drv-nvidia-libs-495.44-4.fc35.x86_64 + akmod-nvidia-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-495.44-4.fc35.x86_64 + nvidia-settings-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-cuda-libs-495.44-4.fc35.x86_64 +[ ! ] A total of 6 driver packages were detected +[ ★ ] SETTING UP PRIME SUPPORT... +[ ! ] Intervention required + < Y > to enable PRIME support + < N > to disable PRIME support + < * > anything else to leave +[Y/N] Y +[ ★ ] ENABLING PRIME SUPPORT... +[ ✓ ] PRIME Support was successfully enabled +[ ✗ ] Leaving installer +``` + + +#### Enabling the RPM Fusion NVIDIA drivers repositories + +``` +$ sudo nvautoinstall rpmadd +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING SUPERUSER PERMISSIONS... +[ ✓ ] Superuser privilege acquired +[ ★ ] CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY... +[ ! ] RPM Fusion repository for Proprietary NVIDIA Driver was not detected +[ ! ] Repository enabling is required +[ ★ ] ATTEMPTING CONNECTION TO RPM FUSION SERVERS... +[ ✓ ] Connection to RPM Fusion servers was established +[ ★ ] INSTALLING RPM FUSION NVIDIA REPOSITORY... +..... +..... +..... +[ ✓ ] RPM Fusion NVIDIA repository was enabled +[ ✗ ] Leaving installer +``` + +#### Installing the VDPAU/VAAPI support software + +``` +$ sudo nvautoinstall vidacc +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING SUPERUSER PERMISSIONS... +[ ✓ ] Superuser privilege acquired +[ ★ ] CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY... +[ ! ] RPM Fusion repository for Proprietary NVIDIA Driver was detected +[ ★ ] ATTEMPTING CONNECTION TO RPM FUSION SERVERS... +[ ✓ ] Connection to RPM Fusion servers was established +[ ★ ] LOOKING FOR EXISTING DRIVER PACKAGES... + xorg-x11-drv-nvidia-kmodsrc-495.44-4.fc35.x86_64 + xorg-x11-drv-nvidia-libs-495.44-4.fc35.x86_64 + akmod-nvidia-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-495.44-4.fc35.x86_64 + nvidia-settings-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-cuda-libs-495.44-4.fc35.x86_64 + nvidia-persistenced-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-cuda-495.44-4.fc35.x86_64 +[ ! ] A total of 8 driver packages were detected +[ ★ ] INSTALLING VIDEO ACCELERATION SUPPORT... +..... +..... +..... +[ ✓ ] Video acceleration were successfully installed +[ ✗ ] Leaving installer +``` + +#### Installing Vulkan support software + +``` +$ sudo nvautoinstall vulkan +``` + +``` +[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX +[ ★ ] CHECKING SUPERUSER PERMISSIONS... +[ ✓ ] Superuser privilege acquired +[ ★ ] CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY... +[ ! ] RPM Fusion repository for Proprietary NVIDIA Driver was detected +[ ★ ] ATTEMPTING CONNECTION TO RPM FUSION SERVERS... +[ ✓ ] Connection to RPM Fusion servers was established +[ ★ ] LOOKING FOR EXISTING DRIVER PACKAGES... + xorg-x11-drv-nvidia-kmodsrc-495.44-4.fc35.x86_64 + xorg-x11-drv-nvidia-libs-495.44-4.fc35.x86_64 + akmod-nvidia-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-495.44-4.fc35.x86_64 + nvidia-settings-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-cuda-libs-495.44-4.fc35.x86_64 + nvidia-persistenced-495.44-1.fc35.x86_64 + xorg-x11-drv-nvidia-cuda-495.44-4.fc35.x86_64 +[ ! ] A total of 8 driver packages were detected +[ ★ ] INSTALLING VULKAN RENDERER SUPPORT... +..... +..... +..... +[ ✓ ] Vulkan renderer support were successfully installed +[ ✗ ] Leaving installer +``` diff --git a/SCREENSHOTS.md b/SCREENSHOTS.md deleted file mode 100644 index 5c5b497..0000000 --- a/SCREENSHOTS.md +++ /dev/null @@ -1,41 +0,0 @@ -# nvidia-auto-installer-for-fedora -v0.3.0 (04 June 2020) -A CLI tool which lets you install proprietary NVIDIA drivers and much more easily on Fedora 32 and above - -## Screenshots -The look and feel is heavily inspired from `systemd` and `eopkg` prompts. - -### v0.3.0 - -#### Host operating system and hardware compatibility check -![](pics/compat.png) - -#### Current user privilege level check -![](pics/cheksu.png) - -#### Adding official NVIDIA repo for CUDA support -![](pics/nvrepo.png) - -#### Adding RPM Fusion repository for NVIDIA drivers -![](pics/rpmadd.png) - -#### Installing VDPAU/VAAPI hardware video acceleration -![](pics/vidacc.png) - -#### Install Vulkan renderer -![](pics/vulkan.png) - -#### There are tons of more new addition with this update -They could not be listed here with their screenshots as there are too many of them. Feel free to check the releases and try them out. - -### v0.2.6 -This was a bugfix update targetted to take down a critical bug that prevented users to add the RPM Fusion repository for proprietary NVIDIA drivers. This does not look very different from v0.2.5, hence no screenshot was added for it. - -### v0.2.5 -![](pics/v0.2.5-screenshot.png) - -### v0.2.0 -![](pics/v0.2.0-screenshot.png) - -### v0.1.0 -![](pics/v0.1.0-screenshot.png) \ No newline at end of file diff --git a/nvautoinstall.spec b/nvautoinstall.spec index eee9d24..48a1873 100644 --- a/nvautoinstall.spec +++ b/nvautoinstall.spec @@ -1,11 +1,11 @@ -%global srcname nvidia-auto-installer-for-fedora +%global srcname nvidia-auto-installer-for-fedora-linux Name: nvautoinstall -Version: 0.3.9 -Release: 1%{?dist} -Summary: NVIDIA Auto Installer for Fedora +Version: 0.4.0 +Release: 0%{?dist} +Summary: NVIDIA Auto Installer for Fedora Linux -License: GPLv3 +License: GPLv3+ Url: https://github.com/t0xic0der/%{srcname} Source0: https://github.com/t0xic0der/%{srcname}/releases/download/v%{version}/%{name}-%{version}.tar.gz @@ -16,7 +16,7 @@ BuildRequires: python3-devel Requires: dnf-plugins-core %description -A CLI tool which lets you install proprietary NVIDIA drivers and much more +A CLI tool which lets you install proprietary NVIDIA drivers and much more easily on Fedora Linux (32 or above, ELN or Rawhide) %prep %autosetup @@ -38,6 +38,17 @@ A CLI tool which lets you install proprietary NVIDIA drivers and much more %changelog +* Thu Dec 16 2021 Akashdeep Dhar - 0.4.0-0 +- v0.4.0 +- Restructured the project to make the codebase more modular +- Performed repository clean up and removal of static files +- Reworked the dependency management with the use of Poetry +- Deprecated COPR build updates for Mageia, EPEL and OpenSUSE +- Reimplimented CLI compositing to make use of commands over options +- Removed dedicated installation of x86 NVIDIA libraries due to inclusion +- Fixed RPM Fusion Non-free repo detection by force installation +- Updated official CUDA repositories to point to Fedora 34 or later + * Thu Aug 12 2021 Akashdeep Dhar - 0.3.9-1 - v0.3.9 - Reworked RPM specfile with pyproject directives diff --git a/nvautoinstall/__init__.py b/nvautoinstall/__init__.py new file mode 100644 index 0000000..215e8f1 --- /dev/null +++ b/nvautoinstall/__init__.py @@ -0,0 +1,33 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +from .interfaces.check_superuser_permissions import CheckSuperuserPermissions +from .interfaces.handle_compatibility_check import HandleCompatibilityCheck +from .interfaces.handle_drivers_installation import HandleDriverInstallation +from .interfaces.handle_prime_support import HandlePrimeSupport +from .interfaces.handle_rpmfusion_repositories import \ + HandleRPMFusionRepositories +from .interfaces.install_cuda_support import InstallCudaSupport +from .interfaces.install_everything import InstallEverything +from .interfaces.install_ffmpeg_support import InstallFfmpegSupport +from .interfaces.install_nvidia_repositories import InstallNvidiaRepositories +from .interfaces.install_video_acceleration import InstallVideoAcceleration +from .interfaces.install_vulkan_support import InstallVulkanSupport + +__version__ = "0.4.0" diff --git a/nvautoinstall/decoration/__init__.py b/nvautoinstall/decoration/__init__.py new file mode 100644 index 0000000..00f9476 --- /dev/null +++ b/nvautoinstall/decoration/__init__.py @@ -0,0 +1,20 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +from .status import failure, general, section, success, warning diff --git a/nvautoinstall/decoration/status.py b/nvautoinstall/decoration/status.py new file mode 100644 index 0000000..c1799c2 --- /dev/null +++ b/nvautoinstall/decoration/status.py @@ -0,0 +1,46 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +from click import echo, style + +PASS = style("[ \u2713 ]", fg="green", bold=True) +FAIL = style("[ \u2717 ]", fg="red", bold=True) +WARN = style("[ ! ]", fg="yellow", bold=True) +HEAD = style("[ \u2605 ]", fg="magenta", bold=True) +STDS = " " + + +def success(message): + echo(PASS + " " + message) + + +def failure(message): + echo(FAIL + " " + message) + + +def warning(message): + echo(WARN + " " + message) + + +def section(message): + echo(HEAD + " " + style(message, fg="magenta", bold=True)) + + +def general(message): + echo(STDS + " " + message) diff --git a/nvautoinstall/interfaces/__init__.py b/nvautoinstall/interfaces/__init__.py new file mode 100644 index 0000000..57cf5a6 --- /dev/null +++ b/nvautoinstall/interfaces/__init__.py @@ -0,0 +1,35 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +from ..decoration import failure, general, section, success, warning +from ..operations import (CheckSuperuserPermissions, HandleCompatibilityCheck, + HandleCudaInstallation, HandleDriversInstallation, + HandlePrimeSupport, HandleRPMFusionRepositories, + InstallFfmpegSupport, InstallVideoAcceleration, + InstallVulkanSupport) + +Objc_CheckSuperuserPermissions = CheckSuperuserPermissions() +Objc_HandlePrimeSupport = HandlePrimeSupport() +Objc_HandleCompatibilityCheck = HandleCompatibilityCheck() +Objc_HandleCudaInstallation = HandleCudaInstallation() +Objc_HandleRPMFusionRepositories = HandleRPMFusionRepositories() +Objc_InstallFfmpegSupport = InstallFfmpegSupport() +Objc_HandleDriversInstallation = HandleDriversInstallation() +Objc_InstallVideoAcceleration = InstallVideoAcceleration() +Objc_InstallVulkanSupport = InstallVulkanSupport() diff --git a/nvautoinstall/interfaces/check_superuser_permissions.py b/nvautoinstall/interfaces/check_superuser_permissions.py new file mode 100644 index 0000000..2613755 --- /dev/null +++ b/nvautoinstall/interfaces/check_superuser_permissions.py @@ -0,0 +1,36 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from . import (Objc_CheckSuperuserPermissions, failure, general, section, + success) + + +class CheckSuperuserPermissions: + def __init__(self): + section("CHECKING SUPERUSER PERMISSIONS...") + if Objc_CheckSuperuserPermissions.main(): + success("Superuser permission is available") + general("This tool is expected to work correctly here") + else: + failure("Superuser permission is not available") + general("This tool cannot be used here") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/interfaces/handle_compatibility_check.py b/nvautoinstall/interfaces/handle_compatibility_check.py new file mode 100644 index 0000000..4a1c0c2 --- /dev/null +++ b/nvautoinstall/interfaces/handle_compatibility_check.py @@ -0,0 +1,62 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from . import (Objc_HandleCompatibilityCheck, failure, general, section, + success, warning) + + +class HandleCompatibilityCheck: + def __init__(self): + section("CHECKING FOR GPU COMPATIBILITY...") + data = Objc_HandleCompatibilityCheck.gpuc() + warning("Compatibility infomation was obtained") + if data is False: + failure("No supported NVIDIA GPU was detected") + else: + success("One or more active NVIDIA GPUs were detected") + supprt = data["supprt"] + gpulst = data["gpulst"] + for indx in gpulst: + if indx != "": + general(indx) + if supprt == "single": + success("An single dedicated GPU setup was detected") + else: + success("An Optimus Dual GPU setup was detected") + section("GATHERING CURRENT HOST INFORMATION...") + data = Objc_HandleCompatibilityCheck.main() + warning("Host information was gathered") + for indx in data.keys(): + general(indx + ": " + data[indx]) + section("CHECKING FOR HOST COMPATIBILITY...") + data = Objc_HandleCompatibilityCheck.avbl() + if data is False: + failure("Unsupported OS detected") + general("This tool cannot be used here") + else: + if data == "full": + success("Supported OS detected") + general("This tool is expected to work correctly here") + elif data == "half": + warning("Minimally supported OS detected") + general("Discretion is advised while using this tool") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/interfaces/handle_drivers_installation.py b/nvautoinstall/interfaces/handle_drivers_installation.py new file mode 100644 index 0000000..4fd43fe --- /dev/null +++ b/nvautoinstall/interfaces/handle_drivers_installation.py @@ -0,0 +1,68 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from . import (Objc_CheckSuperuserPermissions, Objc_HandleDriversInstallation, + Objc_HandleRPMFusionRepositories, failure, general, section, + success, warning) + + +class HandleDriverInstallation: + def __init__(self): + section("CHECKING SUPERUSER PERMISSIONS...") + if Objc_CheckSuperuserPermissions.main(): + success("Superuser privilege acquired") + section("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") + if Objc_HandleRPMFusionRepositories.avbl(): + warning( + "RPM Fusion repository for Proprietary NVIDIA Driver was detected" + ) + section("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") + if Objc_HandleRPMFusionRepositories.conn(): + success("Connection to RPM Fusion servers was established") + section("LOOKING FOR EXISTING DRIVER PACKAGES...") + data = Objc_HandleDriversInstallation.avbl() + if data is False: + warning("No existing NVIDIA driver packages were detected") + section("INSTALLING PROPRIETARY DRIVERS...") + else: + qant = 0 + for indx in data: + if indx != "": + qant += 1 + general(indx) + warning( + "A total of " + str(qant) + " driver packages were detected" + ) + section("REINSTALLING PROPRIETARY DRIVERS...") + if Objc_HandleDriversInstallation.main(): + success("Driver package installation completed") + else: + failure("Proprietary drivers could not be installed") + else: + failure("Connection to RPM Fusion servers could not be established") + else: + failure( + "RPM Fusion repository for Proprietary NVIDIA Driver was not detected" + ) + else: + failure("Superuser privilege could not be acquired") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/interfaces/handle_prime_support.py b/nvautoinstall/interfaces/handle_prime_support.py new file mode 100644 index 0000000..697431c --- /dev/null +++ b/nvautoinstall/interfaces/handle_prime_support.py @@ -0,0 +1,93 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from click import style + +from . import (Objc_CheckSuperuserPermissions, Objc_HandleDriversInstallation, + Objc_HandlePrimeSupport, Objc_HandleRPMFusionRepositories, + failure, general, section, success, warning) + + +class HandlePrimeSupport: + def __init__(self): + section("CHECKING SUPERUSER PERMISSIONS...") + if Objc_CheckSuperuserPermissions.main(): + success("Superuser privilege acquired") + section("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") + if Objc_HandleRPMFusionRepositories.avbl(): + warning( + "RPM Fusion repository for Proprietary NVIDIA Driver was detected" + ) + section("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") + if Objc_HandleRPMFusionRepositories.conn(): + success("Connection to RPM Fusion servers was established") + section("LOOKING FOR EXISTING DRIVER PACKAGES...") + data = Objc_HandleDriversInstallation.avbl() + if data is False: + failure("No existing NVIDIA driver packages were detected") + else: + qant = 0 + for indx in data: + if indx != "": + qant += 1 + general(indx) + warning( + "A total of " + str(qant) + " driver packages were detected" + ) + section("SETTING UP PRIME SUPPORT...") + warning("Intervention required") + general( + style("< Y >", fg="green", bold=True) + + " to enable PRIME support" + ) + general( + style("< N >", fg="red", bold=True) + + " to disable PRIME support" + ) + general( + style("< * >", fg="yellow", bold=True) + + " anything else to leave" + ) + solution = input("[Y/N] ") + if solution == "Y" or solution == "y": + section("ENABLING PRIME SUPPORT...") + if Objc_HandlePrimeSupport.main(True): + success("PRIME Support was successfully enabled") + else: + failure("PRIME Support could not be enabled") + elif solution == "N" or solution == "n": + section("DISABLING PRIME SUPPORT...") + if Objc_HandlePrimeSupport.main(False): + success("PRIME Support was successfully disabled") + else: + failure("PRIME Support could not be disabled") + else: + section("SAFE AND GOOD ANSWER...") + else: + failure("Connection to RPM Fusion servers could not be established") + else: + failure( + "RPM Fusion repository for Proprietary NVIDIA Driver was not detected" + ) + else: + failure("Superuser privilege could not be acquired") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/interfaces/handle_rpmfusion_repositories.py b/nvautoinstall/interfaces/handle_rpmfusion_repositories.py new file mode 100644 index 0000000..1c2a282 --- /dev/null +++ b/nvautoinstall/interfaces/handle_rpmfusion_repositories.py @@ -0,0 +1,56 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from . import (Objc_CheckSuperuserPermissions, + Objc_HandleRPMFusionRepositories, failure, section, success, + warning) + + +class HandleRPMFusionRepositories: + def __init__(self): + section("CHECKING SUPERUSER PERMISSIONS...") + if Objc_CheckSuperuserPermissions.main(): + success("Superuser privilege acquired") + section("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") + if Objc_HandleRPMFusionRepositories.avbl(): + warning( + "RPM Fusion repository for Proprietary NVIDIA Driver was detected" + ) + success("No further action is necessary") + else: + warning( + "RPM Fusion repository for Proprietary NVIDIA Driver was not detected" + ) + warning("Repository enabling is required") + section("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") + if Objc_HandleRPMFusionRepositories.conn(): + success("Connection to RPM Fusion servers was established") + section("INSTALLING RPM FUSION NVIDIA REPOSITORY...") + if Objc_HandleRPMFusionRepositories.main(): + success("RPM Fusion NVIDIA repository was enabled") + else: + failure("RPM Fusion NVIDIA repository could not be enabled") + else: + failure("Connection to RPM Fusion servers could not be established") + else: + failure("Superuser privilege could not be acquired") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/interfaces/install_cuda_support.py b/nvautoinstall/interfaces/install_cuda_support.py new file mode 100644 index 0000000..d727625 --- /dev/null +++ b/nvautoinstall/interfaces/install_cuda_support.py @@ -0,0 +1,93 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from . import (Objc_CheckSuperuserPermissions, Objc_HandleCudaInstallation, + Objc_HandleDriversInstallation, + Objc_HandleRPMFusionRepositories, failure, general, section, + success, warning) + + +class InstallCudaSupport: + def __init__(self): + section("CHECKING SUPERUSER PERMISSIONS...") + if Objc_CheckSuperuserPermissions.main(): + success("Superuser privilege acquired") + section("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") + if Objc_HandleRPMFusionRepositories.avbl(): + warning( + "RPM Fusion repository for Proprietary NVIDIA Driver was detected" + ) + section("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") + if Objc_HandleRPMFusionRepositories.conn(): + success("Connection to RPM Fusion servers was established") + section("LOOKING FOR EXISTING DRIVER PACKAGES...") + data = Objc_HandleDriversInstallation.avbl() + if data is False: + failure("No existing NVIDIA driver packages were detected") + else: + qant = 0 + for indx in data: + if indx != "": + qant += 1 + general(indx) + warning( + "A total of " + str(qant) + " driver packages were detected" + ) + section("CHECKING AVAILABILITY OF OFFICIAL CUDA REPOSITORY...") + if Objc_HandleCudaInstallation.rpck(): + warning("Official CUDA repository was detected") + section("ATTEMPTING CONNECTION TO NVIDIA SERVERS...") + if Objc_HandleCudaInstallation.conn(): + success("Connection to NVIDIA servers was established") + section("INSTALLING RPM FUSION METAPACKAGE FOR CUDA...") + if Objc_HandleCudaInstallation.meta(): + success( + "RPM Fusion CUDA metapackage was successfully installed" + ) + section("INSTALLING NVIDIA CUDA CORE PACKAGES...") + if Objc_HandleCudaInstallation.main(): + success( + "NVIDIA CUDA core packages were successfully installed" + ) + else: + failure( + "NVIDIA CUDA core packages could not be installed" + ) + else: + failure( + "RPM Fusion CUDA metapackage packages could not be installed" + ) + else: + failure( + "Connection to NVIDIA servers could not be established" + ) + else: + failure("Official CUDA repository was not detected") + else: + failure("Connection to RPM Fusion servers could not be established") + else: + failure( + "RPM Fusion repository for Proprietary NVIDIA Driver was not detected" + ) + else: + failure("Superuser privilege could not be acquired") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/interfaces/install_everything.py b/nvautoinstall/interfaces/install_everything.py new file mode 100644 index 0000000..cf8fd57 --- /dev/null +++ b/nvautoinstall/interfaces/install_everything.py @@ -0,0 +1,36 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from . import (Objc_CheckSuperuserPermissions, failure, general, section, + success) + + +class InstallEverything: + def __init__(self): + section("CHECKING SUPERUSER PERMISSIONS...") + if Objc_CheckSuperuserPermissions.main(): + success("Superuser privilege acquired") + section("FULL FLEDGED INSTALLATION BEGINNING...") + general("This mode is yet to be implemented") + else: + failure("Superuser privilege could not be acquired") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/interfaces/install_ffmpeg_support.py b/nvautoinstall/interfaces/install_ffmpeg_support.py new file mode 100644 index 0000000..6049350 --- /dev/null +++ b/nvautoinstall/interfaces/install_ffmpeg_support.py @@ -0,0 +1,71 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from . import (Objc_CheckSuperuserPermissions, Objc_HandleDriversInstallation, + Objc_HandleRPMFusionRepositories, Objc_InstallFfmpegSupport, + failure, general, section, success, warning) + + +class InstallFfmpegSupport: + def __init__(self): + section("CHECKING SUPERUSER PERMISSIONS...") + if Objc_CheckSuperuserPermissions.main(): + success("Superuser privilege acquired") + section("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") + if Objc_HandleRPMFusionRepositories.avbl(): + warning( + "RPM Fusion repository for Proprietary NVIDIA Driver was detected" + ) + section("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") + if Objc_HandleRPMFusionRepositories.conn(): + success("Connection to RPM Fusion servers was established") + section("LOOKING FOR EXISTING DRIVER PACKAGES...") + data = Objc_HandleDriversInstallation.avbl() + if data is False: + failure("No existing NVIDIA driver packages were detected") + else: + qant = 0 + for indx in data: + if indx != "": + qant += 1 + general(indx) + warning( + "A total of " + str(qant) + " driver packages were detected" + ) + section("INSTALLING NVENC/NVDEC FOR FFMPEG ACCELERATION...") + if Objc_InstallFfmpegSupport.main(): + success( + "NVENC/NVDEC for FFMPEG acceleration were successfully installed" + ) + else: + failure( + "NVENC/NVDEC for FFMPEG acceleration could not be installed" + ) + else: + failure("Connection to RPM Fusion servers could not be established") + else: + failure( + "RPM Fusion repository for Proprietary NVIDIA Driver was not detected" + ) + else: + failure("Superuser privilege could not be acquired") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/interfaces/install_nvidia_repositories.py b/nvautoinstall/interfaces/install_nvidia_repositories.py new file mode 100644 index 0000000..05e92d1 --- /dev/null +++ b/nvautoinstall/interfaces/install_nvidia_repositories.py @@ -0,0 +1,61 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from . import (Objc_CheckSuperuserPermissions, Objc_HandleCudaInstallation, + failure, section, success, warning) + + +class InstallNvidiaRepositories: + def __init__(self): + section("CHECKING SUPERUSER PERMISSIONS...") + if Objc_CheckSuperuserPermissions.main(): + success("Superuser privilege acquired") + section("CHECKING AVAILABILITY OF OFFICIAL CUDA REPOSITORY...") + if Objc_HandleCudaInstallation.rpck(): + warning("Official CUDA repository was detected") + success("No further action is necessary") + else: + warning("Official CUDA repository was not detected") + warning("Repository enabling is required") + section("ATTEMPTING CONNECTION TO NVIDIA SERVERS...") + if Objc_HandleCudaInstallation.conn(): + success("Connection to NVIDIA servers was established") + section("INSTALLING OFFICIAL CUDA REPOSITORY...") + if Objc_HandleCudaInstallation.rpin(): + success("Official CUDA repository was enabled") + section("REFRESHING REPOSITORY LIST...") + if Objc_HandleCudaInstallation.rpup(): + success("Repositories have been refreshed") + section("DISABLING NVIDIA DRIVER MODULE...") + if Objc_HandleCudaInstallation.stop(): + success("NVIDIA DRIVER module has been disabled") + else: + failure("NVIDIA DRIVER module could not be disabled") + else: + failure("Repositories could not be refreshed") + else: + failure("Official CUDA repository could not be enabled") + else: + failure("Connection to NVIDIA servers could not be established") + else: + failure("Superuser privilege could not be acquired") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/interfaces/install_video_acceleration.py b/nvautoinstall/interfaces/install_video_acceleration.py new file mode 100644 index 0000000..94c6420 --- /dev/null +++ b/nvautoinstall/interfaces/install_video_acceleration.py @@ -0,0 +1,67 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from . import (Objc_CheckSuperuserPermissions, Objc_HandleDriversInstallation, + Objc_HandleRPMFusionRepositories, Objc_InstallVideoAcceleration, + failure, general, section, success, warning) + + +class InstallVideoAcceleration: + def __init__(self): + section("CHECKING SUPERUSER PERMISSIONS...") + if Objc_CheckSuperuserPermissions.main(): + success("Superuser privilege acquired") + section("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") + if Objc_HandleRPMFusionRepositories.avbl(): + warning( + "RPM Fusion repository for Proprietary NVIDIA Driver was detected" + ) + section("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") + if Objc_HandleRPMFusionRepositories.conn(): + success("Connection to RPM Fusion servers was established") + section("LOOKING FOR EXISTING DRIVER PACKAGES...") + data = Objc_HandleDriversInstallation.avbl() + if data is False: + failure("No existing NVIDIA driver packages were detected") + else: + qant = 0 + for indx in data: + if indx != "": + qant += 1 + general(indx) + warning( + "A total of " + str(qant) + " driver packages were detected" + ) + section("INSTALLING VIDEO ACCELERATION SUPPORT...") + if Objc_InstallVideoAcceleration.main(): + success("Video acceleration were successfully installed") + else: + failure("Video acceleration could not be installed") + else: + failure("Connection to RPM Fusion servers could not be established") + else: + failure( + "RPM Fusion repository for Proprietary NVIDIA Driver was not detected" + ) + else: + failure("Superuser privilege could not be acquired") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/interfaces/install_vulkan_support.py b/nvautoinstall/interfaces/install_vulkan_support.py new file mode 100644 index 0000000..12a7696 --- /dev/null +++ b/nvautoinstall/interfaces/install_vulkan_support.py @@ -0,0 +1,69 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import sys + +from . import (Objc_CheckSuperuserPermissions, Objc_HandleDriversInstallation, + Objc_HandleRPMFusionRepositories, Objc_InstallVulkanSupport, + failure, general, section, success, warning) + + +class InstallVulkanSupport: + def __init__(self): + section("CHECKING SUPERUSER PERMISSIONS...") + if Objc_CheckSuperuserPermissions.main(): + success("Superuser privilege acquired") + section("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") + if Objc_HandleRPMFusionRepositories.avbl(): + warning( + "RPM Fusion repository for Proprietary NVIDIA Driver was detected" + ) + section("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") + if Objc_HandleRPMFusionRepositories.conn(): + success("Connection to RPM Fusion servers was established") + section("LOOKING FOR EXISTING DRIVER PACKAGES...") + data = Objc_HandleDriversInstallation.avbl() + if data is False: + failure("No existing NVIDIA driver packages were detected") + else: + qant = 0 + for indx in data: + if indx != "": + qant += 1 + general(indx) + warning( + "A total of " + str(qant) + " driver packages were detected" + ) + section("INSTALLING VULKAN RENDERER SUPPORT...") + if Objc_InstallVulkanSupport.main(): + success( + "Vulkan renderer support were successfully installed" + ) + else: + failure("Vulkan renderer support could not be installed") + else: + failure("Connection to RPM Fusion servers could not be established") + else: + failure( + "RPM Fusion repository for Proprietary NVIDIA Driver was not detected" + ) + else: + failure("Superuser privilege could not be acquired") + failure("Leaving installer") + sys.exit(0) diff --git a/nvautoinstall/main.py b/nvautoinstall/main.py new file mode 100644 index 0000000..c652f75 --- /dev/null +++ b/nvautoinstall/main.py @@ -0,0 +1,103 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import click + +from . import (CheckSuperuserPermissions, HandleCompatibilityCheck, + HandleDriverInstallation, HandlePrimeSupport, + HandleRPMFusionRepositories, InstallCudaSupport, + InstallEverything, InstallFfmpegSupport, + InstallNvidiaRepositories, InstallVideoAcceleration, + InstallVulkanSupport, __version__) + + +@click.group(name="nvautoinstall") +@click.version_option( + version=__version__, + prog_name=click.style( + "NVAutoInstall by Akashdeep Dhar ", + fg="green", + bold=True, + ), +) +def main(): + click.echo( + click.style( + "[ # ] NVIDIA AUTOINSTALLER FOR FEDORA LINUX", fg="green", bold=True + ) + ) + + +@main.command(name="rpmadd", help="Enable the RPM Fusion NVIDIA drivers repository.") +def handle_rpmfusion_repositories(): + HandleRPMFusionRepositories() + + +@main.command(name="driver", help="Install the NVIDIA driver.") +def handle_driver_installation(): + HandleDriverInstallation() + + +@main.command(name="nvrepo", help="Enable the official NVIDIA repository for CUDA.") +def install_nvidia_repositories(): + InstallNvidiaRepositories() + + +@main.command(name="plcuda", help="Install only the CUDA support software.") +def install_cuda_support(): + InstallCudaSupport() + + +@main.command(name="ffmpeg", help="Install only the FFMPEG support software.") +def install_ffmpeg_support(): + InstallFfmpegSupport() + + +@main.command(name="vulkan", help="Install only the Vulkan support software.") +def install_vulkan_support(): + InstallVulkanSupport() + + +@main.command(name="vidacc", help="Install only the VDPAU/VAAPI acceleration.") +def install_video_acceleration(): + InstallVideoAcceleration() + + +@main.command(name="getall", help="Install all the above packages.") +def install_everything(): + InstallEverything() + + +@main.command(name="cheksu", help="Check the user privilege level.") +def check_superuser_permissions(): + CheckSuperuserPermissions() + + +@main.command(name="compat", help="Check your system compatibility.") +def handle_compatibility_check(): + HandleCompatibilityCheck() + + +@main.command(name="primec", help="Setup PRIME support.") +def handle_prime_support(): + HandlePrimeSupport() + + +if __name__ == "__main__": + main() diff --git a/nvautoinstall/operations/__init__.py b/nvautoinstall/operations/__init__.py new file mode 100644 index 0000000..fdd2fc9 --- /dev/null +++ b/nvautoinstall/operations/__init__.py @@ -0,0 +1,28 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +from .check_superuser_permissions import CheckSuperuserPermissions +from .handle_compatibility_check import HandleCompatibilityCheck +from .handle_cuda_installation import HandleCudaInstallation +from .handle_drivers_installation import HandleDriversInstallation +from .handle_prime_support import HandlePrimeSupport +from .handle_rpmfusion_repositories import HandleRPMFusionRepositories +from .install_ffmpeg_support import InstallFfmpegSupport +from .install_video_acceleration import InstallVideoAcceleration +from .install_vulkan_support import InstallVulkanSupport diff --git a/nvautoinstall/operations/check_superuser_permissions.py b/nvautoinstall/operations/check_superuser_permissions.py new file mode 100644 index 0000000..7847450 --- /dev/null +++ b/nvautoinstall/operations/check_superuser_permissions.py @@ -0,0 +1,26 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import os + + +class CheckSuperuserPermissions(object): + def main(self): + data = os.geteuid() + return data == 0 diff --git a/nvautoinstall/operations/handle_compatibility_check.py b/nvautoinstall/operations/handle_compatibility_check.py new file mode 100644 index 0000000..5bf3190 --- /dev/null +++ b/nvautoinstall/operations/handle_compatibility_check.py @@ -0,0 +1,70 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import os +import subprocess + +import distro + + +class HandleCompatibilityCheck(object): + def gpuc(self): + comand = "lspci | grep -E 'VGA|3D'" + prompt = subprocess.Popen( + comand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + output = prompt.communicate()[0].decode("utf-8") + linect = output.count("\n") + pkname = output.split("\n") + if "NVIDIA" not in output: + return False + else: + if linect == 1: + supprt = "single" + else: + supprt = "optims" + jsondt = { + "supprt": supprt, + "gpuqnt": linect, + "gpulst": pkname, + } + return jsondt + + def main(self): + jsondt = { + "System": str(os.uname().sysname) + " v" + str(os.uname().release), + "Hostname": str(os.uname().nodename), + "Version": str(os.uname().version), + "Distribution": str(distro.os_release_info()["name"]) + + " " + + str(os.uname().machine), + } + return jsondt + + def avbl(self): + try: + if distro.id() == "fedora": + if int(distro.os_release_info()["version_id"]) >= 32: + return "full" + else: + return "half" + else: + return False + except KeyError: + return False diff --git a/nvautoinstall/operations/handle_cuda_installation.py b/nvautoinstall/operations/handle_cuda_installation.py new file mode 100644 index 0000000..f38b2dc --- /dev/null +++ b/nvautoinstall/operations/handle_cuda_installation.py @@ -0,0 +1,59 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import os +import subprocess + + +class HandleCudaInstallation(object): + def rpck(self): + comand = "dnf repolist | grep 'cuda'" + prompt = subprocess.Popen( + comand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + output = prompt.communicate()[0].decode("utf-8") + return "cuda" in output + + def rpin(self): + retndata = subprocess.getstatusoutput( + "dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/fedora34/x86_64/cuda-fedora34.repo" + )[0] + return retndata == 0 + + def conn(self): + retndata = subprocess.getstatusoutput( + "curl https://developer.download.nvidia.com/compute/cuda/repos/" + )[0] + return retndata == 0 + + def rpup(self): + exec_status_code = os.system("dnf clean all") + return exec_status_code == 0 + + def meta(self): + exec_status_code = os.system("dnf install -y xorg-x11-drv-nvidia-cuda") + return exec_status_code == 0 + + def stop(self): + exec_status_code = os.system("dnf module disable -y nvidia-driver") + return exec_status_code == 0 + + def main(self): + exec_status_code = os.system("dnf install -y cuda") + return exec_status_code == 0 diff --git a/nvautoinstall/operations/handle_drivers_installation.py b/nvautoinstall/operations/handle_drivers_installation.py new file mode 100644 index 0000000..0e2ed91 --- /dev/null +++ b/nvautoinstall/operations/handle_drivers_installation.py @@ -0,0 +1,42 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import os +import subprocess + + +class HandleDriversInstallation(object): + def main(self): + exec_status_code = os.system( + "dnf install -y gcc kernel-headers kernel-devel akmod-nvidia xorg-x11-drv-nvidia xorg-x11-drv-nvidia-libs" + ) + return exec_status_code == 0 + + def avbl(self): + comand = "rpm -qa | grep 'nvidia'" + prompt = subprocess.Popen( + comand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + output = prompt.communicate()[0].decode("utf-8") + linect = output.count("\n") + if linect == 0: + return False + else: + pkname = output.split("\n") + return pkname diff --git a/nvautoinstall/operations/handle_prime_support.py b/nvautoinstall/operations/handle_prime_support.py new file mode 100644 index 0000000..e3cae22 --- /dev/null +++ b/nvautoinstall/operations/handle_prime_support.py @@ -0,0 +1,34 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +class HandlePrimeSupport(object): + def main(self, opts): + try: + with open("/usr/share/X11/xorg.conf.d/nvidia.conf", "r") as sharconf: + shardata = sharconf.read() + primemod = "" + for indx in shardata.split("\n"): + primemod += indx + "\n" + if opts is True and indx == '\tOption "BaseMosaic" "on"': + primemod += '\tOption "PrimaryGPU" "yes"' + "\n" + with open("/etc/X11/xorg.conf.d/nvidia.conf", "w") as etcdconf: + etcdconf.write(primemod) + return True + except Exception: + return False diff --git a/nvautoinstall/operations/handle_rpmfusion_repositories.py b/nvautoinstall/operations/handle_rpmfusion_repositories.py new file mode 100644 index 0000000..3b8d0cf --- /dev/null +++ b/nvautoinstall/operations/handle_rpmfusion_repositories.py @@ -0,0 +1,48 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import os +import subprocess + + +class HandleRPMFusionRepositories(object): + def avbl(self): + comand = "dnf repolist | grep 'rpmfusion-nonfree-updates'" + prompt = subprocess.Popen( + comand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + output = prompt.communicate()[0].decode("utf-8") + return "rpmfusion-nonfree-updates" in output + + def conn(self): + retndata = subprocess.getstatusoutput("curl https://rpmfusion.org")[0] + return retndata == 0 + + def main(self): + os.system("dnf install -y fedora-workstation-repositories") + os.system( + "dnf install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" + ) + os.system( + "dnf install -y https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm" + ) + retndata = subprocess.getstatusoutput( + "dnf config-manager --set-enable rpmfusion-free rpmfusion-free-updates rpmfusion-nonfree rpmfusion-nonfree-updates" + )[0] + return retndata == 0 diff --git a/nvautoinstall/operations/install_ffmpeg_support.py b/nvautoinstall/operations/install_ffmpeg_support.py new file mode 100644 index 0000000..bbd7356 --- /dev/null +++ b/nvautoinstall/operations/install_ffmpeg_support.py @@ -0,0 +1,26 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import os + + +class InstallFfmpegSupport(object): + def main(self): + exec_status_code = os.system("dnf install -y xorg-x11-drv-nvidia-cuda-libs") + return exec_status_code == 0 diff --git a/nvautoinstall/operations/install_video_acceleration.py b/nvautoinstall/operations/install_video_acceleration.py new file mode 100644 index 0000000..ebce8cd --- /dev/null +++ b/nvautoinstall/operations/install_video_acceleration.py @@ -0,0 +1,28 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import os + + +class InstallVideoAcceleration(object): + def main(self): + exec_status_code = os.system( + "dnf install -y vdpauinfo libva-vdpau-driver libva-utils" + ) + return exec_status_code == 0 diff --git a/nvautoinstall/operations/install_vulkan_support.py b/nvautoinstall/operations/install_vulkan_support.py new file mode 100644 index 0000000..32f3958 --- /dev/null +++ b/nvautoinstall/operations/install_vulkan_support.py @@ -0,0 +1,26 @@ +""" +NVIDIA Auto Installer for Fedora Linux +Copyright (C) 2019-2021 Akashdeep Dhar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + + +import os + + +class InstallVulkanSupport(object): + def main(self): + exec_status_code = os.system("dnf install -y vulkan") + return exec_status_code == 0 diff --git a/pics/cheksu.png b/pics/cheksu.png deleted file mode 100644 index c170757..0000000 Binary files a/pics/cheksu.png and /dev/null differ diff --git a/pics/compat.png b/pics/compat.png deleted file mode 100644 index 400027b..0000000 Binary files a/pics/compat.png and /dev/null differ diff --git a/pics/nvrepo.png b/pics/nvrepo.png deleted file mode 100644 index 6f6aba8..0000000 Binary files a/pics/nvrepo.png and /dev/null differ diff --git a/pics/rpmadd.png b/pics/rpmadd.png deleted file mode 100644 index f4ab7f6..0000000 Binary files a/pics/rpmadd.png and /dev/null differ diff --git a/pics/v0.1.0-screenshot.png b/pics/v0.1.0-screenshot.png deleted file mode 100644 index c335659..0000000 Binary files a/pics/v0.1.0-screenshot.png and /dev/null differ diff --git a/pics/v0.2.0-screenshot.png b/pics/v0.2.0-screenshot.png deleted file mode 100644 index 2bc26b3..0000000 Binary files a/pics/v0.2.0-screenshot.png and /dev/null differ diff --git a/pics/v0.2.5-screenshot.png b/pics/v0.2.5-screenshot.png deleted file mode 100644 index 1f397d5..0000000 Binary files a/pics/v0.2.5-screenshot.png and /dev/null differ diff --git a/pics/vidacc.png b/pics/vidacc.png deleted file mode 100644 index c131e49..0000000 Binary files a/pics/vidacc.png and /dev/null differ diff --git a/pics/vulkan.png b/pics/vulkan.png deleted file mode 100644 index d35bd4f..0000000 Binary files a/pics/vulkan.png and /dev/null differ diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..4f3176d --- /dev/null +++ b/poetry.lock @@ -0,0 +1,157 @@ +[[package]] +name = "black" +version = "21.12b0" +description = "The uncompromising code formatter." +category = "dev" +optional = false +python-versions = ">=3.6.2" + +[package.dependencies] +click = ">=7.1.2" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.9.0,<1" +platformdirs = ">=2" +tomli = ">=0.2.6,<2.0.0" +typing-extensions = [ + {version = ">=3.10.0.0", markers = "python_version < \"3.10\""}, + {version = "!=3.10.0.1", markers = "python_version >= \"3.10\""}, +] + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +python2 = ["typed-ast (>=1.4.3)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "click" +version = "8.0.3" +description = "Composable command line interface toolkit" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.4" +description = "Cross-platform colored terminal text." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "distro" +version = "1.6.0" +description = "Distro - an OS platform information API" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "isort" +version = "5.10.1" +description = "A Python utility / library to sort Python imports." +category = "dev" +optional = false +python-versions = ">=3.6.1,<4.0" + +[package.extras] +pipfile_deprecated_finder = ["pipreqs", "requirementslib"] +requirements_deprecated_finder = ["pipreqs", "pip-api"] +colors = ["colorama (>=0.4.3,<0.5.0)"] +plugins = ["setuptools"] + +[[package]] +name = "mypy-extensions" +version = "0.4.3" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "pathspec" +version = "0.9.0" +description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" + +[[package]] +name = "platformdirs" +version = "2.4.0" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.extras] +docs = ["Sphinx (>=4)", "furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)"] +test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"] + +[[package]] +name = "tomli" +version = "1.2.3" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "typing-extensions" +version = "4.0.1" +description = "Backported and Experimental Type Hints for Python 3.6+" +category = "dev" +optional = false +python-versions = ">=3.6" + +[metadata] +lock-version = "1.1" +python-versions = "^3.8" +content-hash = "4053b0bf9bfdea5bd35dbb1436ff7980ae7b2e95c07d90924adcf2cca64394d4" + +[metadata.files] +black = [ + {file = "black-21.12b0-py3-none-any.whl", hash = "sha256:a615e69ae185e08fdd73e4715e260e2479c861b5740057fde6e8b4e3b7dd589f"}, + {file = "black-21.12b0.tar.gz", hash = "sha256:77b80f693a569e2e527958459634f18df9b0ba2625ba4e0c2d5da5be42e6f2b3"}, +] +click = [ + {file = "click-8.0.3-py3-none-any.whl", hash = "sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3"}, + {file = "click-8.0.3.tar.gz", hash = "sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b"}, +] +colorama = [ + {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, + {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, +] +distro = [ + {file = "distro-1.6.0-py2.py3-none-any.whl", hash = "sha256:c8713330ab31a034623a9515663ed87696700b55f04556b97c39cd261aa70dc7"}, + {file = "distro-1.6.0.tar.gz", hash = "sha256:83f5e5a09f9c5f68f60173de572930effbcc0287bb84fdc4426cb4168c088424"}, +] +isort = [ + {file = "isort-5.10.1-py3-none-any.whl", hash = "sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7"}, + {file = "isort-5.10.1.tar.gz", hash = "sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951"}, +] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] +pathspec = [ + {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, + {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, +] +platformdirs = [ + {file = "platformdirs-2.4.0-py3-none-any.whl", hash = "sha256:8868bbe3c3c80d42f20156f22e7131d2fb321f5bc86a2a345375c6481a67021d"}, + {file = "platformdirs-2.4.0.tar.gz", hash = "sha256:367a5e80b3d04d2428ffa76d33f124cf11e8fff2acdaa9b43d545f5c7d661ef2"}, +] +tomli = [ + {file = "tomli-1.2.3-py3-none-any.whl", hash = "sha256:e3069e4be3ead9668e21cb9b074cd948f7b3113fd9c8bba083f48247aab8b11c"}, + {file = "tomli-1.2.3.tar.gz", hash = "sha256:05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f"}, +] +typing-extensions = [ + {file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"}, + {file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3c453b6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[tool.poetry] +name = "nvautoinstall" +version = "0.4.0" +description = "A CLI tool which lets you install proprietary NVIDIA drivers and much more easily on Fedora Linux (32 or above, ELN or Rawhide)" +authors = ["Akashdeep Dhar ", "Christopher Engelhard ", "Onuralp SEZER ", "Gustavo Costa "] +license = "GPL-3.0-or-later" +maintainers = ["Akashdeep Dhar "] +readme = "README.md" +homepage = "https://copr.fedorainfracloud.org/coprs/t0xic0der/nvidia-auto-installer-for-fedora" +repository = "https://github.com/t0xic0der/nvidia-auto-installer-for-fedora-linux" +documentation = "https://github.com/t0xic0der/nvidia-auto-installer-for-fedora-linux/blob/master/README.md" +keywords = ["fedora", "cuda", "nvidia", "optimus"] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Natural Language :: English", + "Programming Language :: Python :: 3.8", + "Operating System :: POSIX :: Linux", + "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Operating System", + "Topic :: Utilities", +] + +[tool.poetry.dependencies] +python = "^3.8" +click = ">=7.1.2" +distro = ">=1.5.0" + +[tool.poetry.dev-dependencies] +black = "^21.12b0" +isort = "^5.10.1" + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +nvautoinstall = "nvautoinstall.main:main" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9c5b233..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -click==7.1.2 -distro==1.5.0 diff --git a/setup.py b/setup.py deleted file mode 100644 index 18bf04f..0000000 --- a/setup.py +++ /dev/null @@ -1,79 +0,0 @@ -""" -########################################################################## -* -* Copyright © 2019-2021 Akashdeep Dhar -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -########################################################################## -""" - -import codecs -import os.path -import setuptools - - -def read(rel_path): - here = os.path.abspath(os.path.dirname(__file__)) - with codecs.open(os.path.join(here, rel_path), 'r') as fp: - return fp.read() - - -def get_version(rel_path): - for line in read(rel_path).splitlines(): - if line.startswith('__version__'): - delim = '"' if '"' in line else "'" - return line.split(delim)[1] - else: - raise RuntimeError("Unable to find version string.") - - -# setuptools configuration -setuptools.setup( - name='nvautoinstall', - description='A CLI tool which lets you install proprietary NVIDIA drivers and much more', - long_description='A CLI tool which lets you install proprietary NVIDIA drivers and much more', - url='https://github.com/t0xic0der/nvidia-auto-installer-for-fedora', - author='Akashdeep Dhar', - author_email='t0xic0der@fedoraproject.org', - maintainer='Akashdeep Dhar', - maintainer_email='t0xic0der@fedoraproject.org', - license='GPLv3', - # extract version from source - version=get_version("src/nvautoinstall/__init__.py"), - # tell distutils packages are under src directory - package_dir={ - '': 'src', - }, - packages=setuptools.find_packages('src'), - install_requires=[ - 'click', - 'distro', - ], - # automatically create console scripts - entry_points={ - 'console_scripts': ['nvautoinstall=nvautoinstall.MainFunction:clim'], - }, - classifiers=[ - 'Development Status :: 4 - Beta', - 'Environment :: Console', - 'Intended Audience :: End Users/Desktop', - 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Operating System :: POSIX :: Linux', - 'Topic :: System :: Hardware :: Hardware Drivers', - 'Topic :: Utilities', - ], -) diff --git a/src/nvautoinstall/MainFunction.py b/src/nvautoinstall/MainFunction.py deleted file mode 100644 index 172f866..0000000 --- a/src/nvautoinstall/MainFunction.py +++ /dev/null @@ -1,768 +0,0 @@ -""" -########################################################################## -* -* Copyright © 2019-2021 Akashdeep Dhar -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -########################################################################## -""" - -import os -import subprocess -import sys - -import click -import distro - -try: - # Imports version in the packaged environment - from nvautoinstall import __version__ -except ModuleNotFoundError: - # Imports version in the development environment - from __init__ import __version__ - - -class StatusDecorator(object): - def __init__(self): - self.PASS = click.style("[ \u2713 ]", fg="green", bold=True) - self.FAIL = click.style("[ \u2717 ]", fg="red", bold=True) - self.WARN = click.style("[ ! ]", fg="yellow", bold=True) - self.HEAD = click.style("[ \u2605 ]", fg="magenta", bold=True) - self.STDS = " " - - def success_message(self, request_message): - click.echo(self.PASS + " " + request_message) - - def failure_message(self, request_message): - click.echo(self.FAIL + " " + request_message) - - def warning_message(self, request_message): - click.echo(self.WARN + " " + request_message) - - def section_heading(self, request_message): - click.echo(self.HEAD + " " + click.style(request_message, fg="magenta", bold=True)) - - def general_message(self, request_message): - click.echo(self.STDS + " " + request_message) - - -DecoratorObject = StatusDecorator() - - -class CollSupportCheck(object): - def gpuc(self): - comand = "lspci | grep -E 'VGA|3D'" - prompt = subprocess.Popen(comand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - output = prompt.communicate()[0].decode("utf-8") - linect = output.count("\n") - pkname = output.split("\n") - if "NVIDIA" not in output: - return False - else: - if linect == 1: - supprt = "single" - else: - supprt = "optims" - jsondt = { - "supprt": supprt, - "gpuqnt": linect, - "gpulst": pkname, - } - return jsondt - - def main(self): - jsondt = { - "System": str(os.uname().sysname) + " v" + str(os.uname().release), - "Hostname": str(os.uname().nodename), - "Version": str(os.uname().version), - "Distribution": str(distro.os_release_info()["name"]) + " " + str(os.uname().machine), - } - return jsondt - - def avbl(self): - try: - if distro.id() == "fedora": - if int(distro.os_release_info()["version_id"]) >= 32: - return "full" - else: - return "half" - else: - return False - except KeyError: - return False - - -class CollRPMFHandler(object): - def avbl(self): - comand = "dnf repolist | grep 'rpmfusion-nonfree-nvidia-driver'" - prompt = subprocess.Popen(comand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - output = prompt.communicate()[0].decode("utf-8") - return "rpmfusion-nonfree-nvidia-driver" in output - - def conn(self): - retndata = subprocess.getstatusoutput("curl https://rpmfusion.org")[0] - return retndata == 0 - - def main(self): - os.system("dnf install -y fedora-workstation-repositories") - retndata = subprocess.getstatusoutput("dnf config-manager --set-enable rpmfusion-nonfree-nvidia-driver")[0] - return retndata == 0 - - -class CollDriverInstaller(object): - def main(self): - exec_status_code = os.system("dnf install -y gcc kernel-headers kernel-devel akmod-nvidia xorg-x11-drv-nvidia xorg-x11-drv-nvidia-libs") - return exec_status_code == 0 - - def avbl(self): - comand = "rpm -qa | grep 'nvidia'" - prompt = subprocess.Popen(comand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - output = prompt.communicate()[0].decode("utf-8") - linect = output.count("\n") - if linect == 0: - return False - else: - pkname = output.split("\n") - return pkname - - -class CollX86LibInstaller(object): - def main(self): - exec_status_code = os.system("dnf install -y xorg-x11-drv-nvidia-libs.i686") - return exec_status_code == 0 - - -class CollPlCudaInstaller(object): - def rpck(self): - comand = "dnf repolist | grep 'cuda'" - prompt = subprocess.Popen(comand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - output = prompt.communicate()[0].decode("utf-8") - return "cuda" in output - - def rpin(self): - retndata = subprocess.getstatusoutput("dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/fedora33/x86_64/cuda-fedora33.repo")[0] - return retndata == 0 - - def conn(self): - retndata = subprocess.getstatusoutput("curl https://developer.download.nvidia.com/compute/cuda/repos/")[0] - return retndata == 0 - - def rpup(self): - exec_status_code = os.system("dnf clean all") - return exec_status_code == 0 - - def meta(self): - exec_status_code = os.system("dnf install -y xorg-x11-drv-nvidia-cuda") - return exec_status_code == 0 - - def stop(self): - exec_status_code = os.system("dnf module disable -y nvidia-driver") - return exec_status_code == 0 - - def main(self): - exec_status_code = os.system("dnf install -y cuda") - return exec_status_code == 0 - - -class CollFFMPEGInstaller(object): - def main(self): - exec_status_code = os.system("dnf install -y xorg-x11-drv-nvidia-cuda-libs") - return exec_status_code == 0 - - -class CollVidAccInstaller(object): - def main(self): - exec_status_code = os.system("dnf install -y vdpauinfo libva-vdpau-driver libva-utils") - return exec_status_code == 0 - - -class CollVulkanInstaller(object): - def main(self): - exec_status_code = os.system("dnf install -y vulkan") - return exec_status_code == 0 - - -class CollSuperuserCheck(object): - def main(self): - data = os.geteuid() - return data == 0 - - -class CollPrimeSupportEnabler(object): - def main(self, opts): - try: - with open("/usr/share/X11/xorg.conf.d/nvidia.conf", "r") as sharconf: - shardata = sharconf.read() - primemod = "" - for indx in shardata.split("\n"): - primemod += indx + "\n" - if opts is True and indx == "\tOption \"BaseMosaic\" \"on\"": - primemod += "\tOption \"PrimaryGPU\" \"yes\"" + "\n" - with open("/etc/X11/xorg.conf.d/nvidia.conf", "w") as etcdconf: - etcdconf.write(primemod) - return True - except Exception: - return False - - -SupportCheck = CollSupportCheck() -RPMFHandler = CollRPMFHandler() -DriverInstaller = CollDriverInstaller() -x86LibInstaller = CollX86LibInstaller() -PlCudaInstaller = CollPlCudaInstaller() -FFMPEGInstaller = CollFFMPEGInstaller() -VidAccInstaller = CollVidAccInstaller() -VulkanInstaller = CollVulkanInstaller() -SuperuserCheck = CollSuperuserCheck() -PrimeSupportEnabler = CollPrimeSupportEnabler() - - -class InstallationMode(object): - def __init__(self): - self.menudict = { - "--rpmadd " : "This mode enables the RPM Fusion NVIDIA drivers repository.", - "--driver " : "This mode simply installs the NVIDIA driver.", - "--x86lib " : "This mode installs only the x86 libraries for Xorg.", - "--nvrepo " : "This mode enables the Official NVIDIA repository for CUDA.", - "--plcuda " : "This mode installs only the CUDA support softwares.", - "--ffmpeg " : "This mode installs only the FFMPEG acceleration.", - "--vulkan " : "This mode installs only the Vulkan renderer.", - "--vidacc " : "This mode installs only the VDPAU/VAAPI acceleration.", - "--getall " : "This mode installs all the above packages.", - "--cheksu " : "This mode allows you to check the user privilege level.", - "--compat " : "This mode allows you to check your compatibility.", - "--primec " : "This mode allows you to setup PRIME configuration.", - "--version" : "Show the version and exit.", - "--help " : "Show this message and exit.", - } - - def rpmadd(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser privilege acquired") - DecoratorObject.section_heading("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") - if RPMFHandler.avbl(): - DecoratorObject.warning_message("RPM Fusion repository for Proprietary NVIDIA Driver was detected") - DecoratorObject.success_message("No further action is necessary") - else: - DecoratorObject.warning_message("RPM Fusion repository for Proprietary NVIDIA Driver was not detected") - DecoratorObject.warning_message("Repository enabling is required") - DecoratorObject.section_heading("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") - if RPMFHandler.conn(): - DecoratorObject.success_message("Connection to RPM Fusion servers was established") - DecoratorObject.section_heading("INSTALLING RPM FUSION NVIDIA REPOSITORY...") - if RPMFHandler.main(): - DecoratorObject.success_message("RPM Fusion NVIDIA repository was enabled") - else: - DecoratorObject.failure_message("RPM Fusion NVIDIA repository could not be enabled") - else: - DecoratorObject.failure_message("Connection to RPM Fusion servers could not be established") - else: - DecoratorObject.failure_message("Superuser privilege could not be acquired") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def driver(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser privilege acquired") - DecoratorObject.section_heading("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") - if RPMFHandler.avbl(): - DecoratorObject.warning_message("RPM Fusion repository for Proprietary NVIDIA Driver was detected") - DecoratorObject.section_heading("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") - if RPMFHandler.conn(): - DecoratorObject.success_message("Connection to RPM Fusion servers was established") - DecoratorObject.section_heading("LOOKING FOR EXISTING DRIVER PACKAGES...") - data = DriverInstaller.avbl() - if data is False: - DecoratorObject.warning_message("No existing NVIDIA driver packages were detected") - DecoratorObject.section_heading("INSTALLING PROPRIETARY DRIVERS...") - else: - qant = 0 - for indx in data: - if indx != "": - qant += 1 - DecoratorObject.general_message(indx) - DecoratorObject.warning_message("A total of " + str(qant) + " driver packages were detected") - DecoratorObject.section_heading("REINSTALLING PROPRIETARY DRIVERS...") - if DriverInstaller.main(): - DecoratorObject.success_message("Driver package installation completed") - else: - DecoratorObject.failure_message("Proprietary drivers could not be installed") - else: - DecoratorObject.failure_message("Connection to RPM Fusion servers could not be established") - else: - DecoratorObject.failure_message("RPM Fusion repository for Proprietary NVIDIA Driver was not detected") - else: - DecoratorObject.failure_message("Superuser privilege could not be acquired") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def x86lib(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser privilege acquired") - DecoratorObject.section_heading("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") - if RPMFHandler.avbl(): - DecoratorObject.warning_message("RPM Fusion repository for Proprietary NVIDIA Driver was detected") - DecoratorObject.section_heading("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") - if RPMFHandler.conn(): - DecoratorObject.success_message("Connection to RPM Fusion servers was established") - DecoratorObject.section_heading("LOOKING FOR EXISTING DRIVER PACKAGES...") - data = DriverInstaller.avbl() - if data is False: - DecoratorObject.failure_message("No existing NVIDIA driver packages were detected") - else: - qant = 0 - for indx in data: - if indx != "": - qant += 1 - DecoratorObject.general_message(indx) - DecoratorObject.warning_message("A total of " + str(qant) + " driver packages were detected") - DecoratorObject.section_heading("INSTALLING x86 LIBRARIES FOR XORG...") - if x86LibInstaller.main(): - DecoratorObject.success_message("x86 libraries for XORG were successfully installed") - else: - DecoratorObject.failure_message("x86 libraries for XORG could not be installed") - else: - DecoratorObject.failure_message("Connection to RPM Fusion servers could not be established") - else: - DecoratorObject.failure_message("RPM Fusion repository for Proprietary NVIDIA Driver was not detected") - else: - DecoratorObject.failure_message("Superuser privilege could not be acquired") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def nvrepo(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser privilege acquired") - DecoratorObject.section_heading("CHECKING AVAILABILITY OF OFFICIAL CUDA REPOSITORY...") - if PlCudaInstaller.rpck(): - DecoratorObject.warning_message("Official CUDA repository was detected") - DecoratorObject.success_message("No further action is necessary") - else: - DecoratorObject.warning_message("Official CUDA repository was not detected") - DecoratorObject.warning_message("Repository enabling is required") - DecoratorObject.section_heading("ATTEMPTING CONNECTION TO NVIDIA SERVERS...") - if PlCudaInstaller.conn(): - DecoratorObject.success_message("Connection to NVIDIA servers was established") - DecoratorObject.section_heading("INSTALLING OFFICIAL CUDA REPOSITORY...") - if PlCudaInstaller.rpin(): - DecoratorObject.success_message("Official CUDA repository was enabled") - DecoratorObject.section_heading("REFRESHING REPOSITORY LIST...") - if PlCudaInstaller.rpup(): - DecoratorObject.success_message("Repositories have been refreshed") - DecoratorObject.section_heading("DISABLING NVIDIA DRIVER MODULE...") - if PlCudaInstaller.stop(): - DecoratorObject.success_message("NVIDIA DRIVER module has been disabled") - else: - DecoratorObject.failure_message("NVIDIA DRIVER module could not be disabled") - else: - DecoratorObject.failure_message("Repositories could not be refreshed") - else: - DecoratorObject.failure_message("Official CUDA repository could not be enabled") - else: - DecoratorObject.failure_message("Connection to NVIDIA servers could not be established") - else: - DecoratorObject.failure_message("Superuser privilege could not be acquired") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def plcuda(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser privilege acquired") - DecoratorObject.section_heading("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") - if RPMFHandler.avbl(): - DecoratorObject.warning_message("RPM Fusion repository for Proprietary NVIDIA Driver was detected") - DecoratorObject.section_heading("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") - if RPMFHandler.conn(): - DecoratorObject.success_message("Connection to RPM Fusion servers was established") - DecoratorObject.section_heading("LOOKING FOR EXISTING DRIVER PACKAGES...") - data = DriverInstaller.avbl() - if data is False: - DecoratorObject.failure_message("No existing NVIDIA driver packages were detected") - else: - qant = 0 - for indx in data: - if indx != "": - qant += 1 - DecoratorObject.general_message(indx) - DecoratorObject.warning_message("A total of " + str(qant) + " driver packages were detected") - DecoratorObject.section_heading("CHECKING AVAILABILITY OF OFFICIAL CUDA REPOSITORY...") - if PlCudaInstaller.rpck(): - DecoratorObject.warning_message("Official CUDA repository was detected") - DecoratorObject.section_heading("ATTEMPTING CONNECTION TO NVIDIA SERVERS...") - if PlCudaInstaller.conn(): - DecoratorObject.success_message("Connection to NVIDIA servers was established") - DecoratorObject.section_heading("INSTALLING RPM FUSION METAPACKAGE FOR CUDA...") - if PlCudaInstaller.meta(): - DecoratorObject.success_message("RPM Fusion CUDA metapackage was successfully installed") - DecoratorObject.section_heading("INSTALLING NVIDIA CUDA CORE PACKAGES...") - if PlCudaInstaller.main(): - DecoratorObject.success_message("NVIDIA CUDA core packages were successfully installed") - else: - DecoratorObject.failure_message("NVIDIA CUDA core packages could not be installed") - else: - DecoratorObject.failure_message("RPM Fusion CUDA metapackage packages could not be installed") - else: - DecoratorObject.failure_message("Connection to NVIDIA servers could not be established") - else: - DecoratorObject.failure_message("Official CUDA repository was not detected") - else: - DecoratorObject.failure_message("Connection to RPM Fusion servers could not be established") - else: - DecoratorObject.failure_message("RPM Fusion repository for Proprietary NVIDIA Driver was not detected") - else: - DecoratorObject.failure_message("Superuser privilege could not be acquired") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def ffmpeg(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser privilege acquired") - DecoratorObject.section_heading("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") - if RPMFHandler.avbl(): - DecoratorObject.warning_message("RPM Fusion repository for Proprietary NVIDIA Driver was detected") - DecoratorObject.section_heading("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") - if RPMFHandler.conn(): - DecoratorObject.success_message("Connection to RPM Fusion servers was established") - DecoratorObject.section_heading("LOOKING FOR EXISTING DRIVER PACKAGES...") - data = DriverInstaller.avbl() - if data is False: - DecoratorObject.failure_message("No existing NVIDIA driver packages were detected") - else: - qant = 0 - for indx in data: - if indx != "": - qant += 1 - DecoratorObject.general_message(indx) - DecoratorObject.warning_message("A total of " + str(qant) + " driver packages were detected") - DecoratorObject.section_heading("INSTALLING NVENC/NVDEC FOR FFMPEG ACCELERATION...") - if FFMPEGInstaller.main(): - DecoratorObject.success_message("NVENC/NVDEC for FFMPEG acceleration were successfully installed") - else: - DecoratorObject.failure_message("NVENC/NVDEC for FFMPEG acceleration could not be installed") - else: - DecoratorObject.failure_message("Connection to RPM Fusion servers could not be established") - else: - DecoratorObject.failure_message("RPM Fusion repository for Proprietary NVIDIA Driver was not detected") - else: - DecoratorObject.failure_message("Superuser privilege could not be acquired") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def vulkan(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser privilege acquired") - DecoratorObject.section_heading("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") - if RPMFHandler.avbl(): - DecoratorObject.warning_message("RPM Fusion repository for Proprietary NVIDIA Driver was detected") - DecoratorObject.section_heading("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") - if RPMFHandler.conn(): - DecoratorObject.success_message("Connection to RPM Fusion servers was established") - DecoratorObject.section_heading("LOOKING FOR EXISTING DRIVER PACKAGES...") - data = DriverInstaller.avbl() - if data is False: - DecoratorObject.failure_message("No existing NVIDIA driver packages were detected") - else: - qant = 0 - for indx in data: - if indx != "": - qant += 1 - DecoratorObject.general_message(indx) - DecoratorObject.warning_message("A total of " + str(qant) + " driver packages were detected") - DecoratorObject.section_heading("INSTALLING VULKAN RENDERER SUPPORT...") - if VulkanInstaller.main(): - DecoratorObject.success_message("Vulkan renderer support were successfully installed") - else: - DecoratorObject.failure_message("Vulkan renderer support could not be installed") - else: - DecoratorObject.failure_message("Connection to RPM Fusion servers could not be established") - else: - DecoratorObject.failure_message("RPM Fusion repository for Proprietary NVIDIA Driver was not detected") - else: - DecoratorObject.failure_message("Superuser privilege could not be acquired") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def vidacc(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser privilege acquired") - DecoratorObject.section_heading("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") - if RPMFHandler.avbl(): - DecoratorObject.warning_message("RPM Fusion repository for Proprietary NVIDIA Driver was detected") - DecoratorObject.section_heading("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") - if RPMFHandler.conn(): - DecoratorObject.success_message("Connection to RPM Fusion servers was established") - DecoratorObject.section_heading("LOOKING FOR EXISTING DRIVER PACKAGES...") - data = DriverInstaller.avbl() - if data is False: - DecoratorObject.failure_message("No existing NVIDIA driver packages were detected") - else: - qant = 0 - for indx in data: - if indx != "": - qant += 1 - DecoratorObject.general_message(indx) - DecoratorObject.warning_message("A total of " + str(qant) + " driver packages were detected") - DecoratorObject.section_heading("INSTALLING VIDEO ACCELERATION SUPPORT...") - if VidAccInstaller.main(): - DecoratorObject.success_message("Video acceleration were successfully installed") - else: - DecoratorObject.failure_message("Video acceleration could not be installed") - else: - DecoratorObject.failure_message("Connection to RPM Fusion servers could not be established") - else: - DecoratorObject.failure_message("RPM Fusion repository for Proprietary NVIDIA Driver was not detected") - else: - DecoratorObject.failure_message("Superuser privilege could not be acquired") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def getall(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser privilege acquired") - DecoratorObject.section_heading("FULL FLEDGED INSTALLATION BEGINNING...") - DecoratorObject.general_message("This mode is yet to be implemented") - else: - DecoratorObject.failure_message("Superuser privilege could not be acquired") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def cheksu(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser permission is available") - DecoratorObject.general_message("This tool is expected to work correctly here") - else: - DecoratorObject.failure_message("Superuser permission is not available") - DecoratorObject.general_message("This tool cannot be used here") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def compat(self): - DecoratorObject.section_heading("CHECKING FOR GPU COMPATIBILITY...") - data = SupportCheck.gpuc() - DecoratorObject.warning_message("Compatibility infomation was obtained") - if data is False: - DecoratorObject.failure_message("No supported NVIDIA GPU was detected") - else: - DecoratorObject.success_message("One or more active NVIDIA GPUs were detected") - supprt = data["supprt"] - gpulst = data["gpulst"] - for indx in gpulst: - if indx != "": - DecoratorObject.general_message(indx) - if supprt == "single": - DecoratorObject.success_message("An single dedicated GPU setup was detected") - else: - DecoratorObject.success_message("An Optimus Dual GPU setup was detected") - DecoratorObject.section_heading("GATHERING CURRENT HOST INFORMATION...") - data = SupportCheck.main() - DecoratorObject.warning_message("Host information was gathered") - for indx in data.keys(): - DecoratorObject.general_message(indx + ": " + data[indx]) - DecoratorObject.section_heading("CHECKING FOR HOST COMPATIBILITY...") - data = SupportCheck.avbl() - if data is False: - DecoratorObject.failure_message("Unsupported OS detected") - DecoratorObject.general_message("This tool cannot be used here") - else: - if data == "full": - DecoratorObject.success_message("Supported OS detected") - DecoratorObject.general_message("This tool is expected to work correctly here") - elif data == "half": - DecoratorObject.warning_message("Minimally supported OS detected") - DecoratorObject.general_message("Discretion is advised while using this tool") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def primec(self): - DecoratorObject.section_heading("CHECKING SUPERUSER PERMISSIONS...") - if SuperuserCheck.main(): - DecoratorObject.success_message("Superuser privilege acquired") - DecoratorObject.section_heading("CHECKING AVAILABILITY OF RPM FUSION NVIDIA REPOSITORY...") - if RPMFHandler.avbl(): - DecoratorObject.warning_message("RPM Fusion repository for Proprietary NVIDIA Driver was detected") - DecoratorObject.section_heading("ATTEMPTING CONNECTION TO RPM FUSION SERVERS...") - if RPMFHandler.conn(): - DecoratorObject.success_message("Connection to RPM Fusion servers was established") - DecoratorObject.section_heading("LOOKING FOR EXISTING DRIVER PACKAGES...") - data = DriverInstaller.avbl() - if data is False: - DecoratorObject.failure_message("No existing NVIDIA driver packages were detected") - else: - qant = 0 - for indx in data: - if indx != "": - qant += 1 - DecoratorObject.general_message(indx) - DecoratorObject.warning_message("A total of " + str(qant) + " driver packages were detected") - DecoratorObject.section_heading("SETTING UP PRIME SUPPORT...") - DecoratorObject.warning_message("Intervention required") - DecoratorObject.general_message(click.style("< Y >", fg="green", bold=True) + " to enable PRIME support") - DecoratorObject.general_message(click.style("< N >", fg="red", bold=True) + " to disable PRIME support") - DecoratorObject.general_message(click.style("< * >", fg="yellow", bold=True) + " anything else to leave") - solution = input("[Y/N] ") - if solution == "Y" or solution == "y": - DecoratorObject.section_heading("ENABLING PRIME SUPPORT...") - if PrimeSupportEnabler.main(True): - DecoratorObject.success_message("PRIME Support was successfully enabled") - else: - DecoratorObject.failure_message("PRIME Support could not be enabled") - elif solution == "N" or solution == "n": - DecoratorObject.section_heading("DISABLING PRIME SUPPORT...") - if PrimeSupportEnabler.main(False): - DecoratorObject.success_message("PRIME Support was successfully disabled") - else: - DecoratorObject.failure_message("PRIME Support could not be disabled") - else: - DecoratorObject.section_heading("SAFE AND GOOD ANSWER...") - else: - DecoratorObject.failure_message("Connection to RPM Fusion servers could not be established") - else: - DecoratorObject.failure_message("RPM Fusion repository for Proprietary NVIDIA Driver was not detected") - else: - DecoratorObject.failure_message("Superuser privilege could not be acquired") - DecoratorObject.failure_message("Leaving installer") - sys.exit(0) - - def lsmenu(self): - DecoratorObject.section_heading("OPTIONS") - for indx in self.menudict.keys(): - DecoratorObject.general_message(click.style(indx, fg="green", bold=True) + " " + self.menudict[indx]) - sys.exit(0) - - -@click.command() -@click.option( - "--rpmadd", - "instmode", - flag_value="rpmadd", - help="This mode enables the RPM Fusion NVIDIA drivers repository." -) -@click.option( - "--driver", - "instmode", - flag_value="driver", - help="This mode simply installs the NVIDIA driver." -) -@click.option( - "--x86lib", - "instmode", - flag_value="x86lib", - help="This mode installs only the x86 libraries for Xorg." -) -@click.option( - "--nvrepo", - "instmode", - flag_value="nvrepo", - help="This mode enables the Official NVIDIA repository for CUDA." -) -@click.option( - "--plcuda", - "instmode", - flag_value="plcuda", - help="This mode installs only the CUDA support softwares." -) -@click.option( - "--ffmpeg", - "instmode", - flag_value="ffmpeg", - help="This mode installs only the FFMPEG acceleration." -) -@click.option( - "--vulkan", - "instmode", - flag_value="vulkan", - help="This mode installs only the Vulkan renderer." -) -@click.option( - "--vidacc", - "instmode", - flag_value="vidacc", - help="This mode installs only the VDPAU/VAAPI acceleration." -) -@click.option( - "--getall", - "instmode", - flag_value="getall", - help="This mode installs all the above packages." -) -@click.option( - "--cheksu", - "instmode", - flag_value="cheksu", - help="This mode allows you to check the user privilege level." -) -@click.option( - "--compat", - "instmode", - flag_value="compat", - help="This mode allows you to check your compatibility." -) -@click.option( - "--primec", - "instmode", - flag_value="primec", - help="This mode allows you to setup PRIME configuration." -) -@click.version_option( - version=__version__, - prog_name=click.style( - "NVAutoInstall by Akashdeep Dhar ", - fg="green", - bold=True - ) -) -def clim(instmode): - instobjc = InstallationMode() - click.echo(click.style("[ # ] NVIDIA AUTOINSTALLER FOR FEDORA", fg="green", bold=True)) - if instmode == "rpmadd": - instobjc.rpmadd() - elif instmode == "driver": - instobjc.driver() - elif instmode == "x86lib": - instobjc.x86lib() - elif instmode == "nvrepo": - instobjc.nvrepo() - elif instmode == "plcuda": - instobjc.plcuda() - elif instmode == "ffmpeg": - instobjc.ffmpeg() - elif instmode == "vulkan": - instobjc.vulkan() - elif instmode == "vidacc": - instobjc.vidacc() - elif instmode == "getall": - instobjc.getall() - elif instmode == "cheksu": - instobjc.cheksu() - elif instmode == "compat": - instobjc.compat() - elif instmode == "primec": - instobjc.primec() - else: - instobjc.lsmenu() - - -if __name__ == "__main__": - clim() diff --git a/src/nvautoinstall/__init__.py b/src/nvautoinstall/__init__.py deleted file mode 100644 index ead6c36..0000000 --- a/src/nvautoinstall/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -########################################################################## -* -* Copyright © 2019-2021 Akashdeep Dhar -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -########################################################################## -""" - -__version__ = "0.3.9"