1. Installation and mounting rpmbuild rpmrebuild
rpmrebuild Download Link: https://sourceforge.net/projects/rpmrebuild/files/rpmrebuild/
rpmbuild mounted directly yum: yum install rpmbuild
2. Configure rpm build directory
we ~ / .rpmmacros
%_topdir /data/rpmbuild
Save.
3. Create a directory to extract the rpmrebuild file / data / rpmbuild in
mkdir -p /data/rpmbuild && cd /data/rpmbuild
mkdir ./BUILDROOT
mkdir ./SPECS
cd /data/rpmbuild
mkdir tools
cp rpmrebuild-2.14.tar.gz ./tools/
cd tools
tar -zxvf rpmrebuild-2.14.tar.gz
cd ..
4. Installation Preparation repackaged rpm (e.g.: rpm-build)
rpm -ivh rpm-build-4.11.3-40.el7.x86_64.rpm
5. decompile extract SPEC file
View # rpm installation name
rpm -qa|grep rpm-build
cd /data/rpmbuild
# Rpm-build-4.11.3-40.el7.x86_64 to see the name of the installation rpm
./tools/rpmrebuild.sh -s SPECS/rpm-build.spec rpm-build-4.11.3-40.el7.x86_64
6. replace or modify files in the package rpm
## extract the original RPM package
cd /data/rpmbuild
rpm2cpio rpm-build-4.11.3-40.el7.x86_64.rpm |cpio -idv
According to replace the modified files after decompression demand
#bbb is /data/rpmbuild/SPECS/abc.spec get through the command rpmbuild
mkdir -p /data/rpmbuild/BUILDROOT/bbb/
After the file modification command rpm extract out through to the next are moved mv / data / rpmbuild / BUILDROOT / bbb / directory
7. Modify abc.spec
we /data/rpmbuild/SPECS/abc.spec
For example: The original content
%attr(0644, root, root) "/usr/lib/123.jar"
Delete this jar add a new package of rights and 456.jar 0644 user is the root user group is also root
Delete% attr (0644, root, root) "/usr/lib/123.jar"
Increase% attr (0644, root, root) "/usr/lib/456.jar"
Save aba.spec
8. The package compiled RPM, RPM generated position / data / rpmbuild / RPMS /
rpmbuild -ba /data/rpmbuild/SPECS/abc.spec
Source: Keyword Positions