Bug 125643 - "rpm -U *.rpm" fails to install new packages if any already installed
"rpm -U *.rpm" fails to install new packages if any already installed
Status: CLOSED WORKSFORME
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
4.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-06-09 12:26 EDT by Robert Spearman
Modified: 2007-04-18 13:08 EDT (History)
0 users

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


Attachments (Terms of Use)

  None (edit)
Description Robert Spearman 2004-06-09 12:26:23 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1)
Gecko/20030225

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):
rpm-4.2-0.69

How reproducible:
Always

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 17:22:07 EDT
Try --freshen (or -F) instead of --update (or -U).
Comment 2 Robert Spearman 2004-06-09 18:15:06 EDT
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 09:39:13 EDT
Then you will need to write a shell script to accomplish.

Here's a lightly tested example to get you started:
#!/bin/sh
                                                                     
          
for fn in *.rpm
do
    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"
    else
        echo "$N is not installed,      use rpm -Uvh $fn"
    fi
done

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