I have build a package_version_1.rpm. Now im trying to build a package_version_2.rpm. Default behavior of the RPM will remove any file from package_version_1.rpm that is not upgraded from package_version_2.rpm. To achieve what i want i must install the package like that:
sudo rpm -i --nopreun --nopostun package_version_2.rpm
but this is not what i want. Im looking to find a solution to escape preun and postun from inside the .spec file.
After some research for example (and ofc almost any post in stackoverflow with keywords "RPM .spec preun postun"):
http://meinit.nl/rpm-spec-prepostpreunpostun-argument-values https://www.ibm.com/developerworks/library/l-rpm2/
i find out that with that command: rpm --showrc prints out all macros. I export them to a txt file to be easy to search and i try to experiment. I create case's in preun and postun and im trying to find a solution to disable preun and postun in case of upgrade. I try every possible idea that i had but no luck.
In case section you can see some of my attemps...
%define debug_package %{nil}
%global _python_bytecompile_errors_terminate_build 0
%define _binaries_in_noarch_packages_terminate_build 0
%preun
# this runs before remove the package
echo '###################################################################'
echo 'Run preun package_version_1.rpm'
case "$1" in
0)
echo 'case 0 preun'
# This is an uninstallation.
;;
1)
# %systemd_postun %{nil}
# systemd_user_preun %{nil}
echo 'case 1 preun'
# systemctl --nopreun
exit 0
;;
esac
echo '###################################################################'
%postun
# this runs after the package has be removed
echo '###################################################################'
echo 'Run postun package_version_1.rpm'
case "$1" in
0)
echo 'case 0 postun'
# This is an uninstallation.
;;
1)
# %systemd_postun %{nil}
# systemd_user_postun %{nil}
echo 'case 1 postun'
# systemctl --nopostun
exit 0
;;
esac
echo '###################################################################'
any help will be appreciated