Exemple #1
0
Calamares::JobResult
DummyCppJob::exec()
{
    // Ported from dummypython
    QProcess::execute( "/bin/sh", QStringList() << "-c" << "touch ~/calamares-dummycpp" );
    QString accumulator = QDateTime::currentDateTimeUtc().toString( Qt::ISODate ) + '\n';
    accumulator += QStringLiteral( "Calamares version: " ) + CALAMARES_VERSION_SHORT + '\n';
    accumulator += QStringLiteral( "This job's name: " ) + prettyName() + '\n';
    accumulator += QStringLiteral( "Configuration map: %1\n" ).arg( variantMapToString( m_configurationMap ) );
    accumulator += QStringLiteral( "   *** globalstorage test ***\n" );
    Calamares::GlobalStorage *globalStorage = Calamares::JobQueue::instance()->globalStorage();
    accumulator += QStringLiteral( "lala: " ) + (globalStorage->contains( "lala" ) ? QStringLiteral( "true" ) : QStringLiteral( "false" )) + '\n';
    accumulator += QStringLiteral( "foo: " ) + (globalStorage->contains( "foo" ) ? QStringLiteral( "true" ) : QStringLiteral( "false" )) + '\n';
    accumulator += QStringLiteral( "count: " ) + QString::number( globalStorage->count() ) + '\n';
    globalStorage->insert( "item2", "value2" );
    globalStorage->insert( "item3", 3 );
    accumulator += QStringLiteral( "keys: %1\n" ).arg( globalStorage->keys().join( ',' ) );
    accumulator += QStringLiteral( "remove: %1\n" ).arg( QString::number( globalStorage->remove( "item2" ) ) );
    accumulator += QStringLiteral( "values: %1 %2 %3\n" ).arg(
        globalStorage->value( "foo" ).toString(),
        globalStorage->value( "item2" ).toString(),
        globalStorage->value( "item3" ).toString() );

    emit progress( 0.1 );
    cDebug() << "[DUMMYCPP]: " << accumulator;

    globalStorage->debugDump();
    emit progress( 0.5 );

    QThread::sleep( 3 );

    return Calamares::JobResult::ok();
}
void
PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{
    // Copy the efiSystemPartition setting to the global storage. It is needed not only in
    // the EraseDiskPage, but also in the bootloader configuration modules (grub, bootloader).
    Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
    if ( configurationMap.contains( "efiSystemPartition" ) &&
         configurationMap.value( "efiSystemPartition" ).type() == QVariant::String &&
         !configurationMap.value( "efiSystemPartition" ).toString().isEmpty() )
    {
        gs->insert( "efiSystemPartition", configurationMap.value( "efiSystemPartition" ).toString() );
    }
    else
    {
        gs->insert( "efiSystemPartition", QStringLiteral( "/boot/efi" ) );
    }

    if ( configurationMap.contains( "ensureSuspendToDisk" ) &&
         configurationMap.value( "ensureSuspendToDisk" ).type() == QVariant::Bool )
    {
        gs->insert( "ensureSuspendToDisk", configurationMap.value( "ensureSuspendToDisk" ).toBool() );
    }
    else
    {
        gs->insert( "ensureSuspendToDisk", true );
    }

    if ( configurationMap.contains( "compactMode" ) &&
         configurationMap.value( "compactMode" ).type() == QVariant::Bool )
    {
        m_compactMode = configurationMap.value( "compactMode", true ).toBool();
    }

    QTimer::singleShot( 0, this, &PartitionViewStep::continueLoading );
}
Exemple #3
0
void
KeyboardPage::finalize()
{
    Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
    if ( !m_selectedLayout.isEmpty() )
    {
        gs->insert( "keyboardLayout", m_selectedLayout );
        gs->insert( "keyboardVariant", m_selectedVariant ); //empty means default variant
    }

    //FIXME: also store keyboard model for something?
}
Exemple #4
0
QList< Calamares::job_ptr >
UsersPage::createJobs( const QStringList& defaultGroupsList )
{
    QList< Calamares::job_ptr > list;
    if ( !isReady() )
        return list;

    Calamares::Job* j;
    j = new CreateUserJob( ui->textBoxUsername->text(),
                           ui->textBoxFullName->text().isEmpty() ?
                               ui->textBoxUsername->text() :
                               ui->textBoxFullName->text(),
                           ui->checkBoxAutoLogin->isChecked(),
                           defaultGroupsList );
    list.append( Calamares::job_ptr( j ) );

    j = new SetPasswordJob( ui->textBoxUsername->text(),
                            ui->textBoxUserPassword->text() );
    list.append( Calamares::job_ptr( j ) );

    if ( m_writeRootPassword )
    {
        if ( ui->checkBoxReusePassword->isChecked() )
            j = new SetPasswordJob( "root",
                                    ui->textBoxUserPassword->text() );
        else
            j = new SetPasswordJob( "root",
                                    ui->textBoxRootPassword->text() );
        list.append( Calamares::job_ptr( j ) );
    }

    j = new SetHostNameJob( ui->textBoxHostname->text() );
    list.append( Calamares::job_ptr( j ) );

    Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
    gs->insert( "hostname", ui->textBoxHostname->text() );
    if ( ui->checkBoxAutoLogin->isChecked() )
        gs->insert( "autologinUser", ui->textBoxUsername->text() );

    gs->insert( "username", ui->textBoxUsername->text() );
    gs->insert( "password", CalamaresUtils::obscure( ui->textBoxUserPassword->text() ) );

    return list;
}
QList< Calamares::job_ptr >
UsersPage::createJobs( const QString& defaultUserGroup, const QStringList& defaultGroupsList )
{
    QList< Calamares::job_ptr > list;
    if ( !isReady() )
        return list;

    Calamares::Job* j;
    j = new CreateUserJob( ui->textBoxUsername->text(),
                           QString(),
                           ui->checkBoxLoginAuto->isChecked(),
                           defaultUserGroup,
                           defaultGroupsList );
    list.append( Calamares::job_ptr( j ) );

    j = new SetPasswordJob( ui->textBoxUsername->text(),
                            ui->textBoxUserPassword->text() );
    list.append( Calamares::job_ptr( j ) );

    if ( m_showRootPassword )
    {
        j = new SetPasswordJob( "root",
                                ui->textBoxRootPassword->text() );
        list.append( Calamares::job_ptr( j ) );
    }

    j = new SetHostNameJob( ui->textBoxHostname->text() );
    list.append( Calamares::job_ptr( j ) );

    Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
    gs->insert( "hostname", ui->textBoxHostname->text() );
    if ( ui->checkBoxLoginAuto->isChecked() )
        gs->insert( "autologinUser", ui->textBoxUsername->text() );

    gs->insert( "username", ui->textBoxUsername->text() );

    return list;
}