mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-27 01:15:38 -04:00
Add option to run process jobmodules in chroot.
This commit is contained in:
parent
27a10fd08b
commit
7a3ce363b3
8 changed files with 142 additions and 30 deletions
|
@ -59,12 +59,14 @@ mount( const QString& devicePath,
|
|||
|
||||
int
|
||||
chrootCall( const QStringList& args,
|
||||
const QString& workingPath,
|
||||
const QString& stdInput,
|
||||
int timeoutSec )
|
||||
{
|
||||
QString discard;
|
||||
return chrootOutput( args,
|
||||
discard,
|
||||
workingPath,
|
||||
stdInput,
|
||||
timeoutSec );
|
||||
}
|
||||
|
@ -72,10 +74,12 @@ chrootCall( const QStringList& args,
|
|||
|
||||
int
|
||||
chrootCall( const QString& command,
|
||||
const QString& workingPath,
|
||||
const QString& stdInput,
|
||||
int timeoutSec )
|
||||
{
|
||||
return chrootCall( QStringList() = { command },
|
||||
workingPath,
|
||||
stdInput,
|
||||
timeoutSec );
|
||||
}
|
||||
|
@ -84,6 +88,7 @@ chrootCall( const QString& command,
|
|||
int
|
||||
chrootOutput( const QStringList& args,
|
||||
QString& output,
|
||||
const QString& workingPath,
|
||||
const QString& stdInput,
|
||||
int timeoutSec )
|
||||
{
|
||||
|
@ -115,6 +120,15 @@ chrootOutput( const QStringList& args,
|
|||
process.setArguments( arguments );
|
||||
process.setProcessChannelMode( QProcess::MergedChannels );
|
||||
|
||||
if ( !workingPath.isEmpty() )
|
||||
{
|
||||
if ( QDir( workingPath ).exists() )
|
||||
process.setWorkingDirectory( QDir( workingPath ).absolutePath() );
|
||||
else
|
||||
cLog() << "Invalid working directory:" << workingPath;
|
||||
return -3;
|
||||
}
|
||||
|
||||
cLog() << "Running" << program << arguments;
|
||||
process.start();
|
||||
if ( !process.waitForStarted() )
|
||||
|
@ -152,15 +166,16 @@ chrootOutput( const QStringList& args,
|
|||
int
|
||||
chrootOutput( const QString& command,
|
||||
QString& output,
|
||||
const QString& workingPath,
|
||||
const QString& stdInput,
|
||||
int timeoutSec )
|
||||
{
|
||||
return chrootOutput( QStringList() = { command },
|
||||
output,
|
||||
workingPath,
|
||||
stdInput,
|
||||
timeoutSec );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue