0
votes

I have a spec file written to create rpm package where I am extracting tomcat package and jre. I have below sections in my spec file.

Source0:        jre-8u181-linux-x64.tar
Source1:        apache-tomcat-8.5.15.tar.gz

%prep
%setup -c -T -a 0 -n jre/1.8.0_181
%setup -D -c -T -a 1 -n apache-tomcat/8.5.15

which is extracting my tomcat package into "apache-tomcat/8.5.15/apache-tomcat/". But I want to strip last directory, as I want the folder structure to be "apache-tomcat/8.5.15".

How can I do that with %setup macro. Can someone help with this. Thanks, R Dama.

1

1 Answers

3
votes

that is not how the %setup macro works. You can check the documentation here.

the -n parameter of the %setup macro allows you to specify the top directory of your source file where you want to start your operations. You cannot change the content of that tgz file on the fly.

If you want to change where these files are installed, then you should change or rename the files/folders inside the %install section.