mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-02 03:45:38 -04:00
Merge branch 'fix-sudo-settings' into calamares
This commit is contained in:
commit
3b152ba455
3 changed files with 45 additions and 1 deletions
|
@ -815,7 +815,7 @@ Config::createJobs() const
|
||||||
|
|
||||||
Calamares::Job* j;
|
Calamares::Job* j;
|
||||||
|
|
||||||
if ( m_sudoersGroup.isEmpty() )
|
if ( !m_sudoersGroup.isEmpty() )
|
||||||
{
|
{
|
||||||
j = new SetupSudoJob( m_sudoersGroup );
|
j = new SetupSudoJob( m_sudoersGroup );
|
||||||
jobs.append( Calamares::job_ptr( j ) );
|
jobs.append( Calamares::job_ptr( j ) );
|
||||||
|
|
|
@ -38,6 +38,7 @@ SetupSudoJob::exec()
|
||||||
{
|
{
|
||||||
if ( m_sudoGroup.isEmpty() )
|
if ( m_sudoGroup.isEmpty() )
|
||||||
{
|
{
|
||||||
|
cDebug() << "Skipping sudo 10-installer because the sudoGroup is empty.";
|
||||||
return Calamares::JobResult::ok();
|
return Calamares::JobResult::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ private Q_SLOTS:
|
||||||
|
|
||||||
void testReadGroup();
|
void testReadGroup();
|
||||||
void testCreateGroup();
|
void testCreateGroup();
|
||||||
|
|
||||||
|
void testSudoGroup();
|
||||||
};
|
};
|
||||||
|
|
||||||
GroupTests::GroupTests() {}
|
GroupTests::GroupTests() {}
|
||||||
|
@ -98,6 +100,47 @@ GroupTests::testCreateGroup()
|
||||||
QVERIFY( !j.exec() ); // running as regular user this should fail
|
QVERIFY( !j.exec() ); // running as regular user this should fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GroupTests::testSudoGroup()
|
||||||
|
{
|
||||||
|
// Test programmatic changes
|
||||||
|
{
|
||||||
|
Config c;
|
||||||
|
QSignalSpy spy(&c, &Config::sudoersGroupChanged);
|
||||||
|
QCOMPARE( c.sudoersGroup(), QString() );
|
||||||
|
c.setSudoersGroup( QStringLiteral( "wheel" ) );
|
||||||
|
QCOMPARE( c.sudoersGroup(), QStringLiteral( "wheel" ) );
|
||||||
|
QCOMPARE( spy.count(), 1); // Changed to wheel
|
||||||
|
// Do it again, no change
|
||||||
|
c.setSudoersGroup( QStringLiteral( "wheel" ) );
|
||||||
|
QCOMPARE( c.sudoersGroup(), QStringLiteral( "wheel" ) );
|
||||||
|
QCOMPARE( spy.count(), 1);
|
||||||
|
c.setSudoersGroup( QStringLiteral( "roue" ) );
|
||||||
|
QCOMPARE( c.sudoersGroup(), QStringLiteral( "roue" ) );
|
||||||
|
QCOMPARE( spy.count(), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Test config loading
|
||||||
|
{
|
||||||
|
Config c;
|
||||||
|
QSignalSpy spy(&c, &Config::sudoersGroupChanged);
|
||||||
|
QCOMPARE( c.sudoersGroup(), QString() );
|
||||||
|
|
||||||
|
QVariantMap m;
|
||||||
|
c.setConfigurationMap( m );
|
||||||
|
QCOMPARE( c.sudoersGroup(), QString() );
|
||||||
|
QCOMPARE( spy.count(), 0); // Unchanged
|
||||||
|
|
||||||
|
const auto key = QStringLiteral( "sudoersGroup" );
|
||||||
|
const auto v0 = QStringLiteral( "wheel" );
|
||||||
|
const auto v1 = QStringLiteral( "roue" );
|
||||||
|
m.insert( key, v0 );
|
||||||
|
c.setConfigurationMap( m );
|
||||||
|
QCOMPARE( c.sudoersGroup(), v0 );
|
||||||
|
QCOMPARE( spy.count(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QTEST_GUILESS_MAIN( GroupTests )
|
QTEST_GUILESS_MAIN( GroupTests )
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue