开发者

rpmbuild: how to build the package without %install?

I am trying to build a rpm but unfortunately in my build machine I only have limted permission, which means the operation in %install can't be done inside the build machine. How to build the package(.rpm file) without running %install section? It looks like that no options are available for this purpose:

http://www.rpm.org/max-rpm-snapshot/ch-rpm-b-command.html

My bu.spec file:

Summary: xxxx
Name: xx
Version: 1.0
Release: 1
Group: Applications/Sound
License: Share

%description

%prep
echo "prep"

%build

%install
echo "install"
mkdir -p /opt/xcp_src/
cp scripts.tgz /开发者_开发技巧opt/xcp_src/

%files
/tmp/xcp_src/scripts.tgz

%post
cd /opt/xcp_src/
tar zxvf scripts.tgz


First off, set a buildroot and use that in install, eg:

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
...
%install
mkdir -p %{buildroot}/opt/xcp_src

Second, make sure you can build without being root by moving the RPM build area.

I'd also suggest specifying an actual list of files (rather than having RPM extract a tgz file) as that would make the package cleanly removable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜