Skip to content

Commit 878a40c

Browse files
committed
Refresh system integration and cleanup stale paths
1 parent 267e68c commit 878a40c

17 files changed

Lines changed: 1104 additions & 1142 deletions

i18n/ro-control_de.ts

Lines changed: 287 additions & 299 deletions
Large diffs are not rendered by default.

i18n/ro-control_en.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,6 @@
350350
<source>Light</source>
351351
<translation>Light</translation>
352352
</message>
353-
<message>
354-
<location filename="../src/qml/Main.qml" line="55"/>
355-
<source>Automatic</source>
356-
<translation>Automatic</translation>
357-
</message>
358353
<message>
359354
<location filename="../src/qml/Main.qml" line="60"/>
360355
<source>Unknown</source>

i18n/ro-control_es.ts

Lines changed: 287 additions & 299 deletions
Large diffs are not rendered by default.

i18n/ro-control_tr.ts

Lines changed: 287 additions & 299 deletions
Large diffs are not rendered by default.

src/backend/nvidia/installer.cpp

Lines changed: 25 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "installer.h"
22

3+
#include "detector.h"
34
#include "system/capabilityprobe.h"
45
#include "system/commandrunner.h"
56
#include "system/sessionutil.h"
@@ -69,6 +70,18 @@ bool commandCanceled(const CommandRunner::Result &result) {
6970
return result.exitCode == -3;
7071
}
7172

73+
QString missingNvidiaHardwareMessage() {
74+
NvidiaDetector detector;
75+
if (detector.hasNvidiaGpu() || detector.isDriverInstalled()) {
76+
return {};
77+
}
78+
79+
return NvidiaInstaller::tr(
80+
"No NVIDIA GPU or installed NVIDIA driver was detected. In a virtual "
81+
"machine, attach or passthrough an NVIDIA GPU before starting driver "
82+
"installation.");
83+
}
84+
7285
QStringList buildDriverInstallTargets(const QString &kernelPackageName,
7386
const QString &sessionType) {
7487
QStringList packages{kernelPackageName};
@@ -301,6 +314,12 @@ void NvidiaInstaller::install() { installProprietary(false); }
301314
void NvidiaInstaller::installProprietary(bool agreementAccepted) {
302315
refreshProprietaryAgreement();
303316

317+
const QString hardwareMessage = missingNvidiaHardwareMessage();
318+
if (!hardwareMessage.isEmpty()) {
319+
emit installFinished(false, hardwareMessage);
320+
return;
321+
}
322+
304323
if (m_proprietaryAgreementRequired && !agreementAccepted) {
305324
emit installFinished(
306325
false, tr("NVIDIA license review confirmation is required before "
@@ -445,6 +464,12 @@ void NvidiaInstaller::installProprietary(bool agreementAccepted) {
445464
}
446465

447466
void NvidiaInstaller::installOpenSource() {
467+
const QString hardwareMessage = missingNvidiaHardwareMessage();
468+
if (!hardwareMessage.isEmpty()) {
469+
emit installFinished(false, hardwareMessage);
470+
return;
471+
}
472+
448473
const QString architectureSupportMessage =
449474
CapabilityProbe::fedoraNvidiaDriverFlowSupportMessage();
450475
if (!architectureSupportMessage.isEmpty()) {
@@ -670,92 +695,3 @@ void NvidiaInstaller::deepClean() {
670695
Qt::QueuedConnection);
671696
});
672697
}
673-
674-
bool NvidiaInstaller::applySessionSpecificSetup(CommandRunner &runner,
675-
const SessionUtil::SessionInfo
676-
&sessionInfo,
677-
QString *errorMessage) {
678-
const QString sessionType = sessionInfo.type.trimmed().toLower();
679-
if (sessionType != QStringLiteral("wayland") &&
680-
sessionType != QStringLiteral("x11")) {
681-
if (errorMessage) {
682-
*errorMessage =
683-
tr("The active display session could not be detected reliably. "
684-
"ro-Control will not guess Wayland or X11 specific NVIDIA setup.");
685-
}
686-
return false;
687-
}
688-
689-
emit progressMessage(
690-
tr("Detected %1 session via %2.")
691-
.arg(sessionType == QStringLiteral("wayland") ? tr("Wayland")
692-
: tr("X11"),
693-
sessionInfo.source.isEmpty() ? tr("session probe")
694-
: sessionInfo.source));
695-
696-
emit progressMessage(
697-
tr("Adding NVIDIA kernel modules to the initramfs driver set..."));
698-
auto result = runner.runAsRoot(
699-
QStringLiteral("dracut"),
700-
QStringList{QStringLiteral("--force"), QStringLiteral("--add-drivers"),
701-
kNvidiaKernelModules.join(QLatin1Char(' '))});
702-
703-
if (!result.success()) {
704-
if (errorMessage) {
705-
*errorMessage = tr("Failed to prepare NVIDIA kernel modules: ") +
706-
commandError(result);
707-
}
708-
return false;
709-
}
710-
711-
if (sessionType == QStringLiteral("wayland")) {
712-
emit progressMessage(tr("Wayland detected: installing EGL Wayland support "
713-
"and enabling NVIDIA DRM modeset..."));
714-
715-
result = runner.runAsRoot(
716-
QStringLiteral("dnf"),
717-
{QStringLiteral("install"), QStringLiteral("-y"),
718-
QStringLiteral("egl-wayland")});
719-
720-
if (!result.success()) {
721-
if (errorMessage) {
722-
*errorMessage =
723-
tr("Failed to install Wayland NVIDIA support packages: ") +
724-
commandError(result);
725-
}
726-
return false;
727-
}
728-
729-
result = runner.runAsRoot(
730-
QStringLiteral("grubby"),
731-
{QStringLiteral("--update-kernel=ALL"),
732-
QStringLiteral("--args=nvidia-drm.modeset=1 nvidia-drm.fbdev=1")});
733-
734-
if (!result.success()) {
735-
if (errorMessage) {
736-
*errorMessage = tr("Failed to apply the Wayland kernel parameter: ") +
737-
result.stderr;
738-
}
739-
return false;
740-
}
741-
return true;
742-
}
743-
744-
emit progressMessage(tr("X11 detected: checking NVIDIA Xorg packages..."));
745-
746-
result = runner.runAsRoot(
747-
QStringLiteral("dnf"),
748-
{QStringLiteral("install"), QStringLiteral("-y"),
749-
QStringLiteral("xorg-x11-drv-nvidia")});
750-
751-
if (!result.success()) {
752-
if (errorMessage) {
753-
*errorMessage =
754-
tr("Failed to install the X11 NVIDIA package: ") +
755-
commandError(result);
756-
}
757-
return false;
758-
}
759-
760-
return true;
761-
}

src/backend/nvidia/installer.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
#include <memory>
88

99
class CommandRunner;
10-
namespace SessionUtil {
11-
struct SessionInfo;
12-
}
1310

1411
// NvidiaInstaller: DNF üzerinden NVIDIA sürücü kurulum/kaldırma işlemleri.
1512
// Tüm işlemler root gerektirir — polkit üzerinden yetki alınır.
@@ -69,9 +66,6 @@ class NvidiaInstaller : public QObject {
6966
void setBusy(bool busy);
7067
void runAsyncTask(const std::function<void()> &task);
7168
void setProprietaryAgreement(bool required, const QString &text);
72-
bool applySessionSpecificSetup(CommandRunner &runner,
73-
const SessionUtil::SessionInfo &sessionInfo,
74-
QString *errorMessage);
7569

7670
bool m_proprietaryAgreementRequired = false;
7771
QString m_proprietaryAgreementText;

src/backend/nvidia/updater.cpp

Lines changed: 18 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ bool commandCanceled(const CommandRunner::Result &result) {
5656
return result.exitCode == -3;
5757
}
5858

59+
QString missingNvidiaHardwareMessage() {
60+
NvidiaDetector detector;
61+
if (detector.hasNvidiaGpu() || detector.isDriverInstalled()) {
62+
return {};
63+
}
64+
65+
return NvidiaUpdater::tr(
66+
"No NVIDIA GPU or installed NVIDIA driver was detected. In a virtual "
67+
"machine, attach or passthrough an NVIDIA GPU before starting driver "
68+
"updates.");
69+
}
70+
5971
QString normalizedTransactionOutput(const CommandRunner::Result &result) {
6072
return (result.stdout + QLatin1Char('\n') + result.stderr).toLower();
6173
}
@@ -468,7 +480,6 @@ QStringList
468480
NvidiaUpdater::buildDriverTargets(const QString &version,
469481
const QString &sessionType,
470482
const QString &kernelPackageName) const {
471-
Q_UNUSED(sessionType);
472483
QStringList targets;
473484
QStringList versionLockedPackages{kernelPackageName};
474485
versionLockedPackages << kCommonVersionLockedDriverPackages;
@@ -513,98 +524,6 @@ QStringList NvidiaUpdater::buildTransactionArguments(
513524
return args;
514525
}
515526

516-
bool NvidiaUpdater::finalizeDriverChange(CommandRunner &runner,
517-
const SessionUtil::SessionInfo
518-
&sessionInfo,
519-
QString *errorMessage) {
520-
auto result =
521-
runner.runAsRoot(QStringLiteral("akmods"), {QStringLiteral("--force")});
522-
if (!result.success()) {
523-
if (errorMessage != nullptr) {
524-
*errorMessage = tr("Kernel module build failed: ") +
525-
commandError(result, tr("unknown error"));
526-
}
527-
return false;
528-
}
529-
530-
const QString sessionType = sessionInfo.type.trimmed().toLower();
531-
if (sessionType != QStringLiteral("wayland") &&
532-
sessionType != QStringLiteral("x11")) {
533-
if (errorMessage != nullptr) {
534-
*errorMessage =
535-
tr("The active display session could not be detected reliably. "
536-
"ro-Control will not guess Wayland or X11 specific NVIDIA setup.");
537-
}
538-
return false;
539-
}
540-
541-
emit progressMessage(
542-
tr("Detected %1 session via %2.")
543-
.arg(sessionType == QStringLiteral("wayland") ? tr("Wayland")
544-
: tr("X11"),
545-
sessionInfo.source.isEmpty() ? tr("session probe")
546-
: sessionInfo.source));
547-
548-
emit progressMessage(
549-
tr("Adding NVIDIA kernel modules to the initramfs driver set..."));
550-
result = runner.runAsRoot(
551-
QStringLiteral("dracut"),
552-
QStringList{QStringLiteral("--force"), QStringLiteral("--add-drivers"),
553-
kNvidiaKernelModules.join(QLatin1Char(' '))});
554-
if (!result.success()) {
555-
if (errorMessage != nullptr) {
556-
*errorMessage = tr("Failed to prepare NVIDIA kernel modules: ") +
557-
commandError(result, tr("unknown error"));
558-
}
559-
return false;
560-
}
561-
562-
if (sessionType == QStringLiteral("wayland")) {
563-
emit progressMessage(tr("Wayland detected: installing EGL Wayland support "
564-
"and enabling NVIDIA DRM modeset..."));
565-
result = runner.runAsRoot(
566-
QStringLiteral("dnf"),
567-
{QStringLiteral("install"), QStringLiteral("-y"),
568-
QStringLiteral("egl-wayland")});
569-
if (!result.success()) {
570-
if (errorMessage != nullptr) {
571-
*errorMessage =
572-
tr("Failed to install Wayland NVIDIA support packages: ") +
573-
commandError(result, tr("unknown error"));
574-
}
575-
return false;
576-
}
577-
578-
result = runner.runAsRoot(QStringLiteral("grubby"),
579-
{QStringLiteral("--update-kernel=ALL"),
580-
QStringLiteral("--args=nvidia-drm.modeset=1 "
581-
"nvidia-drm.fbdev=1")});
582-
if (!result.success()) {
583-
if (errorMessage != nullptr) {
584-
*errorMessage = tr("Failed to update the Wayland kernel parameter: ") +
585-
commandError(result, tr("unknown error"));
586-
}
587-
return false;
588-
}
589-
return true;
590-
}
591-
592-
emit progressMessage(tr("X11 detected: checking NVIDIA Xorg packages..."));
593-
result = runner.runAsRoot(
594-
QStringLiteral("dnf"),
595-
{QStringLiteral("install"), QStringLiteral("-y"),
596-
QStringLiteral("xorg-x11-drv-nvidia")});
597-
if (!result.success()) {
598-
if (errorMessage != nullptr) {
599-
*errorMessage = tr("Failed to install the X11 NVIDIA package: ") +
600-
commandError(result, tr("unknown error"));
601-
}
602-
return false;
603-
}
604-
605-
return true;
606-
}
607-
608527
void NvidiaUpdater::refreshAvailableVersions() {
609528
QPointer<NvidiaUpdater> guard(this);
610529
runAsyncTask([guard]() {
@@ -674,6 +593,12 @@ void NvidiaUpdater::applyUpdate() { applyVersion(QString()); }
674593
void NvidiaUpdater::applyVersion(const QString &version) {
675594
const QString trimmedVersion = version.trimmed();
676595
const QStringList knownVersions = m_availableVersions;
596+
const QString hardwareMessage = missingNvidiaHardwareMessage();
597+
if (!hardwareMessage.isEmpty()) {
598+
emit updateFinished(false, hardwareMessage);
599+
return;
600+
}
601+
677602
const QString architectureSupportMessage =
678603
CapabilityProbe::fedoraNvidiaDriverFlowSupportMessage();
679604

src/backend/nvidia/updater.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ class NvidiaUpdater : public QObject {
6666
QStringList buildDriverTargets(const QString &version,
6767
const QString &sessionType,
6868
const QString &kernelPackageName) const;
69-
bool finalizeDriverChange(CommandRunner &runner,
70-
const SessionUtil::SessionInfo &sessionInfo,
71-
QString *errorMessage);
7269
SessionUtil::SessionInfo detectSessionInfo() const;
7370
QString m_latestPackageVersion;
7471
bool m_updateAvailable = false;

0 commit comments

Comments
 (0)