安装打包工具
yum install rpm-build rpmdevtools
创建安装目录
rpmdev-setuptree
会产生如下的目录列表:
BUILD
BUILDROOT
RPMS
SOURCES
SPECS
SRPMS
修改 macros
将/usr/lib/rpm/macros中的如下行注释
#%__check_files %{_rpmconfigdir}/check-files %{buildroot}
拷贝二进制
将编译好的二进制文件拷贝到BUILD目录下
编写SPEC 文件
在SPECS目录以下用例模板
Name: spice-server
Version: 1.0.0
Release: 1%{?dist}
Summary: spice server rpm
License: free
#Requires:
%description
spice-server
%install
mkdir -p ${RPM_BUILD_ROOT}/usr/local/lib/
cp -f libspice-server.so.1.14.2 ${RPM_BUILD_ROOT}/usr/local/lib/
# 安装完成后执行
%pre
yum install -y pixman-devel
yum install -y libjpeg-turbo-devel
yum install -y openssl-devel
yum install -y zlib-devel
yum install -y cyrus-sasl-devel
yum install -y gstreamer-devel
yum install -y gstreamer1-devel
yum install -y gstreamer1-plugins-base-devel
yum install -y opus-devel
yum install -y lz4-devel
%post
rm -rf /usr/lib64/libspice-server.so.1
ln -s /usr/local/lib/libspice-server.so.1.14.2 /usr/lib64/libspice-server.so.1
# 卸载时执行
%postun
rm -rf /usr/local/lib/libspice-server.so.1.14.2
# 规定那些文件必须放入安装程序中,如果没有就报错
%files
/usr/local/lib/libspice-server.so.1.14.2
%defattr(-,root,root)
# 卸载时执行
%postun
rm -rf /usr/local/lib/libspice-server.so.1.14.2
# 规定那些文件必须放入安装程序中,如果没有就报错
%files
/usr/local/lib/libspice-server.so.1.14.2
%defattr(-,root,root)
打包
rpmbuild -bb SPECS/spice-server.spec文章来源:https://www.toymoban.com/news/detail-684124.html
打包文件的目录
打包文件在RPMS目录下文章来源地址https://www.toymoban.com/news/detail-684124.html
到了这里,关于root 用户下二进制rpm包制作的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!