From 4e77d86d6fc118f0dd1ec83c55c21e05e727d084 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Wed, 18 Sep 2024 19:16:23 -0500 Subject: Qt UI: Fall back to non-sudo when launching KPM The inst CD doesn't have sudo on it, because everything is run as root anyway. If we can't start things under sudo, try running them raw. Closes: #397 --- ui/qt5/intropage.cc | 5 +++++ ui/qt5/partitionmanualpage.cc | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ui/qt5/intropage.cc b/ui/qt5/intropage.cc index 94e222d..d0189e7 100644 --- a/ui/qt5/intropage.cc +++ b/ui/qt5/intropage.cc @@ -56,6 +56,11 @@ IntroPage::IntroPage(QWidget *parent) : HorizonWizardPage(parent) { connect(toolMenu->addAction("&Partition Editor"), &QAction::triggered, [=](void) { QProcess *p = new QProcess(this); p->start("sudo", {"/usr/bin/partitionmanager"}); + p->waitForStarted(); + if(p->error() == QProcess::FailedToStart) { + // We may be on the -inst CD that has no sudo and runs as root. + p->start("/usr/bin/partitionmanager"); + } horizonWizard()->tools.push_back(p); }); connect(toolMenu->addAction("&Web Browser"), &QAction::triggered, [=](void){ diff --git a/ui/qt5/partitionmanualpage.cc b/ui/qt5/partitionmanualpage.cc index b9c2d55..28329bc 100644 --- a/ui/qt5/partitionmanualpage.cc +++ b/ui/qt5/partitionmanualpage.cc @@ -39,6 +39,11 @@ PartitionManualPage::PartitionManualPage(QWidget *parent) connect(button, &QPushButton::clicked, [=]{ QProcess p; p.execute("sudo", {"/usr/bin/partitionmanager"}); + p.waitForStarted(); + if(p.error() == QProcess::FailedToStart) { + // We may be on the -inst CD that has no sudo and runs as root. + p.start("/usr/bin/partitionmanager"); + } }); layout->addStretch(); layout->addWidget(button, 0, Qt::AlignCenter); -- cgit v1.2.3-70-g09d2