Add mount and chrootCall utilities to libcalamares + Python wrappers.

This commit is contained in:
Teo Mrnjavac 2014-07-29 20:18:02 +02:00
parent e3a333e6e6
commit 63534f7154
6 changed files with 262 additions and 3 deletions

View file

@ -20,12 +20,57 @@
#include "PythonHelper.h"
#include "utils/Logger.h"
#include "utils/CalamaresUtilsSystem.h"
#include <QDir>
#undef slots
#include <boost/python/extract.hpp>
namespace CalamaresPython
{
int
mount( const std::string& device_path,
const std::string& mount_point,
const std::string& filesystem_name,
const std::string& options )
{
return CalamaresUtils::mount( QString::fromStdString( device_path ),
QString::fromStdString( mount_point ),
QString::fromStdString( filesystem_name ),
QString::fromStdString( options ) );
}
int
chroot_call( const std::string& command,
const std::string& stdin,
int timeout )
{
return CalamaresUtils::chrootCall( QString::fromStdString( command ),
QString::fromStdString( stdin ),
timeout );
}
int
chroot_call( const boost::python::list& args,
const std::string& stdin,
int timeout )
{
QStringList list;
for ( int i = 0; i < boost::python::len( args ); ++i )
{
list.append( QString::fromStdString(
boost::python::extract< std::string >( args[ i ] ) ) );
}
return CalamaresUtils::chrootCall( list.join( ' ' ),
QString::fromStdString( stdin ),
timeout );
}
void
debug( const std::string& s )
@ -51,4 +96,5 @@ PythonJobInterface::setprogress( qreal progress )
m_parent->emitProgress( progress );
}
}