How to "repackage" an RPM file, for example, cpio2rpm without installing RPM?

  • I can extract files from an RPM file, but how to "rebuild" it, for example cpio2rpm?
  • I extracted the RPM file using the following command. rpm2cpio theFileName.rpm | cpio -idmv
  • I need to modify several web application files such as * .php, * .html or .js. These files do not require recompilation of the source. Therefore, I would like to replace or modify these files with the change without rpm recovery. Because, I need to do this for multiple platforms such as Redhat Linux and SUSE, and multiple architectures such as 32-bit and 64-bit OS.
  • I expect that I will make these changes only on the system and will not restore rpm, and will not depend on the system architecture (for example, i386, 64).
  • I am not like the rpmbuild -rebuild the.src.rpm command since I have no source. I need to rebuild the binary .RPM file (not the original .rpm)
  • I want to do this without a source and independent of the platform or architecture, and without using a special file.

    Any buddy, could you suggest any solution or any free tools.

    Thanks to everyone who spends time to read and answer my topic.

+5
source share
3 answers

You can use rpmrebuild to modify the real rpm file (it does not need to be installed).

, . , script rpm, .

rpmrebuild -ep theFileName.rpm

RPM. ~/.tmp/rpmrebuild.12839/work/spec.2. , ~/.tmp/rpmrebuild.12839/work, , RPM ( root/usr/sbin ). , , cd , .

, spec, ( , ), "y" " ". RPM , ( , ~/rpmbuild/RPMS/x86_64/)

+12

RPM ( ) rpmrebuild. http://rpmrebuild.sourceforge.net/

, ( ) / , , , , .

+1

Basically, you can pack whatever you want into an RPM file. Just treat what you have as a "source" and write a SPEC file that puts the data into which compiled binaries are usually sent.

Regarding RPM, I consider the “source” “what I have” and the “binary” “what I need to run”. Not very accurate terminology, but it helps to work with RPM.

Your spec file looks like any other spec file in terms of parameters, etc. But part of the code is different:

[...]
%prep
# Here you either have nothing to do or you already unpack the cpio and possibly modify it.

# %build can be omitted

%install
[ "${buildroot}" != "/" ] && [ -d ${buildroot} ] && rm -rf ${buildroot};
# Here you can either unpack the cpio or copy the data unpacked in %prep.
# Be careful to put it into %{buildroot} or $RPM_BUILD_ROOT.
0
source

All Articles