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

--- ./lib/transaction.c.orig	2017-01-19 13:46:06.163983390 +0000
+++ ./lib/transaction.c	2017-01-19 13:47:03.649807918 +0000
@@ -1435,7 +1435,9 @@ rpmRC runScript(rpmts ts, rpmte te, ARGV
     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);
 
     sfd = rpmtsNotify(ts, te, RPMCALLBACK_SCRIPT_START, stag, 0);
--- ./macros.in.orig	2017-01-19 13:44:57.362193434 +0000
+++ ./macros.in	2017-01-19 13:45:13.038145574 +0000
@@ -1374,6 +1374,11 @@ end}
 %{-S:%{expand:%__scm_setup_%{-S*} %{!-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
 #*/