Russell Coker <russell(a)coker.com.au> writes:
On Tue, 25 Aug 2015 18:12:14 Sean Crosby wrote:
I'm not aware of one, but is there a way to
redirect file open calls for
/path1/file1 to /path2/file2 in a script? It only has to be for file
open/read calls, and not write. The /path1 filesystem is not writeable by
the user.
This is something that you could do with LD_PRELOAD. There's probably a
module out there to do it already if you google it, but if not it's not that
hard to write if you've good at C coding.
fakeroot(1) can do this, I think.
LD_PRELOAD is one of the available strategies.
As used by Debian to build packages,
it basically says:
Anytime you try to do something that's not allowed,
I'll claim that I did it, and remember (inside myself) what was done,
so if you e.g. install a file then read it, I'll act like it worked.
But outside me, nothing has actually changed.
It can persist its sate between runs.
Ref.
http://manpages.debian.org/cgi-bin/man.cgi?query=fakeroot