문제

I am confused about some directories in rpmbuild.

1: buildroot: which should be used to store the files that are supposed to be installed when the binary package is installed by an end-user.

Questions: how to control this directory? What does BuildRoot mean?

 $ cat 3.spec
 ..
 BuildRoot: /opt/abc
 ..
 %prep
 echo %{buildroot}
 echo  $RPM_BUILD_ROOT   

whatever I set the BuildRoot to, I get the result which was defined in /usr/lib/rpm/macros. If I define %buildroot in ~/.rpmmacros, I will get the result from it.

2: How do I control the destination when we install the rpm package? For example: rpm -ivh xxx.rpm, where the files will be installed?

도움이 되었습니까?

해결책

You create the subdirectories yourself in %install or wherever.

Example: You want to install all your files in /opt/mypkg/ but also want a config file /etc/mypkg.conf. So in the %install section you:

mkdir -p %{buildroot}/opt/mypkg
mkdir -p %{buildroot}/etc

So you are re-creating the tree that you want installed, all with %{buildroot} as the equivalent of the target's /.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top