[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: finding a package name given a filename



On Sun, Nov 29, 1998 at 03:51:30PM -0500, servis@purdue.edu wrote:
> The problem with a lot of packages is that the executable is linked
> from a shorter name, and the links are not part of the package but are
> created in the postinst scripts.  The xemacs example is a really good
> one.
> 
> /usr/bin/xemacs -> /etc/alternatives/xemacs
> /etc/alternatives/xemacs -> /usr/bin/xemacs20
> /usr/bin/xemacs20 -> /etc/alternatives/xemacs20
> /etc/alternatives/xemacs20 -> /usr/bin/xemacs-20.4-nomule  (finally!!!)
> 
> So doing a 'dpkg -S /usr/bin/xemacs' would not work because
> /usr/bin/xemacs is actually not in the xemacs20-nomule package but is
> created after the package is extracted.

I was thinking about this, tried to find a utility to chase a symbolic
link to a real file, but failed.  I even asked if a local Unix guru
knew one.  He didn't.

So I wrote one.  Here's a sample session with it:

ajk@ugh[22:25:31]:~$ dpkg -S `chase /usr/bin/xemacs`
xemacs20-nomule: /usr/bin/xemacs-20.4-nomule
ajk@ugh[22:26:16]:~$ 

The `chase' here is my small utility.  Basically it takes a file name
and finds the name of the real file it refers to, recursively
dereferencing all the symlinks it encounters.

The source tarball (with a copy of GNU GPL and all the Autoconf bells
and whistles) is currently 28kB.  If anyone is interested, I might
upload it somewhere (probably metalab aka sunsite), or even generate a
.deb of it (though I can't upload it to Debian yet, as I'm still
waiting for my developer status application to be fully processed).

Is anyone interested enough to make an upload worthwhile at this
point?


	Antti-Juhani
-- 
%%% Antti-Juhani Kaijanaho % gaia@iki.fi % http://www.iki.fi/gaia/ %%%

	  About to generate a new signature, please wait...


Reply to: