eramm
eramm

Reputation: 241

rpm -i installs over installed version of the same software

I created a rpm based on the following spec

Name      : MyProg
Summary   : A program I wrote
Version   : 4.3.6.6797
Release   : 1

rpmbuild creates a file called MyProg-4.3.6.6797-1.x86_64 and I installed it on my machine using rpm -i

However after making some changes to the spec I went to bump up the release as

Name      : MyProg
Summary   : A program I wrote
Version   : 4.3.6.6797
Release   : 2

and getting a file called MyProg-4.3.6.6797-2.x86_64

I noticed that rpm -i still installed the latest version even though the was already a version of the rpm installed.

Shouldn't rpm detect that the program is already installed and ask me to use -U --upgrade ?

rpm -qa | grep MyProg shows

rpm -qa | grep MyProg
MyProg-4.3.6.6797-1.x86_64
MyProg-4.3.6.6797-2.x86_64

If I use rpm -U then the rpmdb gets updated properly, but I am confused as to why rpm -i is treating the package as a fresh install and not recognizing the already installed package and treating the new package as an upgrade

thanks

Upvotes: 0

Views: 222

Answers (2)

Tsanko
Tsanko

Reputation: 159

RPM read "Version" of your program, go to change your version to higher one in "spec" file and the issue should be solved.

Regards.

Upvotes: 1

Bruno9779
Bruno9779

Reputation: 1669

Rpm does handle versions automatically as yum does.

I build versions of the same rpms daily, and to avoid this kind of issues I install everything with yum. This was done with ''yum localinstall'' but that is not needed anymore:

  yum install myprog.rpm

Will do exactly what you need.

Furthermore, I advise you to build a local repository and pull the rpms from there. Just remember to add ''metadata_expire=1m'' to the .repo file, so yum checks for updates every time it runs.

Upvotes: 0

Related Questions