安裝打包工具
yum install rpm-build rpmdevtools
創(chuàng)建安裝目錄
rpmdev-setuptree
會產(chǎn)生如下的目錄列表:
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/
# 安裝完成后執(zhí)行
%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
# 卸載時執(zhí)行
%postun
rm -rf /usr/local/lib/libspice-server.so.1.14.2
# 規(guī)定那些文件必須放入安裝程序中,如果沒有就報錯
%files
/usr/local/lib/libspice-server.so.1.14.2
%defattr(-,root,root)
# 卸載時執(zhí)行
%postun
rm -rf /usr/local/lib/libspice-server.so.1.14.2
# 規(guī)定那些文件必須放入安裝程序中,如果沒有就報錯
%files
/usr/local/lib/libspice-server.so.1.14.2
%defattr(-,root,root)
打包
rpmbuild -bb SPECS/spice-server.spec文章來源:http://www.zghlxwxcb.cn/news/detail-684124.html
打包文件的目錄
打包文件在RPMS目錄下文章來源地址http://www.zghlxwxcb.cn/news/detail-684124.html
到了這里,關(guān)于root 用戶下二進制rpm包制作的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!