歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux教程

RPM打包

搭建獨立的rpm打包環境
在home目錄下建立配置文件,並建立好相應的目錄

cat >${HOME}/.rpmmacros<<EOF
%_topdir %(echo $HOME)/rpmbuild
EOF
mkdir ${HOME}/rpmbuild/
cd ${HOME}/rpmbuild/;mkdir BUILD  RPMS  SOURCES  SPECS  SRPMS

一個用於打包tar包的spec文件

Name:         xx
Version:      0.19.1
Release:      20130814
Buildarch:    noarch
Vendor:      leileisyh
Group:        SOME_GROUP
Summary:      Hadoop Client for Yunti Hadoop Gateways
License:      Commercial
BuildRoot:    %{_tmppath}/%{name}-%{version}-%{release}-build
Prefix:       /home/xx
AutoReqProv:  no
Requires:     yyy = 版本-發布號
 
%description
Something
 
%prep
%define  __os_install_post %{nil}
%define  _prefix           %prefix
 
%build
[ -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT} && mkdir -p ${RPM_BUILD_ROOT}
 
%install
mkdir -p ${RPM_BUILD_ROOT}%{_prefix} && tar -xzf /tmp/xx.tgz -C ${RPM_BUILD_ROOT}%{_prefix} || exit 1
 
%files
%defattr (-,root,root,-)
%{_prefix}
Copyright © Linux教程網 All Rights Reserved