[locale] New setting *adjustLiveTimezone*

- allow finer-grained control over whether-or-not to adjust the
  timezone in the live system.
- handle some special cases at the point of loading-configuration.
- document the setting in locale.conf
- correct some documentation bugs
- adjust the YAML schema for locale.conf so it's legal YAML syntax
  **and** validates the current file.
This commit is contained in:
Adriaan de Groot 2020-07-22 00:06:56 +02:00
parent 995ebd5c83
commit f6419d5de1
4 changed files with 69 additions and 13 deletions

View file

@ -177,15 +177,11 @@ Config::Config( QObject* parent )
gs->insert( "locationRegion", location->region() );
gs->insert( "locationZone", location->zone() );
// 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 ( locationChanged && Calamares::Settings::instance()->doChroot() )
if ( locationChanged && m_adjustLiveTimezone )
{
QProcess::execute( "timedatectl", // depends on systemd
{ "set-timezone", location->region() + '/' + location->zone() } );
}
#endif
} );
}
@ -325,6 +321,23 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
localeGenPath = QStringLiteral( "/etc/locale.gen" );
}
m_localeGenLines = loadLocales( localeGenPath );
m_adjustLiveTimezone
= CalamaresUtils::getBool( configurationMap, "adjustLiveTimezone", Calamares::Settings::instance()->doChroot() );
#ifdef DEBUG_TIMEZONES
if ( m_adjustLiveTimezone )
{
cDebug() << "Turning off live-timezone adjustments because debugging is on.";
m_adjustLiveTimezone = false;
}
#endif
#ifdef __FreeBSD__
if ( m_adjustLiveTimezone )
{
cDebug() << "Turning off live-timezone adjustments on FreeBSD.";
m_adjustLiveTimezone = false;
}
#endif
}
Calamares::JobList