diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 18b398cc1..adac4a1ba 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -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 ); diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.h b/src/libcalamares/utils/CalamaresUtilsSystem.h index 8e9ded611..6648d3818 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.h +++ b/src/libcalamares/utils/CalamaresUtilsSystem.h @@ -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: diff --git a/src/libcalamaresui/Settings.cpp b/src/libcalamaresui/Settings.cpp index 9432b1900..2519984ff 100644 --- a/src/libcalamaresui/Settings.cpp +++ b/src/libcalamaresui/Settings.cpp @@ -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 ) {