diff options
Diffstat (limited to 'lib/transaction.c')
-rw-r--r-- | lib/transaction.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/transaction.c b/lib/transaction.c index 31308d10c..a74e6c4e6 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -1413,9 +1413,10 @@ rpmRC rpmtsSetupTransactionPlugins(rpmts ts) * @param arg2 ditto, but for the target package * @return 0 on success */ -rpmRC runScript(rpmts ts, rpmte te, ARGV_const_t prefixes, +rpmRC runScript(rpmts ts, rpmte te, Header h, ARGV_const_t prefixes, rpmScript script, int arg1, int arg2) { + rpmte xte = te; rpmRC stoprc, rc = RPMRC_OK; rpmTagVal stag = rpmScriptTag(script); FD_t sfd = NULL; @@ -1424,6 +1425,12 @@ rpmRC runScript(rpmts ts, rpmte te, ARGV_const_t prefixes, stag != RPMTAG_PRETRANS && stag != RPMTAG_VERIFYSCRIPT); + /* Fake up a transaction element for triggers from rpmdb */ + if (te == NULL) { + te = rpmteNew(ts, h, TR_REMOVED, NULL, NULL); + rpmteSetHeader(te, h); + } + sfd = rpmtsNotify(ts, te, RPMCALLBACK_SCRIPT_START, stag, 0); if (sfd == NULL) sfd = rpmtsScriptFd(ts); @@ -1449,6 +1456,9 @@ rpmRC runScript(rpmts ts, rpmte te, ARGV_const_t prefixes, rpmtsNotify(ts, te, RPMCALLBACK_SCRIPT_ERROR, stag, rc); } + if (te != xte) + rpmteFree(te); + return rc; } |