Skip to content
Advertisement

Install Section of rpm package

I am naive on creating RPM packages.

I want to know the meaning of below command:

BuildRoot: %{_tmppath}/build-%{name}-%{version}

      %install
      rm -rf "%{buildroot}"
      install -m 0755 -d "%{buildroot}%{_prefix}"
       %__install -D -m0644 "%{SOURCE0}" "%{buildroot}%{_prefix}/ROOT.war"

%files
%dir %{_prefix}
%{_prefix}/ROOT.war

Advertisement

Answer

in the %install section, you are supposed to install all your files in the %{buildroot] directory; just the way they will be installed on the final system.

rm -rf "%{buildroot}"

he cleans this directory. I never use this; since my buildroot is unique for each of my packages. (using BuildRoot: %{_tmppath}/%{name}-%{version}-build in the beginning of my spec file)

install -m 0755 -d "%{buildroot}%{_prefix}"

there seems to have been a %{_prefix} variable declared; he just creates that directory. Probably %{_prefix} is reused in the %files section then.

%__install -D -m0644 "%{SOURCE0}" "%{buildroot}%{_prefix}/ROOT.war"

here the file %{SOURCE0} is installed (copied) to the %{buildroot}%{_prefix} directory. So in the %files section I would expect a line like this:

%files
%{_prefix}/ROOT.war

meaning that the ROOT.war file is to be packaged in that rpm.

EDIT the %__install -D command just expands to /usr/bin/install -D (see defined macros)

the -D option is explained in the install man page:

-D
create all leading components of DEST except the last, then copy SOURCE to DEST

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement