rpmbuild 可以把源文件或者二进制文件打包成rpm包,rpm包可以放到源上进行分发。
执行rpmbuild --showrc |grep topdir,可以找到rpmbuild 执行的根目录,
如果仅仅希望给把二进制文件打包成rpm包,那么把二进制文件放到 $topdir/BUILD/ 目录下。
编写${binary}.spec
Summary: client
Name: client
Version: 0.6
Release: 1
Vendor: company
License: commercial
Group: Applications/Internet
%description
ols client
used to collect logs from client machine
%install
mkdir -p /apsara/binary
install -m 755 binary /apsara/binary
%post
/apsara/binary --_update_address=http://10.230.201.117:8080 --check_update_interval=1 --check_point_time_out=10 --send_address=http://service.ols.inc.com --domain_socket_address=/tmp/xxxxxxxxxxxxxxxxx
%files
/apsara/binary
%install 字段指的是安装rpm包时执行的命令,
%post字段值得是安装好rpm包后执行的命令。
编写好spec文件后,执行rpmbuild -bb binary.spec
就可以得到rpm包了