Results 1 to 3 of 3

Thread: Building RPM from binary files in tarball

  1. #1

    Default Building RPM from binary files in tarball

    Hi all,

    Our devs have build tools that they want to have installed on all new machines that we roll out. All we (sysadmins) get is tarball containing "projectname" directory with thousands of binary/*.so files inside. Basically what is required is to extract this "projecname" directory into /usr/local/. That's all rpm should do.
    I've been killing myself for past 3 hours trying to accomplish this seemingly simple task... so please help me out.
    What i gathered in spec file i do not need basically anything except %install part where i have to put untar (/usr/bin/tar xf source.tar) command.
    This is my spec:
    Name: projectname
    Version: 2017_1
    Release: %{?dist}
    Summary: Project specific program
    Group: prjectteam
    License: Company
    Source0: %{name}.tar.gz

    %prep
    %setup -n %{name}

    %install
    /usr/bin/tar xf %{name}.tar.gz -C /usr/local/

    I get errors about not finding projectname.tar.gz... according to documentation %prep should actually decompress tarball, but i couldn't figure out how can i put that extracted directory into the /usr/local/

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,106
    Blog Entries
    15

    Default Re: Building RPM from binary files in tarball

    Hi
    The tarball is already extracted in %prep to your buildroot, so check this for all the files, then it would just be a copy to your install location;
    Code:
    %install
    mkdir -p %{buildroot}/usr/local/lib
    cp -ar *.so %{buildroot}/usr/local/lib/
    
    %post /sbin/ldconfig
    
    %postun /sbin/ldconfig
    
    %files
    %defattr(-,root,root,-)
    %dir /usr/local/lib
    /usr/local/lib/*.so
    Change lib to your target directory as required and/or the cp to a directory if required.
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3

    Default Re: Building RPM from binary files in tarball

    Quote Originally Posted by malcolmlewis View Post
    Hi
    The tarball is already extracted in %prep to your buildroot, so check this for all the files, then it would just be a copy to your install location;
    Code:
    %install
    mkdir -p %{buildroot}/usr/local/lib
    cp -ar *.so %{buildroot}/usr/local/lib/
    
    %post /sbin/ldconfig
    
    %postun /sbin/ldconfig
    
    %files
    %defattr(-,root,root,-)
    %dir /usr/local/lib
    /usr/local/lib/*.so
    Change lib to your target directory as required and/or the cp to a directory if required.
    thnx malcolmlewis... i have missed following:
    Code:
    %dir /usr/local/lib
    I thought having only
    Code:
    %files
    %defattr(-,root,root,-)
    /usr/local/lib/
    would be enough... looking at it now makes it very obvious.
    thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •