Find the answer to your Linux question:
Results 1 to 2 of 2
I have a directory(old_rpms_dir) that contains some rpms. I have another directory(new_rpms_dir) that contains all of the rpms that "old_rpm_dir" directory contains, as well as some additional rpms I want ...
  1. #1
    Linux Newbie
    Join Date
    Feb 2007
    Posts
    248

    Lightbulb help me upgrade rpms

    I have a directory(old_rpms_dir) that contains some rpms.

    I have another directory(new_rpms_dir) that contains all of the rpms that "old_rpm_dir" directory contains, as well as some additional rpms

    I want a script that copies only those rpms from new_rpms_dir that are also included in in old_rpms_dir

    e.g
    # ls old_rpms_dir
    a.1.rpm b.1.rpm

    # ls new_rpms_dir
    a.2.rpm b.2.rpm z.0.rpm y.0.rpm

    packages "a" and "b" are in both directories, so i want that a.2.rpm, b.2.rpm will be copied from new_rpms_dir to a directory "rpms_up2date_dir"

    Please help

    Regards
    needee

  2. #2
    Just Joined!
    Join Date
    Apr 2007
    Posts
    14
    It will depend on the exact names of the RPMs; you'd have to write a text parser, and use a pointer to find the beginning of the version number, then use all the string of the filename prior to that to search among the filenames in the second directory. And that even assumes that the RPM package filename will follow the convention <product>-<version>-<architecture>.rpm; this is not a requirement, only a convention.

    However, if the older RPMs are the ones installed on the system you're about to upgrade, the "freshen" (-F) operation in the RPM command will only install a package if:
    a) that package has already been installed on the system, and
    b) the version given in the package list to the RPM command is newer than the existing version installed on the system.

    Check the man page for the RPM command for the options to the RPM command; "freshen" is an install option, so the options you want will be in that section of the man page.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...