[plasmalnf] Run the lnftool in the target (user|system)

This commit is contained in:
Adriaan de Groot 2017-12-03 10:22:46 -05:00
parent 8a053f3c9b
commit d3ef6b07d5

View File

@ -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();
}