Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions live/src/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion rust/agama-locale-data/src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use serde::Deserialize;

use crate::ranked::{RankedLocales, RankedTerritories};
use crate::ranked::{RankedConsoleFonts, RankedLocales, RankedTerritories};

#[derive(Debug, Deserialize)]
pub struct Language {
Expand All @@ -29,6 +29,7 @@ pub struct Language {
pub territories: RankedTerritories,
pub locales: RankedLocales,
pub names: crate::localization::Localization,
pub consolefonts: RankedConsoleFonts,
}

#[derive(Debug, Deserialize)]
Expand Down
13 changes: 13 additions & 0 deletions rust/agama-locale-data/src/ranked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,16 @@ pub struct RankedLocales {
#[serde(default)]
pub locale: Vec<RankedLocale>,
}

#[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<RankedConsoleFont>,
}
17 changes: 17 additions & 0 deletions rust/agama-server/src/l10n/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand All @@ -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(())
}

Expand Down
19 changes: 19 additions & 0 deletions rust/agama-server/src/l10n/model/locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
}

/// Represents the locales database.
Expand Down Expand Up @@ -77,6 +79,13 @@ impl LocalesDatabase {
&self.locales
}

/// Find the locale in the database
Comment thread
lslezak marked this conversation as resolved.
///
/// * `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.
Expand Down Expand Up @@ -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)
}

Expand Down
6 changes: 6 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jun 13 12:45:49 UTC 2025 - Ladislav Slezák <lslezak@suse.com>

- 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 <igonzalezsosa@suse.com>

Expand Down