[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.
main
Adriaan de Groot 5 years ago
parent 995ebd5c83
commit f6419d5de1

@ -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

@ -126,6 +126,13 @@ private:
* pick Ukranian settings, for instance).
*/
LocaleConfiguration m_selectedLocaleConfiguration;
/** @brief Should we adjust the "live" timezone when the location changes?
*
* In the Widgets UI, clicking around on the world map adjusts the
* timezone, and the live system can be made to follow that.
*/
bool m_adjustLiveTimezone;
};

@ -1,5 +1,5 @@
---
# This settings are used to set your default system time zone.
# These settings are used to set your default system time zone.
# Time zones are usually located under /usr/share/zoneinfo and
# provided by the 'tzdata' package of your Distribution.
#
@ -14,17 +14,26 @@
region: "America"
zone: "New_York"
# Should changing the system location (e.g. clicking around on the timezone
# map) immediately reflect the changed timezone in the live system?
# By default, installers (with a target system) do, and setup (e.g. OEM
# configuration) does not, but you can switch it on here (or off, if
# you think it's annoying in the installer).
#
# Note that not all systems support live adjustment.
#
# adjustLiveTimezone: true
# System locales are detected in the following order:
#
# - /usr/share/i18n/SUPPORTED
# - localeGenPath (defaults to /etc/locale.gen if not set)
# - 'locale -a' output
# - `locale -a` output
#
# Enable only when your Distribution is using an
# Enable only when your Distribution is using a
# custom path for locale.gen
#
#localeGenPath: "PATH_TO/locale.gen"
#localeGenPath: "/etc/locale.gen"
# GeoIP based Language settings: Leave commented out to disable GeoIP.
#

@ -4,7 +4,34 @@ $id: https://calamares.io/schemas/locale
additionalProperties: false
type: object
properties:
"region": { type: str }
"zone": { type: str }
"localeGenPath": { type: string, required: true }
"geoipUrl": { type: str }
region: { type: string,
enum: [
Africa,
America,
Antarctica,
Arctic,
Asia,
Atlantic,
Australia,
Europe,
Indian,
Pacific
]
}
zone: { type: string }
adjustLiveTimezone: { type: boolean, default: true }
localeGenPath: { type: string }
# TODO: refactor, this is reused in welcome
geoip:
additionalProperties: false
type: object
properties:
style: { type: string, enum: [ none, fixed, xml, json ] }
url: { type: string }
selector: { type: string }
required: [ style, url, selector ]
required: [ region, zone ]

Loading…
Cancel
Save