fedorarpmbuildrpm-spec

Simple spec file for creating RPM package


I have a binary Java run.jar file, a bash script run.sh which executes run.jar via java -jar.

How can I write the spec file to:

That's all I want. Would you please help me a little?

Thanks for your time.

P.S: I went through this how-to. Unfortunately I'm newbie in this, I couldn't find the solution.


Solution

  • Create ~/.rpmmacros to set up RPM build environment.

    $ mkdir -p ~/rpmbuild/{BUILD,RPMS/{i{3,4,5,6}86,x86_64,noarch},SOURCES,SPECS,SRPMS}
    $ echo "%_topdir $HOME/rpmbuild" > ~/.rpmmacros
    

    And put run.jar/run.sh and spec file into ~/rpmbuild/SOURCES and ~/rpmbuild/SPECS/ respectively.

    EDIT: In a spec file:

    (skip)
    
    Source0: run.jar
    Source1: run.sh
    
    (skip)
    
    %install
    
    %{__mkdir_p} ${RPM_BUILD_ROOT}/path/to/my-package
    
    %{__install} -m0644 %{SOURCE0} ${RPM_BUILD_ROOT}/path/to/my-package
    %{__install} -m0644 %{SOURCE1} ${RPM_BUILD_ROOT}/path/to/my-package
    
    (skip)
    
    %files
    /path/to/my-package/*