From e52f0318fe8e71b83c216bdfa78d7231d4d68309 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 7 Jan 2019 15:16:37 +0100 Subject: [PATCH] [locale] Call timedatectl only when needed - When testing and running not-as-root, only call the timedatectl when the settings actually change; this reduces the number of times kauth pops up. --- src/modules/locale/LocalePage.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/modules/locale/LocalePage.cpp b/src/modules/locale/LocalePage.cpp index 9aad283c6..f9e2aa515 100644 --- a/src/modules/locale/LocalePage.cpp +++ b/src/modules/locale/LocalePage.cpp @@ -484,19 +484,22 @@ LocalePage::prettyLCLocale( const QString& lcLocale ) const void LocalePage::updateGlobalStorage() { + auto *gs = Calamares::JobQueue::instance()->globalStorage(); + LocaleGlobal::Location location = m_tzWidget->getCurrentLocation(); - Calamares::JobQueue::instance()->globalStorage() - ->insert( "locationRegion", location.region ); - Calamares::JobQueue::instance()->globalStorage() - ->insert( "locationZone", location.zone ); + bool locationChanged = ( location.region != gs->value( "locationRegion" ) ) || + ( location.zone != gs->value( "locationZone" ) ); + + gs->insert( "locationRegion", location.region ); + gs->insert( "locationZone", location.zone ); const QString bcp47 = m_selectedLocaleConfiguration.toBcp47(); - Calamares::JobQueue::instance()->globalStorage()->insert( "locale", bcp47 ); + gs->insert( "locale", bcp47 ); // If we're in chroot mode (normal install mode), then we immediately set the // timezone on the live system. When debugging timezones, don't bother. #ifndef DEBUG_TIMEZONES - if ( Calamares::Settings::instance()->doChroot() ) + if ( locationChanged && Calamares::Settings::instance()->doChroot() ) { QProcess::execute( "timedatectl", // depends on systemd { "set-timezone",