2

I have looked all over the Internet for an answer on this and am unable to get anything for it. I am building my own RPM and I need it to unpack certain files to specific directories. These directories belong to user support and should therefore be mapped to: ~/exporttool, ~/bin, and ~/jlog (/home/support/directory). But when I run the command to build the rpm:

rpmbuild -v -bb SPEC/supportScripts.spec

I get this:

File not found: /root/rpmbuild/BUILDROOT/supportScripts-0.1-1.x86_64/home/support/exporttool/cmd2
File not found: /root/rpmbuild/BUILDROOT/supportScripts-0.1-1.x86_64/home/support/exporttool/cmd
File not found: /root/rpmbuild/BUILDROOT/supportScripts-0.1-1.x86_64/home/support/exporttool/cmd8
File not found: /root/rpmbuild/BUILDROOT/supportScripts-0.1-1.x86_64/home/support/exporttool/exportToTransferSyntax.sh

I have in this link the spec file. Can someone please tell me what I am doing wrong and how can I configure the spec file to map correctly to /home/support/directoryOfWhereFilesShouldGo

1

RPM should never be used to install software into the /home directory. This is just a bad idea. RPM should only be used for directories that are system managed (/bin, /usr/bin, etc.).

Rather this software should be installed under one of those directories and:

  1. Symbolic links could be made to them, or
  2. The tools once installed into, say /usr/bin, would be made available through the system's $PATH.

Whenever you're trying to do something in Linux/Unix and you find you're having a difficult time in doing it, you should take a step back. This is the architecture/system telling you something. You're likely doing something that you shouldn't be doing, and you're working against how it was designed to be used.

spec file

The %install macro doesn't make sense to me in its current form.

%install
mkdir -p %buildroot/%name
tar -xvf /home/vagrant/rpm/SOURCE/supportScripts-1.tar
mkdir /home/support/exporttool
mkdir /home/support/bin
mkdir /home/support/jlog

Why are you mkdir'ing these directories after you untar the tarball? Why are you even making them? If they're included in the tarball then this is unnecessary. If these directories are not included in the tarball then they're just empty and the error you're receiving is telling you this.

File not found: /root/rpmbuild/BUILDROOT/supportScripts-0.1-1.x86_64/home/support/exporttool/cmd2

There is no cmd2 file included since it wasn't in the tarball or produced during the %install.

You can confirm this by checking the inventory of the tarball:

$ tar tvf /home/vagrant/rpm/SOURCE/supportScripts-1.tar | \
    grep -E 'support/{exporttool,bin,jlog}'
  • i will explain more about what i was trying to accomplish when i have access to my PC – ryekayo Sep 17 '14 at 11:59
  • what I am trying to do is this: I have quite a few scripts in our servers that are used on a user account called support. These scripts are mainly found in the directories: /home/support/exporttool, bin, and jlog. I was hoping to unpack the scripts in those directories. But if you say thats not a good idea, i will consider that and look into unpacking them in the /usr/bin and creating a link for them. – ryekayo Sep 17 '14 at 13:39
  • @ryekayo - that is how I would do it as well. I would actually put it on the path for them. Standards are useful in both keeping things consistent, but also for making things easier for others to pick up and support later on. When you're building things such as this, think of some future sysadmin or developer that will have to make heads or tails of what you did. – slm Sep 17 '14 at 13:53
  • thanks for the advise! I am still learning this stuff as I go :) – ryekayo Sep 17 '14 at 13:54
  • 1
    @ryekayo - we're all "still" just learning 8-) – slm Sep 17 '14 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.