rpm/enable-postin-scripts-error.diff

35 lines
1.1 KiB
Diff

--- lib/rpmscript.c
+++ lib/rpmscript.c
@@ -390,7 +390,7 @@ rpmRC rpmScriptRun(rpmScript script, int
if (script == NULL) return RPMRC_OK;
ARGV_t args = NULL;
- rpmlogLvl lvl = (script->flags & RPMSCRIPT_FLAG_CRITICAL) ?
+ rpmlogLvl lvl = (rpmScriptFlags(script) & RPMSCRIPT_FLAG_CRITICAL) ?
RPMLOG_ERR : RPMLOG_WARNING;
rpmRC rc;
int script_type = RPMSCRIPTLET_FORK | RPMSCRIPTLET_EXEC;
@@ -637,5 +637,8 @@ rpmscriptTypes rpmScriptType(rpmScript s
rpmscriptFlags rpmScriptFlags(rpmScript script)
{
- return (script != NULL) ? script->flags : 0;
+ rpmscriptFlags flags = (script != NULL) ? script->flags : 0;
+ if (script && script->tag == RPMTAG_POSTIN && rpmExpandNumeric("%{_fail_on_postinstall_errors}"))
+ flags |= RPMSCRIPT_FLAG_CRITICAL;
+ return flags;
}
--- macros.in
+++ macros.in
@@ -1293,5 +1293,10 @@ end
%{expand:%__scm_setup_%{__scm} %{!-v:-q}}\
%{!-N:%autopatch %{-v} %{-p:-p%{-p*}}}
+# Should errors in %post scriptlet be propagated as errors?
+#
+# Note: set to 1 for legacy compatibility.
+%_fail_on_postinstall_errors 0
+
# \endverbatim
#*/