Skip to content

Commit

Permalink
offline: Set correct plymouth mode
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
m-blaha committed Feb 27, 2025
1 parent b58d219 commit e7b05ad
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions dnf5/commands/offline/offline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()});
Expand Down Expand Up @@ -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 "
Expand Down

0 comments on commit e7b05ad

Please sign in to comment.