diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-09-18 19:16:23 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-10-04 15:32:42 -0500 |
commit | 4e77d86d6fc118f0dd1ec83c55c21e05e727d084 (patch) | |
tree | e1ccb506c662437a3bf6e1dcea55636569a388dc | |
parent | 771f9add609f139a08fddead97ced72a9ba302c2 (diff) | |
download | horizon-4e77d86d6fc118f0dd1ec83c55c21e05e727d084.tar.gz horizon-4e77d86d6fc118f0dd1ec83c55c21e05e727d084.tar.bz2 horizon-4e77d86d6fc118f0dd1ec83c55c21e05e727d084.tar.xz horizon-4e77d86d6fc118f0dd1ec83c55c21e05e727d084.zip |
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
-rw-r--r-- | ui/qt5/intropage.cc | 5 | ||||
-rw-r--r-- | ui/qt5/partitionmanualpage.cc | 5 |
2 files changed, 10 insertions, 0 deletions
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); |