File enable-postin-scripts-error.diff of Package rpm

--- ./lib/transaction.c.orig	2018-07-02 14:51:41.328051671 +0000
+++ ./lib/transaction.c	2018-07-02 14:51:46.264038824 +0000
@@ -1462,7 +1462,9 @@ rpmRC runScript(rpmts ts, rpmte te, Head
     int warn_only = (stag != RPMTAG_PREIN &&
 		     stag != RPMTAG_PREUN &&
 		     stag != RPMTAG_PRETRANS &&
-		     stag != RPMTAG_VERIFYSCRIPT);
+		     stag != RPMTAG_VERIFYSCRIPT &&
+		     !(stag == RPMTAG_POSTIN &&
+			rpmExpandNumeric("%{_fail_on_postinstall_errors}")));
     rpmdb rdb = rpmtsGetRdb(ts);
 
     /* Fake up a transaction element for triggers from rpmdb */
--- ./macros.in.orig	2018-07-02 14:51:41.340051640 +0000
+++ ./macros.in	2018-07-02 14:51:46.264038824 +0000
@@ -1290,5 +1290,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
 #*/