From 0eba4de6f8b8d5c3e534062c9dcd3341168cd8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 1 Dec 2023 07:18:11 +0000 Subject: [PATCH 1/4] Force writing the timezone --- rust/agama-dbus-server/src/locale.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rust/agama-dbus-server/src/locale.rs b/rust/agama-dbus-server/src/locale.rs index cae074a708..eae459de97 100644 --- a/rust/agama-dbus-server/src/locale.rs +++ b/rust/agama-dbus-server/src/locale.rs @@ -166,7 +166,13 @@ impl Locale { .status() .context("Failed to execute systemd-firstboot")?; Command::new("/usr/bin/systemd-firstboot") - .args(["--root", ROOT, "--timezone", self.timezone.as_str()]) + .args([ + "--root", + ROOT, + "--force", + "--timezone", + self.timezone.as_str(), + ]) .status() .context("Failed to execute systemd-firstboot")?; From 5963c7408d84805a7906a89fc7498aec997bd6fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 1 Dec 2023 09:38:28 +0000 Subject: [PATCH 2/4] Use a single systemd-firstboot call --- rust/agama-dbus-server/src/locale.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/rust/agama-dbus-server/src/locale.rs b/rust/agama-dbus-server/src/locale.rs index eae459de97..aabdfdc260 100644 --- a/rust/agama-dbus-server/src/locale.rs +++ b/rust/agama-dbus-server/src/locale.rs @@ -156,22 +156,13 @@ impl Locale { .args([ "--root", ROOT, + "--force", "--locale", self.locales.first().context("missing locale")?.as_str(), - ]) - .status() - .context("Failed to execute systemd-firstboot")?; - Command::new("/usr/bin/systemd-firstboot") - .args(["--root", ROOT, "--keymap", &self.keymap.to_string()]) - .status() - .context("Failed to execute systemd-firstboot")?; - Command::new("/usr/bin/systemd-firstboot") - .args([ - "--root", - ROOT, - "--force", + "--keymap", + &self.keymap.to_string(), "--timezone", - self.timezone.as_str(), + &self.timezone, ]) .status() .context("Failed to execute systemd-firstboot")?; From eb37a5e1cbef6e95fd68b22adc353375e20384cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Sat, 2 Dec 2023 12:37:50 +0000 Subject: [PATCH 3/4] Mock the InstFunctions module --- .../agama/dbus/y2dir/modules/InstFunctions.rb | 58 +++++++++++++++++++ .../y2dir/storage/modules/InstFunctions.rb | 1 + 2 files changed, 59 insertions(+) create mode 100644 service/lib/agama/dbus/y2dir/modules/InstFunctions.rb create mode 120000 service/lib/agama/dbus/y2dir/storage/modules/InstFunctions.rb diff --git a/service/lib/agama/dbus/y2dir/modules/InstFunctions.rb b/service/lib/agama/dbus/y2dir/modules/InstFunctions.rb new file mode 100644 index 0000000000..a1d5a21cc4 --- /dev/null +++ b/service/lib/agama/dbus/y2dir/modules/InstFunctions.rb @@ -0,0 +1,58 @@ +# Copyright (c) [2022-2023] SUSE LLC +# +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact SUSE LLC. +# +# To contact SUSE LLC about this file by physical or electronic mail, you may +# find current contact information at www.suse.com. + +require "yast" + +# :nodoc: +module Yast + # Replacement for the Yast::Package module + # + # @see https://github.com/yast/yast-installation/blob/279b7d108eab24082237cf5e3f02a31f58fef8da/src/modules/InstFunctions.rb + class InstFunctionsClass < Module + def main + puts "Loading mocked module #{__FILE__}" + end + + # @see https://github.com/yast/yast-installation/blob/279b7d108eab24082237cf5e3f02a31f58fef8da/src/modules/InstFunctions.rb#L56 + def ignored_features + [] + end + + # @see https://github.com/yast/yast-installation/blob/279b7d108eab24082237cf5e3f02a31f58fef8da/src/modules/InstFunctions.rb#L83 + def reset_ignored_features; end + + # @see https://github.com/yast/yast-installation/blob/279b7d108eab24082237cf5e3f02a31f58fef8da/src/modules/InstFunctions.rb#L91 + def feature_ignored?(_feature_name) + false + end + + # @see https://github.com/yast/yast-installation/blob/279b7d108eab24082237cf5e3f02a31f58fef8da/src/modules/InstFunctions.rb#L107 + def second_stage_required? + false + end + + # @see https://github.com/yast/yast-installation/blob/279b7d108eab24082237cf5e3f02a31f58fef8da/src/modules/InstFunctions.rb#L137 + def self_update_explicitly_enabled? + false + end + end + + InstFunctions = InstFunctionsClass.new + InstFunctions.main +end diff --git a/service/lib/agama/dbus/y2dir/storage/modules/InstFunctions.rb b/service/lib/agama/dbus/y2dir/storage/modules/InstFunctions.rb new file mode 120000 index 0000000000..42c5d80092 --- /dev/null +++ b/service/lib/agama/dbus/y2dir/storage/modules/InstFunctions.rb @@ -0,0 +1 @@ +../../modules/InstFunctions.rb \ No newline at end of file From 6ebe3ba3f9640a39f5650345c7648e4770b68f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Sun, 3 Dec 2023 15:54:44 +0000 Subject: [PATCH 4/4] Update changes files --- rust/package/agama-cli.changes | 6 ++++++ service/package/rubygem-agama.changes | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/rust/package/agama-cli.changes b/rust/package/agama-cli.changes index 074339a3f5..38b6622ad3 100644 --- a/rust/package/agama-cli.changes +++ b/rust/package/agama-cli.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Dec 3 15:53:34 UTC 2023 - Imobach Gonzalez Sosa + +- Use a single call to systemd-firstboot to write the localization + settings (gh#openSUSE/agama#903). + ------------------------------------------------------------------- Sat Dec 2 18:05:54 UTC 2023 - Imobach Gonzalez Sosa diff --git a/service/package/rubygem-agama.changes b/service/package/rubygem-agama.changes index 596ead89a6..ea4c958623 100644 --- a/service/package/rubygem-agama.changes +++ b/service/package/rubygem-agama.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sun Dec 3 15:45:22 UTC 2023 - Imobach Gonzalez Sosa + +- Redefine the InstFunctions module to avoid calling code that + causes unwanted side effects, like resetting the timezone + (gh#openSUSE/agama#903). + ------------------------------------------------------------------- Sat Dec 2 18:05:37 UTC 2023 - Imobach Gonzalez Sosa