Skip to content

Commit

Permalink
offline: Inform user about scriptlets execution
Browse files Browse the repository at this point in the history
Scriptlet execution can take a significant amount of time. Inform the
user when it starts.
  • Loading branch information
m-blaha committed Feb 26, 2025
1 parent 9836e23 commit b58d219
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions dnf5/commands/offline/offline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include <libdnf5/base/goal.hpp>
#include <libdnf5/conf/const.hpp>
#include <libdnf5/conf/option_path.hpp>
#include <libdnf5/rpm/nevra.hpp>
#include <libdnf5/sdbus_compat.hpp>
#include <libdnf5/transaction/offline.hpp>
#include <libdnf5/utils/bgettext/bgettext-lib.h>
Expand Down Expand Up @@ -170,6 +171,24 @@ class PlymouthTransCB : public RpmTransCB {
plymouth.message(message);
}

void script_start(
const libdnf5::base::TransactionPackage * item,
libdnf5::rpm::Nevra nevra,
libdnf5::rpm::TransactionCallbacks::ScriptType type) override {
RpmTransCB::script_start(item, nevra, type);

// Report only pre/post transaction scriptlets. With all scriptlets
// being reported the output flickers way too much to be usable.
using ScriptType = libdnf5::rpm::TransactionCallbacks::ScriptType;
if (type != ScriptType::PRE_TRANSACTION && type != ScriptType::POST_TRANSACTION) {
return;
}

const auto message = fmt::format(
"Running {} scriptlet: {}...", script_type_to_string(type), to_full_nevra_string(nevra).c_str());
plymouth.message(message);
}

private:
PlymouthOutput plymouth;
};
Expand Down

0 comments on commit b58d219

Please sign in to comment.