Bug 125643 - "rpm -U *.rpm" fails to install new packages if any already installed
Summary: "rpm -U *.rpm" fails to install new packages if any already installed
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm   
(Show other bugs)
Version: 4.2
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: Mike McLean
Depends On:
TreeView+ depends on / blocked
Reported: 2004-06-09 16:26 UTC by Robert Spearman
Modified: 2007-04-18 17:08 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-06-12 13:39:13 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Robert Spearman 2004-06-09 16:26:23 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1)

Description of problem:
You have a number of rpms in a directory that you want to make sure
are installed and up to date, so you call "rpm -U *.rpm"

However, this will only work if NONE of the rpms are already up to
date.  If any in the upgrade list are already up to date, packages
that aren't already installed are completely ignored!

Behavior should be to upgrade or install all packages as needed.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Get two rpms, one that is installed [RPM1] and up to date, and
another that isn't installed at all [RPM2].
2. Run "rpm -U [RPM1] [RPM2]"


Actual Results:  warning that RPM1 is installed is printed and RPM2 is
NOT installed

Expected Results:  warning that RPM1 is installed, RPM2 installed

Additional info:

Comment 1 Jeff Johnson 2004-06-09 21:22:07 UTC
Try --freshen (or -F) instead of --update (or -U).

Comment 2 Robert Spearman 2004-06-09 22:15:06 UTC
I need to upgrade AND/OR install new packages at the same time.

-freshen does not install new packages, so that won't work.

Comment 3 Jeff Johnson 2004-06-12 13:39:13 UTC
Then you will need to write a shell script to accomplish.

Here's a lightly tested example to get you started:
for fn in *.rpm
    N="`rpm -qp --qf '%{name}' $fn 2> /dev/null`"
    if rpm -q $N >& /dev/null; then
        echo "$N is already installed,  use rpm -Fvh $fn"
        echo "$N is not installed,      use rpm -Uvh $fn"

Note You need to log in before you can comment on or make changes to this bug.