Subject: Re: "make install" owerwrites files without asking
To: Jeremy C. Reed <reed@reedmedia.net>
From: Pavel Cahyna <pcah8322@artax.karlin.mff.cuni.cz>
List: tech-pkg
Date: 06/30/2005 18:29:00
On Thu, Jun 30, 2005 at 09:20:48AM -0700, Jeremy C. Reed wrote:

> If you have to patch it to do allow setting the destination directory,
> then there should be little difference in patching it to use the INSTALL_*
> scripts at the same time.

But it is quite likely that most of packaged software allows it today and
no patching is required for them.

> (I don't know how many there are.)

Marc Espie says:

"You just need to tweak the install process so that stuff goes into
fake/usr/local/bin instead of /usr/local/bin, for instance. In many modern
software, you just need to set DESTDIR=fake. In other cases, this is a bit
more complicated. A lot of Makefiles use variables like
bindir=/usr/local/bin to specify where a binary should go. Well, if you
execute make bindir=/fake/usr/local/bin, then the value you set on the
command line will override the Makefile contents.

Together, these solve 99% of all package installs."

> > $ fakeroot
> > bash-2.05a# mkdir fakeroot
> > bash-2.05a# chown root:root fakeroot
> > bash-2.05a# cd fakeroot
> > bash-2.05a# touch login
> > bash-2.05a# chown root:root login
> > bash-2.05a# chmod 4555 login
> > bash-2.05a# ls -l login
> > -r-sr-xr-x    1 root     root            0 Jun 30 18:05 login
> 
> I will have to try this myself. How did the chown work?

You mean the implementation? It just called chown() syscall, which was
intercepted by fakeroot.

> Please run "id" here.

$ fakeroot
bash-2.05a# id
uid=0(root) gid=0(root) groups=100(users)
bash-2.05a# 

Bye	Pavel