本文以重编xx-nonfree-radeon-7-1.noarch.rpm 为例
准备工作:
download xx-nonfree-radeon-7-1.noarch.rpm 到本地
安装步骤:
# install epel
#rhel7
sudo yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm
#rhel8
sudo yum install https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/e/epel-release-8-13.el8.noarch.rpm
#install rpmrebuild
sudo yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/r/rpmrebuild-2.11-3.el7.noarch.rpm
rpmrebuild -e -p
会打开一个spec的vim文件,将.spec的文件另外保存(e.g:xx-nonfree.spec)
然后将.spec 文件cp 到rpmbuild/SPECS目录等待使用。
rpmrebuild -e -p xx-nonfree-radeon-8-1.noarch.rpm
3.解压原版RPM包,具体命令如下所示:
#在rpmbuid/BUILDROOT 目录创建新rpm 包的名字。然后解压文件
cd ~/rpmbuild/BUILDROOT/
mkdir -p xx-nonfree-radeon-7-1341997.el8.x86_64 ----这个名字需要和.spec定义的一至
cp -rf xx-nonfree-radeon-7-1.noarch.rpm .
rpm2cpio *.rpm | cpio -idv
4. rpmbuild 重新build rpm包
如果需要修改文件,根据需求替换修改rpm解压出来的文件及修改对应的spec文件,修改完成后,到~/rpmbuild/SPECS/执行build命令:
rpmbuild -ba xx-nonfree.spec
重新生成的RPM包在~/rpmbuild/RPMS/