0

I have a script I'm using to install some rpms in my docker image which is shown below.

yumdownloader common-jars-${RELEASE_VERSION} \
              test-jars-${RELEASE_VERSION} \
rpm -ivh --force --nodeps --prefix /usr/local/integrations *rpm && \
rm -rf *.rpm && \
rm -rf /var/lib/yum/yumdb

This results in the contents of each rpm file being loaded into /usr/local/integrations.

Is there any issue with me later copying the contents of /usr/local/integrations to another directory and using them there? I'm concerned that maybe the rpm -i command will be doing some things under the covers that a regular cp would not account for.

I can't change the script right now as it is part of a deployment process that's been in place a very long time. I just want to understand whether a cp or mv of these files will still allow them to function correctly.

conorgriffin
  • 459
  • 1
  • 6
  • 25
  • Take a look at your particular rpms and see what they do. For example: https://blog.packagecloud.io/eng/2015/10/13/inspect-extract-contents-rpm-packages/ – Brandon Xavier Jul 24 '17 at 10:58

1 Answers1

2

Doing it that way negates most the the advantages of using packages.

  • Fix the package to put its files where you want them. That way if you use rpm to verify files it will checksum the files in use.
  • Only install with yum. It is safer in several ways, including installing dependencies.
  • Do not remove yumdb or rpmdb. Maybe you want to reduce the size of the container, but I don't see the point of removing the package lists.
  • Do not use --nodeps. Either those are legit dependencies and you will break your system, or they do nothing for you and it would be better to rebuild the package without them.

One side effect of these is that you won't be able to relocate where the packager is by changing the prefix at install time, just package build time. Very few distributions or packages use this feature, so I don't think you are losing much.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34
  • Thanks, I've updated the question though. What I really want to know here is whether a `cp` or `mv` of these files is an OK thing to do. I can't change the script right now to use `yum` or otherwise alter the `rpm` parameters. I just want to know if I'm going to run into issues by moving or copying these files to another location and using them from there. – conorgriffin Jul 25 '17 at 08:58
  • If you are not using rpm features you might as well `rpm2cpio` to extract the files you want. `mv` causes `rpm --verify` failures. `cp` leaves package files intact but you are no longer tracking installed files with rpm. – John Mahowald Jul 25 '17 at 12:38