Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I need to create a RPM package to ditribute files. I have a folder like this: data |-img/ |-*.jpg |-exe/ |soft.exe I just want to package it in rpm. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2013
    Posts
    2

    Making RPM for files distribution


    Hi, I need to create a RPM package to ditribute files.
    I have a folder like this:

    data
    |-img/
    |-*.jpg
    |-exe/
    |soft.exe


    I just want to package it in rpm. This rpm is only for my customers. And it should copy img and exe in samba folder at the installation. The samba folder is /samba


    Thank you

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    hello and welcome, fstn!

    Here is a good tut on making RPMS, one that I revisit a lot.

    Here's one tip, before you get started: use an editor that has syntax highlighting for RPM macro files. VIM is the one I use and is surely already on your system. What is great is that it has a built-in macro that will prepopulate a blank RPM SPEC file with most of the stuff you need, you just fill in the details (RPM name, version, description, etc.).

    basically, you'd just do this:
    Code:
    vim ~/rpms/SPECS/foo.spec
    and, assuming foo.spec did not already exist, a new skeleton SPEC file will be inserted into VIM's buffer for you.

    as to your specific request, you'll want to make sure that in the %install section of the macro, you make the required dirs, and copy your files there. something like this:

    Code:
    %install
    rm -rf %{buildroot}
    mkdir -p %{buildroot}/samba
    cp data/img/*.jpg %{buildroot}/samba/
    cp data/exe/*.exe  %{buildroot}/samba/
    also, any files installed in the %install section need to be listed in the %files section. this should suffice.
    Code:
    %files
    /samba/*
    you'll probably also need to figure out how to properly uncompress your original source tarball, during the %prep/%setup section of the SPEC file.

    to build an RPM:

    Code:
    rpmbuild -bb ~/rpms/SPECS/foo.spec
    be sure to read the above tut, you'll need to do that to set up your environment properly and help you get your source tarball sussed out and all that.

  3. #3
    Just Joined!
    Join Date
    Jul 2013
    Posts
    2
    Ho thank you, it's work.
    I didn't understand that %install it's done at the compilation. I thought that it was on client.


    Regards

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    great, glad you got it sorted. i'll go ahead and mark this as Solved for you. Note that you can do this yourself using the Thread Tools link at the top of the page.

Posting Permissions

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