LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-24-2006, 07:04 PM   #1
terp4life2001
LQ Newbie
 
Registered: Dec 2005
Posts: 26

Rep: Reputation: 15
Using RPM to install binaries


Hi everyone,

I'm trying to use RPM to install a few libraries and applications. The libraries and binaries are allready built and all I want RPM to do is some installing and soft linking. My problem currently is that rpmbuild is expecting my files to be in /usr/src/redhat/SOURCES/ which they are not, is this a hard requirement?

What I'd like to do is have a build directory (on my build machine) where the libs and bins are placed. For example,

foo/build/lib/libA.so
foo/build/lib/libB.so
foo/build/bin/appY.so
foo/build/bin/appZ.so

and I'd like to have a spec file at say, the foo/ level that grabs these libs and bins and installs them on the target system at,

/usr/bin/appY.so
/usr/bin/appZ.so
/usr/lib/foo/libA.so
/usr/lib/foo/libA.so

It seems to me that rpmbuild is expecting the files to exist at the same location on the build server as they would be when installed on the target system. I've even played around with relocatable .rpms, but I haven't had much luck.

Even though I seem to describe the abilities of a self-extracting .zip file (don't know if they exist on Linux) I think I want to use RPM so that I can keep track of updates and whatnot.

Can anyone help? Thanks in advance,

//Rob
 
Old 01-24-2006, 07:48 PM   #2
card-suse
Member
 
Registered: Dec 2005
Location: Ohio, USA
Distribution: OpenSuSE 10.2
Posts: 74

Rep: Reputation: 15
The way I believe RPM works is that it installs the files on your system based on your make install settings from your makefile. The files that it includes in your binary package are specified in the %files section of your spec file. Did you have a chance to read:
http://www.rpm.org/max-rpm/ch-rpm-basics.html

I think they way to do what you are trying to do is to leave the default directory structure and create a spec file in /usr/src/redhat/SPEC leaving the %prep, %build, %install sections blank and specify the files you want to install in your %files section on the build machine. (I'm assuming in your post you have a bunch of libraries already installed on your build machine that you would like to install on your target machine. I'm kinda confused here??) Then, on your target machine you could setup links as part of a preinstall process that maps foo/build directories to the directories on your target machine (You can write a preinstall script as part of the RPM package that will do this). For example, on your target machine:

ln -s /usr/bin foo/build/bin
ln -s /usr/lib/foo foo/build/lib

When the binary RPM is installed on your target system it should install the files in the appropriate places. Never tried it. Seems like it would work in theory. Ultimately, I don't think you need RPM for this unless your just trying to keep track of stuff you installed on your target machine. A tar file would suffice with the link strategy I'm describing above. Hope this helps....

BTW. I believe changing the default build directories on your target machine (in your case /usr/source/redhat) involves modifying the /usr/lib/rpm/macros or /usr/lib/rpm/rpmrc files which specify the GLOBAL default system settings. You likewise can add a ~/.rprmc file in your home directory for your own private settings. Give 'er a look...

Last edited by card-suse; 01-24-2006 at 10:01 PM.
 
Old 01-25-2006, 11:37 AM   #3
terp4life2001
LQ Newbie
 
Registered: Dec 2005
Posts: 26

Original Poster
Rep: Reputation: 15
RPMs

Thanks for the input.

I have read the Maximum RPM online book as well as two other HOW-TOs on the rpm.org site. I am using RPMs so that I can keep track of versioning information otherwise I would just use a tarball and a sh script.

The problem boils down to this; for any given file, say libN.so, I would like it to reside in /a/b/c/libN.so after it is built on the build server and then have it installed to /x/y/z/libN.so.

This way say a non-root user builds the library in his user space /home/user. Say that when it is installed it should be installed to /bin. The user doesn't have the adequate permissions to install his file to /bin on his build server. The root user on the target system would be able to install it there without a problem.

It seems to me that the RPMs force you to package the files at the same location they are to be installed to. I have found no way to say, "package the files from /a/b/c/ but install them to /x/y/z/"

Thanks,

//Rob
 
Old 01-25-2006, 08:47 PM   #4
card-suse
Member
 
Registered: Dec 2005
Location: Ohio, USA
Distribution: OpenSuSE 10.2
Posts: 74

Rep: Reputation: 15
Got it now. You mention that you tried using a relocatable rpm and that would seem like the way to go. I have not tried that option yet, but what specifically did you do? From everything I read, the steps would be:

1) Specify a Prefix tag in your .spec file
2) Specify a new prefix in the install through the --prefix flag.

In your original post, it seems like you could use the the tag:

Prefix: foo/build

in your .spec file when you build your package. Then, when you install it on your target system it should be a simple matter of:

rpm -i --prefix /usr <package name>

That should remap all the foo/build to /usr which should work unless you have files on your build system other than ones that start with foo/build. Is that what you tried? You seem like you know what your doing, so I'm just throwing this out there for you.

Also, did you look into the tag BuildRoot? You could use this instead. I think of it like the inverse of the prefix option where you respecify the install location on the build system (in your case foo/build), but the package builds normally on the target system as specified in the %file section of the .spec file.
 
Old 02-01-2006, 02:05 AM   #5
Smokin
LQ Newbie
 
Registered: Feb 2006
Posts: 3

Rep: Reputation: 0
rpmmacro

I have been searching for help on src.rpm.
I came across an articl that may fix your problem.
Here is the guts of the relevant stuff
The article is at w**.redhat.com/archives/rpm-list/2002-February/msg00030.html

QUOTE:
Create an .rpmmacros file to instruct rpm to build in a directory off your
home directory. (This version of .rpmmacros could also be placed in
/etc/skel/.bashrc)

cd
cat <<EOF > .rpmmacros
%HOME %{expand:%%(cd; pwd)}
%_topdir %{HOME}/rpm
EOF

2. Create the rpm directory structure in your home directory:

mkdir rpm
cd rpm
mkdir BUILD RPMS SOURCES SPECS SRPMS
cd

3. Download the .src.rpm to your home directory."Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to install 5.01 binaries?? kartheekpn Linux - Software 1 09-05-2005 05:32 PM
binaries versus RPM durvasa Linux - Newbie 6 05-19-2004 02:27 PM
need compilers, other stuff to dl, compile from source or rpm binaries - Mandrake 9.1 Kristal Mandriva 6 09-02-2003 10:03 PM
How to install binaries ? pelgrim Linux - Newbie 8 03-18-2003 08:55 AM
rpm / binaries ? nimrod Linux - Newbie 3 12-17-2002 04:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration