mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-26 08:58:22 -04:00
Add chrootOutput/check_chroot_output to libcalamares utils API.
This commit is contained in:
parent
648befb9bb
commit
f90bf469dd
4 changed files with 103 additions and 15 deletions
|
@ -28,10 +28,11 @@
|
|||
namespace CalamaresUtils
|
||||
{
|
||||
|
||||
int mount( const QString& devicePath,
|
||||
const QString& mountPoint,
|
||||
const QString& filesystemName,
|
||||
const QString& options )
|
||||
int
|
||||
mount( const QString& devicePath,
|
||||
const QString& mountPoint,
|
||||
const QString& filesystemName,
|
||||
const QString& options )
|
||||
{
|
||||
if ( devicePath.isEmpty() || mountPoint.isEmpty() )
|
||||
return -3;
|
||||
|
@ -56,10 +57,38 @@ int mount( const QString& devicePath,
|
|||
return QProcess::execute( program, args );
|
||||
}
|
||||
|
||||
int chrootCall( const QStringList& args,
|
||||
const QString& stdInput,
|
||||
int timeoutSec )
|
||||
int
|
||||
chrootCall( const QStringList& args,
|
||||
const QString& stdInput,
|
||||
int timeoutSec )
|
||||
{
|
||||
QString discard;
|
||||
return chrootOutput( args,
|
||||
discard,
|
||||
stdInput,
|
||||
timeoutSec );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
chrootCall( const QString& command,
|
||||
const QString& stdInput,
|
||||
int timeoutSec )
|
||||
{
|
||||
return chrootCall( QStringList() = { command },
|
||||
stdInput,
|
||||
timeoutSec );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
chrootOutput( const QStringList& args,
|
||||
QString& output,
|
||||
const QString& stdInput,
|
||||
int timeoutSec )
|
||||
{
|
||||
output.clear();
|
||||
|
||||
if ( !Calamares::JobQueue::instance() )
|
||||
return -3;
|
||||
|
||||
|
@ -107,8 +136,7 @@ int chrootCall( const QStringList& args,
|
|||
return -4;
|
||||
}
|
||||
|
||||
cLog() << "Output:";
|
||||
cLog() << process.readAllStandardOutput();
|
||||
output.append( QString::fromLocal8Bit( process.readAllStandardOutput() ).trimmed() );
|
||||
|
||||
if ( process.exitStatus() == QProcess::CrashExit )
|
||||
{
|
||||
|
@ -121,14 +149,18 @@ int chrootCall( const QStringList& args,
|
|||
}
|
||||
|
||||
|
||||
int chrootCall( const QString& command,
|
||||
const QString& stdInput,
|
||||
int timeoutSec )
|
||||
int
|
||||
chrootOutput( const QString& command,
|
||||
QString& output,
|
||||
const QString& stdInput,
|
||||
int timeoutSec )
|
||||
{
|
||||
return chrootCall( QStringList() = { command },
|
||||
stdInput,
|
||||
timeoutSec );
|
||||
return chrootOutput( QStringList() = { command },
|
||||
output,
|
||||
stdInput,
|
||||
timeoutSec );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue