title: RPM .spec how to escape preun and postun?
body: <p>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:</p>
  
  <p>sudo rpm -i --nopreun --nopostun package_version_2.rpm</p>
  
  <p>but this is not what i want. Im looking to find a solution to escape preun and postun from inside the .spec file.</p>
  
  <p>After some research for example (and ofc almost any post in stackoverflow with keywords "RPM .spec preun postun"):</p>
  
  <p><a href="http://meinit.nl/rpm-spec-prepostpreunpostun-argument-values" rel="nofollow noreferrer">http://meinit.nl/rpm-spec-prepostpreunpostun-argument-values</a>
  <a href="https://www.ibm.com/developerworks/library/l-rpm2/" rel="nofollow noreferrer">https://www.ibm.com/developerworks/library/l-rpm2/</a></p>
  
  <p>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.</p>
  
  <p>In case section you can see some of my attemps...</p>
  
  <pre><code>%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 '###################################################################'
  </code></pre>
  
  <p>any help will be appreciated</p>