If dont-chroot is set, don't chroot target env calls.

main
Teo Mrnjavac 9 years ago
parent 2c9524aebd
commit 2e3751ffa7

@ -99,24 +99,37 @@ targetEnvOutput( const QStringList& args,
return -3;
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
if ( !gs || !gs->contains( "rootMountPoint" ) )
if ( !gs ||
( doChroot && !gs->contains( "rootMountPoint" ) ) )
{
cLog() << "No rootMountPoint in global storage";
return -3;
}
QString destDir = gs->value( "rootMountPoint" ).toString();
if ( !QDir( destDir ).exists() )
QProcess process;
QString program;
QStringList arguments;
if ( doChroot )
{
cLog() << "rootMountPoint points to a dir which does not exist";
return -3;
}
QString destDir = gs->value( "rootMountPoint" ).toString();
if ( !QDir( destDir ).exists() )
{
cLog() << "rootMountPoint points to a dir which does not exist";
return -3;
}
QString program( "chroot" );
QStringList arguments = { destDir };
arguments << args;
program = "chroot";
arguments = QStringList( { destDir } );
arguments << args;
}
else
{
program = "sh";
arguments = QStringList( { "-c" } );
arguments << args;
}
QProcess process;
process.setProgram( program );
process.setArguments( arguments );
process.setProcessChannelMode( QProcess::MergedChannels );

@ -24,6 +24,8 @@
namespace CalamaresUtils
{
static bool doChroot = true;
/**
* Runs the mount utility with the specified parameters.
* @returns the program's exit code, or:

@ -19,6 +19,7 @@
#include "Settings.h"
#include "utils/CalamaresUtils.h"
#include "utils/CalamaresUtilsSystem.h"
#include "utils/Logger.h"
#include "utils/YamlUtils.h"
@ -95,6 +96,9 @@ Settings::Settings( const QString& settingsFilePath,
m_brandingComponentName = QString::fromStdString( config[ "branding" ]
.as< std::string >() );
m_promptInstall = config[ "prompt-install" ].as< bool >();
bool doChroot = !config[ "dont-chroot" ].as< bool >();
CalamaresUtils::doChroot = doChroot;
}
catch ( YAML::Exception& e )
{

Loading…
Cancel
Save