From e7b05ad5d75c5632bc21814ecc48112e05b7f2b9 Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Wed, 26 Feb 2025 16:05:42 +0100 Subject: [PATCH] offline: Set correct plymouth mode The mode is set to "system-upgrade" for upgrading to the next distribution version, and to "updates" for general offline transaction execution. Also the plymouth message is adjusted according to the mode. --- dnf5/commands/offline/offline.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dnf5/commands/offline/offline.cpp b/dnf5/commands/offline/offline.cpp index 03228b78d..335e5821f 100644 --- a/dnf5/commands/offline/offline.cpp +++ b/dnf5/commands/offline/offline.cpp @@ -97,7 +97,7 @@ namespace dnf5 { class PlymouthOutput { public: bool ping() { return plymouth({"--ping"}); } - bool set_mode() { return plymouth({"change-mode", "--system-upgrade"}); } + bool set_mode(const std::string & mode) { return plymouth({"change-mode", "--" + mode}); } bool message(const std::string & message) { if (last_message.has_value() && message == last_message) { plymouth({"hide-message", "--text", last_message.value()}); @@ -447,13 +447,19 @@ void OfflineExecuteCommand::run() { const auto & system_releasever = offline_data.get_system_releasever(); const auto & target_releasever = offline_data.get_target_releasever(); - const std::string message = "Starting offline transaction. This will take a while."; + std::string message = _("Starting offline transaction. This will take a while."); + std::string mode{"updates"}; + if (offline_data.get_verb() == "system-upgrade download") { + mode = "system-upgrade"; + message = _("Starting system upgrade. This will take a while."); + } + dnf5::offline::log_status(ctx, message, libdnf5::offline::OFFLINE_STARTED_ID, system_releasever, target_releasever); PlymouthOutput plymouth; - plymouth.set_mode(); + plymouth.set_mode(mode); plymouth.progress(0); - plymouth.message(_(message.c_str())); + plymouth.message(message.c_str()); std::cout << _("Warning: the `_execute` command is for internal use only and is not intended to be run directly by "