xfs
[Top] [All Lists]

RPM building as non-root

To: SGI XFS Dev List <linux-xfs@xxxxxxxxxxx>
Subject: RPM building as non-root
From: Alan Eldridge <alane@xxxxxxxxxxxx>
Date: Wed, 11 Jul 2001 10:16:00 -0400
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Mutt/1.2.5i
Since it's a pseudo-FAQ, here's a short bit of text I wrote on building RPMs
as non-root. It uses the two files rpmrc and macros, which accompany this
message.

Build RPMs at $HOME and EARN BIG $$$:
=====================================

Building RPMs as root is a nasty business. Try using the option
"--buildroot=/" if you don't believe me.

(You didn't really do that, did you? Oh, well, I guess you had
it coming...)

You can build RPMs in your own $HOME, logged in as $USER, in almost
all cases. (For builds that want to create device nodes, there's the
Debian program "fakeroot", but that's beyond the scope of this
little tidbit.)

First, create your build dir. Let's say it's "$HOME/rpm". That's 
how the sample files are set up.

        mkdir $HOME/rpm
        mkdir $HOME/rpm/{SPECS,SOURCES,SRPMS,RPMS,BUILD,tmp)
        mkdir $HOME/rpm/RPMS/{athlon,i386,i486,i586,i686,noarch}

Next, copy the supplied sample files to ~/rpm, and link the
rpmrc file to your $HOME.

        for i in rpmrc macros; do
                cp /path/to/rpm.$i ~/rpm/$i
        done
        cd $HOME
        ln -sf rpm/rpmrc .rpmrc

Finally, edit the $HOME/rpm/macros file and insert
your $HOME dir for the value of the %home macro.


A NOTE FOR REDHAT 7.X USERS:

RedHat ships with a library from AT&T Research called libsafe. 
Some (many?) of you will have it installed. It places a hook in
/etc/profile.d, so that when you log in, the LD_PRELOAD variable
is set to point to the libsafe.so library.

Libsafe is wonderful. It prevents all sorts of nasty things like
stack smashing from happening, by complaining and core dumping 
*before* the damage happens.

Don't use libsafe with mozilla, or netscape, or ... rpm. The 
LD_PRELOAD environment variable confuses rpm's auto-dependency
logic, and any binaries or libraries you compile will get a
libsafe.so entry in the "Requires" list. You do *not* want this.

Make a small script called "rpm", and put it in $HOME/bin, or 
somewhere else on your $PATH before /bin. 

This code is all you need:

        #!/usr/bin/env bash
        unset LD_PRELOAD
        unset LD_LIBRARY_PATH
        exec /bin/rpm ${1:+"$@"}

That's it. You're now ready to MAKE RPM$$$ FA$$$T!!!



-- 
Alan Eldridge
from std_disclaimer import *

Attachment: rpm.rpmrc
Description: Text document

Attachment: rpm.macros
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>
  • RPM building as non-root, Alan Eldridge <=