diff --git a/resources/rpm/project.spec.erb b/resources/rpm/project.spec.erb index 2b80388b..3bcafdbb 100644 --- a/resources/rpm/project.spec.erb +++ b/resources/rpm/project.spec.erb @@ -242,13 +242,17 @@ fi %post -<%- if @platform.is_aix? || (@platform.is_el? && @platform.os_version.to_i == 4) -%> -## EL-4 and AIX RPM don't have %posttrans, so we'll put them here -# Run postinstall scripts on install if defined -if [ "$1" -eq 1 ] ; then +# Run post-transaction scripts on install if defined +if [ -e %{_localstatedir}/lib/rpm-state/%{name}/install ] ; then <%= get_postinstall_actions("install") %> + rm %{_localstatedir}/lib/rpm-state/%{name}/install +fi + +# Run post-transaction scripts on upgrade if defined +if [ -e %{_localstatedir}/lib/rpm-state/%{name}/upgrade ] ; then + <%= get_postinstall_actions("upgrade") %> + rm %{_localstatedir}/lib/rpm-state/%{name}/upgrade fi -<%- end -%> <%- get_services.each do |service| -%> # switch based on systemd vs systemv vs smf vs aix # @@ -352,21 +356,6 @@ fi <%- end -%> -<%- unless @platform.is_aix? || (@platform.is_el? && @platform.os_version.to_i == 4) -%> -%posttrans -# Run post-transaction scripts on install if defined -if [ -e %{_localstatedir}/lib/rpm-state/%{name}/install ] ; then - <%= get_postinstall_actions("install") %> - rm %{_localstatedir}/lib/rpm-state/%{name}/install -fi - -# Run post-transaction scripts on upgrade if defined -if [ -e %{_localstatedir}/lib/rpm-state/%{name}/upgrade ] ; then - <%= get_postinstall_actions("upgrade") %> - rm %{_localstatedir}/lib/rpm-state/%{name}/upgrade -fi -<%- end -%> - %files <%- unless get_directories.empty? -%>-f %{SOURCE1}<%- end -%> <%- unless @bill_of_materials -%>