6

I am getting install failure due to file conflicts. I am facing this issue only on Red Hat Linux 7. Same spec file works on Ubuntu and other Linux distributions.

I tried putting echo on %pre, %post, %preun and %postun sections but I never reached those messages. I tried %dump at the beginning of spec file which also didn't print anything. How do I trace the spec file execution?

%files
%defattr(-,root,root,-)
@CPACK_PACKAGING_INSTALL_PREFIX@/sbin/MyExe
@CPACK_PACKAGING_INSTALL_PREFIX@/share/doc/@CPACK_PACKAGE_FILE_NAME@/myconf.conf
@CPACK_PACKAGING_INSTALL_PREFIX@/share/doc/@CPACK_PACKAGE_FILE_NAME@/README
%if @IS_RHEL7@
/etc/systemd/system/myoverride.conf
%endif

Error during install:

Preparing packages...
    file /etc/systemd/system/myoverride.conf from install of mypackage-5.0.1.x86_64 conflicts with file from package mypackage-4.11.1.x86_64
    file /usr/sbin/myexe from install of mypackage-5.0.1.x86_64 conflicts with file from package mypackage-4.11.1.x86_64
  • What method of installation are you using? I mean `rpm` or `yum`? – Vipin Yadav Nov 17 '17 at 05:11
  • I am using rpm, I do not want to use -U option for upgrade or --force or --replaceFiles etc. I want it to handle the upgrade itself. –  Nov 17 '17 at 06:05

1 Answers1

16

you cannot install twice the same rpm. Therefore if you want to install a newer version of the same rpm (mypackage in your case); you need to use the -U | --upgrade option. Typical usage of rpm goes like this:

rpm -Uvh mypackage-<new-version>.rpm
  • -U : upgrade mypackage to this version
  • -vh : nice display of progress.
Chris Maes
  • 3,282
  • 3
  • 21
  • 32
  • Both rpms have different version of the config and installer, they include changes in configuration file and exe. I need to upgrade both with this install. –  Nov 20 '17 at 01:36
  • 2
    If you want to install both rpms you'll need to rename one of them because you cannot install two rpms with the same name – Chris Maes Nov 20 '17 at 06:10