diff --git a/live/src/config.sh b/live/src/config.sh index aa220749d0..bfad201423 100644 --- a/live/src/config.sh +++ b/live/src/config.sh @@ -90,6 +90,9 @@ systemctl disable snapper-timeline.timer systemctl disable YaST2-Firstboot.service systemctl disable YaST2-Second-Stage.service +# the "eurlatgr" is the default font for the English locale +echo -e "\nFONT=eurlatgr.psfu" >> /etc/vconsole.conf + ### setup dracut for live system arch=$(uname -m) # keep in sync with ISO Volume ID set in the fix_bootconfig script diff --git a/rust/agama-locale-data/src/language.rs b/rust/agama-locale-data/src/language.rs index d91885f0f4..36d5b51ae3 100644 --- a/rust/agama-locale-data/src/language.rs +++ b/rust/agama-locale-data/src/language.rs @@ -20,7 +20,7 @@ use serde::Deserialize; -use crate::ranked::{RankedLocales, RankedTerritories}; +use crate::ranked::{RankedConsoleFonts, RankedLocales, RankedTerritories}; #[derive(Debug, Deserialize)] pub struct Language { @@ -29,6 +29,7 @@ pub struct Language { pub territories: RankedTerritories, pub locales: RankedLocales, pub names: crate::localization::Localization, + pub consolefonts: RankedConsoleFonts, } #[derive(Debug, Deserialize)] diff --git a/rust/agama-locale-data/src/ranked.rs b/rust/agama-locale-data/src/ranked.rs index 01b9235928..f8008a4b87 100644 --- a/rust/agama-locale-data/src/ranked.rs +++ b/rust/agama-locale-data/src/ranked.rs @@ -61,3 +61,16 @@ pub struct RankedLocales { #[serde(default)] pub locale: Vec, } + +#[derive(Debug, Deserialize)] +pub struct RankedConsoleFont { + #[serde(rename(deserialize = "consolefontId"))] + pub id: String, + pub rank: u16, +} + +#[derive(Debug, Deserialize)] +pub struct RankedConsoleFonts { + #[serde(default)] + pub consolefont: Vec, +} diff --git a/rust/agama-server/src/l10n/model.rs b/rust/agama-server/src/l10n/model.rs index dcf056f2b8..ce9fecd039 100644 --- a/rust/agama-server/src/l10n/model.rs +++ b/rust/agama-server/src/l10n/model.rs @@ -18,6 +18,8 @@ // To contact SUSE LLC about this file by physical or electronic mail, you may // find current contact information at www.suse.com. +use std::fs::OpenOptions; +use std::io::Write; use std::process::Command; use crate::error::Error; @@ -151,6 +153,7 @@ impl L10n { // TODO: what should be returned value for commit? pub fn commit(&self) -> Result<(), LocaleError> { const ROOT: &str = "/mnt"; + const VCONSOLE_CONF: &str = "/etc/vconsole.conf"; let locale = self.locales.first().cloned().unwrap_or_default(); let mut cmd = Command::new("/usr/bin/systemd-firstboot"); @@ -170,6 +173,20 @@ impl L10n { let output = cmd.output()?; tracing::info!("{:?}", &output); + // unfortunately the console font cannot be set via the "systemd-firstboot" tool, + // we need to write it directly to the config file + if let Some(entry) = self.locales_db.find_locale(&locale) { + if let Some(font) = &entry.consolefont { + // the font entry is missing in a file created by "systemd-firstboot", just append it at the end + let mut file = OpenOptions::new() + .append(true) + .open(format!("{}{}", ROOT, VCONSOLE_CONF))?; + + tracing::info!("Configuring console font \"{:?}\"", font); + writeln!(file, "\nFONT={}.psfu", font)?; + } + } + Ok(()) } diff --git a/rust/agama-server/src/l10n/model/locale.rs b/rust/agama-server/src/l10n/model/locale.rs index d2345b2bd2..43c3cd02de 100644 --- a/rust/agama-server/src/l10n/model/locale.rs +++ b/rust/agama-server/src/l10n/model/locale.rs @@ -38,6 +38,8 @@ pub struct LocaleEntry { pub language: String, /// Localized territory name (e.g., "Spain", "España", etc.) pub territory: String, + /// Console font + pub consolefont: Option, } /// Represents the locales database. @@ -77,6 +79,13 @@ impl LocalesDatabase { &self.locales } + /// Find the locale in the database + /// + /// * `locale`: the language to find + pub fn find_locale(&self, locale: &LocaleId) -> Option<&LocaleEntry> { + self.locales.iter().find(|l| l.id == *locale) + } + /// Gets the supported locales information. /// /// * `ui_language`: language to use in the translations. @@ -106,11 +115,21 @@ impl LocalesDatabase { .or_else(|| names.name_for(DEFAULT_LANG)) .unwrap_or(territory.id.to_string()); + let consolefont = language + .consolefonts + .consolefont + .first() + .map(|f| f.id.clone()); + let entry = LocaleEntry { id: code.clone(), language: language_label, territory: territory_label, + consolefont, }; + + tracing::info!("Using locale data {:?}", entry); + result.push(entry) } diff --git a/rust/package/agama.changes b/rust/package/agama.changes index 8bc5f56865..d3dd4c609a 100644 --- a/rust/package/agama.changes +++ b/rust/package/agama.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jun 13 12:45:49 UTC 2025 - Ladislav Slezák + +- Configure the console font so the non-ASCII characters are + displayed properly (bsc#1239462) + ------------------------------------------------------------------- Fri Jun 13 10:42:48 UTC 2025 - Imobach Gonzalez Sosa