Help!

RPM Package files location

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> PRM - Partner Relationship Management RSS
Next:  RPM questions  
Author Message
Rajeshwaran
External


Since: Jul 10, 2006
Posts: 10



PostPosted: Thu Feb 22, 2007 1:23 am    Post subject: RPM Package files location
Archived from groups: linux>redhat>rpm (more info?)

Hi,

I am just a beginner using RPM Packages. I have a very simple doubt
related to that. I am creating a rpm with a few files. Assume that the
%files section is like this:

%files

/opt/abc/file1.txt
/opt/abc/file2.txt
/opt/abc/file3.txt

So the package is created now. When I install the package in another
machine, these files get installed in the same /opt/abc folder. Can I
reconfigure that to get installed in some other folder?

I hope I am clear in expressing my doubts.

Regards,
Rajeshwaran.A
Back to top
Michal Jaegermann
External


Since: Jun 06, 2004
Posts: 62



PostPosted: Thu Feb 22, 2007 9:03 pm    Post subject: Re: RPM Package files location [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Rajeshwaran <rajeshwaran.a.DeleteThis@gmail.com> wrote:
>
> So the package is created now. When I install the package in another
> machine, these files get installed in the same /opt/abc folder. Can I
> reconfigure that to get installed in some other folder?

See 'man rpm', options '--badreloc', '--prefix' and '--relocate'.
Still in general the answer will be "no; there is a pretty good
chance that you are messing up relationships between different package
files".

Michal
Back to top
Rajeshwaran
External


Since: Jul 10, 2006
Posts: 10



PostPosted: Thu Feb 22, 2007 9:22 pm    Post subject: Re: RPM Package files location [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 23, 2:03 am, Michal Jaegermann <mic....RemoveThis@gortel.phys.ualberta.ca>
wrote:
> Rajeshwaran <rajeshwara....RemoveThis@gmail.com> wrote:
>
> > So the package is created now. When I install the package in another
> > machine, these files get installed in the same /opt/abc folder. Can I
> > reconfigure that to get installed in some other folder?
>
> See 'man rpm', options '--badreloc', '--prefix' and '--relocate'.
> Still in general the answer will be "no; there is a pretty good
> chance that you are messing up relationships between different package
> files".
>
> Michal

Hi,

Would you suggest that I would better install all the files at the
actual location and copy the files in the %post section to wherever I
want. Would that be acceptable?
Back to top
Rajeshwaran
External


Since: Jul 10, 2006
Posts: 10



PostPosted: Fri Feb 23, 2007 11:22 pm    Post subject: Re: RPM Package files location [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 24, 11:09 am, Michal Jaegermann
<mic... RemoveThis @gortel.phys.ualberta.ca> wrote:
> Rajeshwaran <rajeshwara... RemoveThis @gmail.com> wrote:
> > On Feb 23, 2:03 am, Michal Jaegermann <mic... RemoveThis @gortel.phys.ualberta.ca>
> > wrote:
> >> Rajeshwaran <rajeshwara... RemoveThis @gmail.com> wrote:
>
> >> > So the package is created now. When I install the package in another
> >> > machine, these files get installed in the same /opt/abc folder. Can I
> >> > reconfigure that to get installed in some other folder?
>
> >> See 'man rpm', options '--badreloc', '--prefix' and '--relocate'.
>
> > Would you suggest that I would better install all the files at the
> > actual location and copy the files in the %post section to wherever I
> > want. Would that be acceptable?
>
> Why would you want to use rpm then? If you do such things in %post
> then
>
> rpm -V my_package
>
> would report all files as missing and
>
> rpm -e my_package
>
> would not uninstall anything (and similar troubles on updates). If you
> want that just use a script to move files where you want to see them.
> No need to wrap that in an rpm package.
>
> It is far from clear what you _really_ want to do (as opposed to how).
> If you really need to make packages installation dependent then
> a quick 'rpmbuild --rebuild ...' with a "smart enough" spec could be
> your answer.
>
> Michal

Thanks a lot. My understanding of RPM is exactly wrong. Could you just
tell me how do we acheive this using the SPEC file itself. My
situation warrants that I cannot give the --relocate option in the rpm
command. Because we have written a wrapper that installs the RPM
Package. So is there any means by which I can achieve this only by
changing the SPEC files.

Please assume that %files section is like this:

%files


/opt/abc/file1.txt
/opt/abc/file2.txt
/opt/abc/file3.txt

The files file1,file2,file3 exists at the above location. When I
install them they get copied into the same folder structure. But I
want them to be installed in /home/asm/file1.txt and so on.

Please help me out with some descriptive solutions. Thanks a lot for
your help.
Back to top
Michal Jaegermann
External


Since: Jun 06, 2004
Posts: 62



PostPosted: Sat Feb 24, 2007 6:09 am    Post subject: Re: RPM Package files location [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Rajeshwaran <rajeshwaran.a.TakeThisOut@gmail.com> wrote:
> On Feb 23, 2:03 am, Michal Jaegermann <mic....TakeThisOut@gortel.phys.ualberta.ca>
> wrote:
>> Rajeshwaran <rajeshwara....TakeThisOut@gmail.com> wrote:
>>
>> > So the package is created now. When I install the package in another
>> > machine, these files get installed in the same /opt/abc folder. Can I
>> > reconfigure that to get installed in some other folder?
>>
>> See 'man rpm', options '--badreloc', '--prefix' and '--relocate'.
>
> Would you suggest that I would better install all the files at the
> actual location and copy the files in the %post section to wherever I
> want. Would that be acceptable?

Why would you want to use rpm then? If you do such things in %post
then

rpm -V my_package

would report all files as missing and

rpm -e my_package

would not uninstall anything (and similar troubles on updates). If you
want that just use a script to move files where you want to see them.
No need to wrap that in an rpm package.

It is far from clear what you _really_ want to do (as opposed to how).
If you really need to make packages installation dependent then
a quick 'rpmbuild --rebuild ...' with a "smart enough" spec could be
your answer.

Michal
Back to top
Michal Jaegermann
External


Since: Jun 06, 2004
Posts: 62



PostPosted: Sat Feb 24, 2007 8:14 pm    Post subject: Re: RPM Package files location [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Rajeshwaran <rajeshwaran.a.DeleteThis@gmail.com> wrote:
>
> Could you just
> tell me how do we acheive this using the SPEC file itself.

Very simple. Just define a macro, say 'destdir', and use it.
It is far from clear from your description if a spec file can
figure out a value for 'destdir' by itself, from an environment,
by some shell script or whatever. If not then whomever is
doing a sysetem speficig packages can always be explicit:

rpmbuild --rebuild --define='destdir /whatever/you/want' ...

> My situation warrants that I cannot give the --relocate option in the rpm
> command. Because we have written a wrapper that installs the RPM
> Package.

So how this wrapper gets a final location?

> So is there any means by which I can achieve this only by
> changing the SPEC files.

Basically the same as in your wrapper. Examples abound. Look
how in /usr/lib/rpm/macros macros like %requires_eq() or
%perl_sitearch are defined. Syntax is a bit different than in spec
files but definitions the same. Or, say, from some spec file for gimp
plugins:

%define gimpplugindir %(%gimptool --gimpplugindir)/plug-ins

and tons of others if you only look around a bit. You want a wrapper
then make your wrapper rebuild binary packages before installing.
Checking an available documentation also has its uses.

> Please assume that %files section is like this:
>
> %files
>
>
> /opt/abc/file1.txt
> /opt/abc/file2.txt
> /opt/abc/file3.txt

That is exactly and obviously what is wrong with this. That should be:

%{destdir}/file1.txt
%{destdir}/file2.txt
%{destdir}/file3.txt

> The files file1,file2,file3 exists at the above location. When I
> install them they get copied into the same folder structure. But I
> want them to be installed in /home/asm/file1.txt and so on.

If you know this they why all that stuff above??? Just install
with a destination /home/asm and be done with it.

Michal
Back to top
Rajeshwaran
External


Since: Jul 10, 2006
Posts: 10



PostPosted: Sun Feb 25, 2007 8:30 am    Post subject: Re: RPM Package files location [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 25, 1:14 am, Michal Jaegermann <mic... RemoveThis @gortel.phys.ualberta.ca>
wrote:
> Rajeshwaran <rajeshwara... RemoveThis @gmail.com> wrote:
>
> > Could you just
> > tell me how do we acheive this using the SPEC file itself.
>
> Very simple. Just define a macro, say 'destdir', and use it.
> It is far from clear from your description if a spec file can
> figure out a value for 'destdir' by itself, from an environment,
> by some shell script or whatever. If not then whomever is
> doing a sysetem speficig packages can always be explicit:
>
> rpmbuild --rebuild --define='destdir /whatever/you/want' ...
>
> > My situation warrants that I cannot give the --relocate option in the rpm
> > command. Because we have written a wrapper that installs the RPM
> > Package.
>
> So how this wrapper gets a final location?
>
> > So is there any means by which I can achieve this only by
> > changing the SPEC files.
>
> Basically the same as in your wrapper. Examples abound. Look
> how in /usr/lib/rpm/macros macros like %requires_eq() or
> %perl_sitearch are defined. Syntax is a bit different than in spec
> files but definitions the same. Or, say, from some spec file for gimp
> plugins:
>
> %define gimpplugindir %(%gimptool --gimpplugindir)/plug-ins
>
> and tons of others if you only look around a bit. You want a wrapper
> then make your wrapper rebuild binary packages before installing.
> Checking an available documentation also has its uses.
>
> > Please assume that %files section is like this:
>
> > %files
>
> > /opt/abc/file1.txt
> > /opt/abc/file2.txt
> > /opt/abc/file3.txt
>
> That is exactly and obviously what is wrong with this. That should be:
>
> %{destdir}/file1.txt
> %{destdir}/file2.txt
> %{destdir}/file3.txt
>
> > The files file1,file2,file3 exists at the above location. When I
> > install them they get copied into the same folder structure. But I
> > want them to be installed in /home/asm/file1.txt and so on.
>
> If you know this they why all that stuff above??? Just install
> with a destination /home/asm and be done with it.
>
> Michal

Hey Michal,

Thanks for your help. I have been reading abt RPM stuff for just a few
days and your suggestions have really helped me.
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> PRM - Partner Relationship Management All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum