Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Apr 2011 17:58:18 +0200
From:      Polytropon <>
To:        Michael =?ISO-8859-1?Q?Gr=FCnewald?= <>
Cc:        FreeBSD questions <>
Subject:   Re: Place to install library of shell functions
Message-ID:  <>
In-Reply-To: <>
References:  <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Tue, 05 Apr 2011 17:23:47 +0200, Michael Gr=FCnewald <michaelgrunewald@y=> wrote:
> Dear FreeBSD users,
> today I come to you with what seems to be somehow pedantic question: =20
> where is the best place to install libraries of shell functions.

Depends. Are you interested in shell functions you install
from a port / package, or your own shell functions?

> I read hier(4) carefully and it seems the correct place for this would=20
> be somewhere under `/usr/local/share':
>                  share/    architecture-independent files

This structure usually serves the purpose of /usr/share,
but for software installed by ports or packages, as the
/usr/local/ subtree "duplicates" the system's structures
in many cases.

> On the base systems, many macros (make templates and groff macros) are=20
> actually installed under /usr/share.  However, the only library of shell=
> functions I am aware of is `/etc/rc.subr', that landed on this funny=20
> location, probably to be pretty sure that this library is on the same=20
> filesystem as the scripts under /etc/rc.d.

I guess that's the intention behind this decision. You'll
see that many things on FreeBSD are determined by a well-
intended thought, rather than an arbitrary "Oh, why don't
we just put it ... *throw a dice* ... here?"

> Several of the ports install shell scripts under `/usr/local/lib' that=20
> hier(4) devotes to  ``shared and archive ar(1)-type libraries''.  These=20
> shell scripts are:
>  > find /usr/local/lib -name '*.sh'
> /usr/local/lib/tk8.5/
> /usr/local/lib/seamonkey/
> /usr/local/lib/libxul/
> /usr/local/lib/rpm/
> /usr/local/lib/rpm/
> /usr/local/lib/rpm/
> /usr/local/lib/rpm/
> /usr/local/lib/rpm/
> /usr/local/lib/rpm/
> /usr/local/lib/firefox/
> /usr/local/lib/tcl8.5/
> /usr/local/lib/thunderbird/
> /usr/local/lib/llvm-gcc-2.8/gcc/x86_64-portbld-freebsd8.2/4.2.1/install-t=
> Two files (the `/usr/local/lib/tcl8.5/' one and the=20
> `s/tcl/tk/g' one) are actually shell script libraries (defining a bunch=20
> of variables), and all the others are ancillary scripts, that would=20
> maybe better fit in `/usr/local/libexec'.

It depends on where the respective port maintainer want to
have them.

> So, practical experience does not really second my a priori that these=20
> files sould go under the `share' hierarchy and I would like to have your=
> opinion on this question.

Many software is ported from Linux, so their structures,
or sometimes the lack of, is applied.

For example, I put _my_ stuff that is NOT managed by ports and
definitely does NOT belong to the system into an /opt subtree,
a Solaris-ism I'm "abusing": /opt/bin is in $PATH, so anything
system-wide executable is located there, and /opt/share
does contain non-executable shell scripts (e. g. those with
helper functionalities) or files with settings (that are
sourced by something else) - things that usually are not
called directly.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

Want to link to this message? Use this URL: <>