From d3ef6b07d58254be5dc49676e61af750ae1a22f0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 3 Dec 2017 10:22:46 -0500 Subject: [PATCH] [plasmalnf] Run the lnftool in the target (user|system) --- src/modules/plasmalnf/PlasmaLnfJob.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/modules/plasmalnf/PlasmaLnfJob.cpp b/src/modules/plasmalnf/PlasmaLnfJob.cpp index c98dc7587..6c97e85e6 100644 --- a/src/modules/plasmalnf/PlasmaLnfJob.cpp +++ b/src/modules/plasmalnf/PlasmaLnfJob.cpp @@ -34,6 +34,7 @@ #include "JobQueue.h" #include "GlobalStorage.h" +#include "utils/CalamaresUtilsSystem.h" #include "utils/Logger.h" PlasmaLnfJob::PlasmaLnfJob( const QString& lnfPath, const QString& id ) @@ -71,6 +72,24 @@ PlasmaLnfJob::exec() { cDebug() << "Plasma Look-and-Feel Job"; + int r = 0; + auto system = CalamaresUtils::System::instance(); + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + + if ( system->doChroot() ) + { + r = system->targetEnvCall( QStringList( { m_lnfPath, "-a", m_id } ) ); + } + else + { + r = system->targetEnvCall( QStringList( + { "sudo", "-u", gs->value("username").toString(), m_lnfPath, "-a", m_id } ) ); + } + + if (r) + return Calamares::JobResult::error( + tr( "Could not select KDE Plasma Look-and-Feel package" ), + tr( "Could not select KDE Plasma Look-and-Feel package" ) ); return Calamares::JobResult::ok(); }