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

Re: Why are some excutables not installed in /bin or /usr/bin ? [was: command file location]



On 2020-12-25 at 08:55, Andrei POPESCU wrote:

> On Vi, 25 dec 20, 06:38:14, grumpy@mailfence.com wrote:

>> over the years i've noticed that some command files are put in what
>> i would call not usual locations for example
>> /usr/lib/dropbear/dropbearconvert
> 
> dpkg -L is very helpful in such cases.

Or, if the package isn't installed, 'apt-file show'.

In this case:

$ apt-file show dropbear-bin | grep -v /usr/share/
dropbear-bin: /usr/bin/dbclient
dropbear-bin: /usr/bin/dropbearconvert
dropbear-bin: /usr/bin/dropbearkey
dropbear-bin: /usr/lib/dropbear/dropbearconvert
dropbear-bin: /usr/sbin/dropbear

Both /usr/bin/dropbearconvert and /usr/lib/dropbear/dropbearconvert
exist, although in the dropbear-bin package rather than the dropbear
package itself.

I don't have it installed so I can't easily check, but at a glance, this
looks like a pattern I've seen before; I think the first time was in the
Firefox packages, back long enough ago that Iceweasel hadn't become a
thing yet.


In this pattern, invoking the actual binary directly won't give the
desired results; you need to pass it appropriate arguments. To let
invoking the bare command name provide reasonable behavior, the package
maintainer installs the binary somewhere else (usually under /usr/lib/)
and provides a wrapper script (usually under /usr/bin/) which determines
the right arguments and invokes the actual binary.

There's also another form, in which the binary needs to have other files
(and/or even subdirectories) exist under its install path, which is
clearly not suitable for installing it into PATH. In that case, again
you wind up with a wrapper script, which simply serves to invoke the
binary from its more-complex-accompanying-files install location.

(There's also a variant of that second form, in which the binary must be
invoked from the directory where it is installed in order for it to find
all those other files it needs, and the wrapper script changes to the
correct directory before invoking the binary. That's relatively
uncommon, though, AFAIK.)


If 'file /usr/bin/dropbearconvert' reports that it's a script, and 'file
/usr/lib/dropbearconvert' reports that it's a binary, then you're
probably looking at one form or another of that pattern.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: