[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: How to install a bunch of RPMS if some are already installed?



Thanks for the quick responses. Actually, I'd already figured out that running through a loop on every package with a "rpm -U" WOULD obtain the desired results (with messages printed for all of the stuff already installed, of course, and assuming there are no interdependencies between the packages), but what I was HOPING for was a single command which would perform the intended operation, as doing a lot of separate calls involves a LOT of duplicated overhead (executing rpm, opening the database, comparisons, etc.). It takes about 10 times as long, even with < 100 files.

I just found it hard to believe that no one else is doing upgrades this way:

   * Create a directory containing all of the "add-on" packages that
     you want every machine to have (in addition to their "standard"
     install).  This would contain 3rd-party apps not incorporated into
     the RedHat distros, etc.
   * Once a (day|week|etc.) run an rpm command on each client to ensure
     that it was up-to-date with any changes to this "add-on" list.
      Then pushing new software out to all of your systems becomes
     simply a matter of dropping the rpm into this directory.  VERY
     handy for administering a large group of machines.

Any chance of making this a "feature request" for the next version of RPM, possibly via an option to "rpm -U", say "-k, --keep" (a la sgi's "inst" command's "keep" option)?

Thanks again,

Alan

Jag <agrajag@dragaera.net> wrote:



Probably a simple for loop would sort them out for you.  Then you
could remove those that are dubs (or find other problems, but still
get installable ones installed)

I haven't done this but I think the rpm --test command may be your
friend here.  I only tried agains a very small sample.

Probably work without the --test too, but testing  would be a little safer.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 #!/bin/bash
 RPM_DIR=/some/rpm_dir
 ## cd to the scene of the crime
 cd $RPM_DIR

for ii in `ls *rpm` ## get a working list of all the rpms in there
do
## test and record (including stderr) each file
rpm -Uvh --test $ii > test_results 2>&1
## if test shows exit status of 0 then run the install command.
if [ "$? = 0 ]; then
## record installationn rpm -Uvh $ii 2>&1|tee -a installed_results fi
done
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


That should leave you with the installable ones installed,
uninstallable ones will be recorded in test_results
In case there were other reasons besides being installed already.

Install output will be recorded in installed_results but also piped
to screen so you see what is happening.







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []