[lsb-discuss] Binary relocatability

Dan Kegel dank at kegel.com
Thu Mar 6 13:48:16 PST 2003


Mike Hearn wrote:
> One other problem is obviously, how do you know what the prefix actually
> is? We're looking it up in a database, but how does an app know if it
> was installed via rpm/deb/emerge/autopackage/foo-installer, and how can
> we abstract this information?
> 
> Is building such a library even a good idea? Maybe this would be better
> addressed at a lower level, maybe setting an environment variable or
> something when a file is executed, so bypassing package managers
> entirely.

/proc/self/exe totally solves it for binaries.

Script interpreters should already have solutions.  For instance,
posix sh uses $0 as follows:

$ cat ~/bin/joe.sh
#!/bin/sh
echo joe is $0

$ joe.sh
joe is /home/dank/bin/joe.sh

No need to invent anything here, all you need seems present.  Or?
- Dan

-- 
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045





More information about the lsb-discuss mailing list