How can I modify an existing RPM file for installation on a Fedora 11 system

0

I have an RPM that we install on our production systems that I would like to modify so that that the OS installer does not have to make any changes to the system after installation. The distro is pretty old (and sadly we cannot update it to a newer one) - Fedora 11.

Is there a method for me to be able to unpack the RPM, change the file, and then repack it?

Other solutions I have seen make reference to utilities "mock" and "mc" which I do not have.

B. SAUNDERS

Posted 2017-05-15T19:34:55.273

Reputation: 1

2

Fedora 11 is 7 years after EOL. Update to something up-to-date to receive some support.

– Jakuje – 2017-05-16T09:14:59.607

Answers

0

If the rpm package, you want to unpack, is for Fedora 11 or older, the Fedora 11 {rpm, rpm2cpio} can extract the file with e.g. unPack_rpm.sh :

#!/bin/bash
# Purpose: Unpack RPM archives (by @unSpawn)
# Args: /path/to/archive
# Deps: Bash, GNU utils, RPM
rpmDetails() { for Q in changelog provides requires scripts triggers triggerscripts; do 
 rpm -q -p --${Q} "${f}" 2>&1 | grep -v NOKEY > "${Q}.log"; done; }
rpmUnpack() { f=$(readlink -f "${f}"); file "${f}"|grep -q "RPM.v" && \
 { d=$(basename "${f}" .rpm); d="./${d:=ERROR_$$}"; mkdir -p "${d}" && \
 { cd "${d}" && rpm2cpio "${f}" | cpio -idmv && rpmDetails "${f}"; }; }; }
for f in $@; do rpmUnpack "${f}"; done
exit 0

When you have edited the unpacked files, copy the top directory/directories to BUILDROOT/ . When/if rpmbuild -bb name.spec reports "not found", create the folder with the app name asked for inside BUILDROOT/, and copy your files there. And run rpmbuild -bb name.spec again.

My recommended rpmbuild setup : http://www.linuxquestions.org/questions/linux-software-2/need-rpm-package-for-php-version-5-2-7-and-up-on-redhat-5-1-a-766486/#13

Knud Larsen

Posted 2017-05-15T19:34:55.273

Reputation: 641

Thanks, this is quite useful. However, I have a further question: once unpacked, I can modify the file I want to change. Is it just a case of copying the sources (in their directories) to the rpmbuild/SOURCES directory, and then creating/getting a spec file and placing into rpmbuild/SPECS before running the rpmbuild command. Or is there something else I need to do? – B. SAUNDERS – 2017-05-16T14:50:24.677

Not source. The files can actually be copied to any new folder. Or to BUILDROOT/ . See my edited answer. – Knud Larsen – 2017-05-16T16:08:14.693