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

--- ./lib/transaction.c.orig	2017-12-01 16:02:14.150972487 +0000
+++ ./lib/transaction.c	2017-12-01 16:02:56.139850122 +0000
@@ -1460,7 +1460,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-01-16 04:02:32.740236142 -0500
+++ macros.in	2018-02-28 07:23:30.203740904 -0500
@@ -437,6 +437,12 @@ package or when debugging this package.\
 %_empty_manifest_terminate_build	1
 
 #
+# Should errors in %post scriptlet be propagated as errors? 
+#
+# Note: set to 1 for legacy compatibility.
+%_fail_on_postinstall_errors  0
+
+#
 # Should binaries in noarch packages terminate a build?
 %_binaries_in_noarch_packages_terminate_build	1