[lug] rpm build question

Sean Reifschneider jafo at tummy.com
Wed Dec 11 23:30:44 MST 2002


On Wed, Dec 11, 2002 at 03:36:48PM -0600, Michael J. Hammel wrote:
>post-install steps that allow you to script what should be done.  You
>should look for these pre- and post-install steps for RPM to do what
>you're trying here.  

That's not a very good way of going about it, because you're effectively
circumventing the RPM to make it happen.  Either you're installing the
man page in a different location and then moving it (which means an "rpm
-V" will complain that the file is missing), or you're trying to do
something similar.

The correct way (IMHO) is to use a %if to control wether that file is
installed.  For example, say you want to only install a "alias.1" man
page if it doesn't exist...

At the top of the .spec file do:

   %define hasaliasman %(if [ -f /usr/share/man/man1/alias.1.gz ]; then echo 1; else echo 0; fi)

You could also check /etc/redhat-release or the like, whatever.  Then in
the %install section you would do something like:

   %if %{hasaliasman}
   cp alias.1 $RPM_BUILD_ROOT/usr/share/man/man1
   %endif

and similarly in the %files section:

   %if %{hasaliasman}
   /usr/share/man/man1/alias.1*
   %endif

That way when you build the SRPM on your system it detects what is going
on (in some cases, of course -- if you don't have the other package
installed and are looking for that file it won't be there of course --
checking releases may be preferable, you decide).

Sean
-- 
 "Bill and Ted on cryptography: If you are really us...  What number are we
 thinking of?" -- Sean Reifschneider, 1998
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995.  Qmail, Python, SysAdmin



More information about the LUG mailing list