diff options
-rw-r--r-- | man/file-hierarchy.xml | 245 |
1 files changed, 229 insertions, 16 deletions
diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml index a1b232d321..f8694a4c0a 100644 --- a/man/file-hierarchy.xml +++ b/man/file-hierarchy.xml @@ -257,8 +257,9 @@ <varlistentry> <term><filename>/usr/bin</filename></term> - <listitem><para>Binaries for user - commands, that shall appear in the + <listitem><para>Binaries and + executables for user commands, that + shall appear in the <varname>$PATH</varname> search path. It is recommended not to place binaries in this directory that are @@ -278,17 +279,16 @@ <varlistentry> <term><filename>/usr/lib</filename></term> - <listitem><para>Static vendor data - that is compatible with all + <listitem><para>Static, private vendor + data that is compatible with all architectures (though not necessarily architecture-independent). Note that - this includes internal - executables or other binaries that are - not regularly invoked from a - shell. Such binaries may be for any - architecture supported by the - system. Do not place public libraries - in this directory, use + this includes internal executables or + other binaries that are not regularly + invoked from a shell. Such binaries + may be for any architecture supported + by the system. Do not place public + libraries in this directory, use <varname>$libdir</varname> (see below), instead.</para></listitem> </varlistentry> @@ -296,7 +296,7 @@ <varlistentry> <term><varname>$libdir</varname></term> <listitem><para>Location for placing - dynamic libraries in. The precise + dynamic libraries. The precise location depends on the operating system and the architecture, and is sometimes @@ -615,6 +615,112 @@ </refsect1> <refsect1> + <title>Home Directory</title> + + <para>User applications may want to place files and + directories in the user's home directory. They should + follow the following basic structure. Note that some + of these directories are also standardized (though + more weakly) by the <ulink + url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG + Base Directory Specification</ulink>.</para> + + <variablelist> + <varlistentry> + <term><filename>~/.cache</filename></term> + + <listitem><para>Persistent user cache + data. User programs may place + non-essential data in this + directory. Flushing this directory + should have no effect on operation of + programs, except for increased + runtimes necessary to rebuild these + caches. If an application finds + <varname>$XDG_CACHE_HOME</varname> set + is should use the directory specified + in it instead of this + directory.</para></listitem> + </varlistentry> + + <varlistentry> + <term><filename>~/.config</filename></term> + + <listitem><para>Application + configuration and state. When a new + user is created this directory will be + empty or not exist at + all. Applications should fall back to + defaults should their configuration or + state in this directory be missing. If + an application finds + <varname>$XDG_CONFIG_HOME</varname> set + is should use the directory specified + in it instead of this + directory.</para></listitem> + </varlistentry> + + <varlistentry> + <term><filename>~/.local/bin</filename></term> + + <listitem><para>Executables that shall + appear in the user's + <varname>$PATH</varname> search + path. It is recommended not to place + executables in this directory that are + not useful for invocation from a + shell; these should be placed in a + subdirectory of + <filename>~/.local/lib</filename> + instead. Care should be taken when + placing architecture-dependent + binaries in this place which might be + problematic if the home directory is + shared between multiple hosts with + different + architectures.</para></listitem> + </varlistentry> + + <varlistentry> + <term><filename>~/.local/lib</filename></term> + + <listitem><para>Static, private vendor + data that is compatible with all + architectures.</para></listitem> + </varlistentry> + + <varlistentry> + <term><filename>~/.local/lib/<replaceable>arch-id</replaceable></filename></term> + + <listitem><para>Location for placing + public dynamic libraries. The architecture + identifier to use is defined on <ulink + url="https://wiki.debian.org/Multiarch/Tuples">Multiarch Architecture Specifiers (Tuples)</ulink> + list.</para></listitem> + </varlistentry> + + <varlistentry> + <term><filename>~/.local/share</filename></term> + + <listitem><para>Resources shared + between multiple packages, such as + fonts or artwork. Usually, the precise + location and format of files stored + below this directory is subject to + specifications that ensure + interoperability. If + an application finds + <varname>$XDG_DATA_HOME</varname> set + is should use the directory specified + in it instead of this + directory.</para></listitem> + </varlistentry> + + </variablelist> + </refsect1> + + + <refsect1> <title>Unpriviliged Write Access</title> <para>Unpriviliged processes generally lack @@ -669,10 +775,11 @@ <para>Developers of system packages should follow strict rules when placing their own files in the file system. The following table lists recommended - locations for specific types of files.</para> + locations for specific types of files supplied by the + vendor.</para> <table> - <title>System Package Data Location</title> + <title>System Package Vendor Files Locations</title> <tgroup cols='2' align='left' colsep='1' rowsep='1'> <colspec colname="directory" /> <colspec colname="purpose" /> @@ -693,7 +800,7 @@ </row> <row> <entry><filename>/usr/lib/<replaceable>package</replaceable></filename></entry> - <entry>Private static vendor resources of the package, including private binaries and libraries, or any other kind of read-only vendor data.</entry> + <entry>Private, static vendor resources of the package, including private binaries and libraries, or any other kind of read-only vendor data.</entry> </row> <row> <entry><filename>$libdir/<replaceable>package</replaceable></filename></entry> @@ -703,6 +810,30 @@ <entry><filename>/usr/include/<replaceable>package</replaceable></filename></entry> <entry>Public C/C++ APIs of public shared libraries of the package.</entry> </row> + </tbody> + </tgroup> + </table> + + <para>Additional static vendor files may be installed + in the <filename>/usr/share</filename> hierarchy, to + the locations defined by the various relevant + specifications.</para> + + <para>During runtime and for local configuration and + state additional directories are defined:</para> + + <table> + <title>System Package Variable Files Locations</title> + <tgroup cols='2' align='left' colsep='1' rowsep='1'> + <colspec colname="directory" /> + <colspec colname="purpose" /> + <thead> + <row> + <entry>Directory</entry> + <entry>Purpose</entry> + </row> + </thead> + <tbody> <row> <entry><filename>/etc/<replaceable>package</replaceable></filename></entry> <entry>System-specific configuration for the package. It is recommended to default to safe fallbacks if this configuration is missing, if this is possible. Alternatively, a <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry> fragment may be used to copy or symlink the necessary files and directories from <filename>/usr/share/factory</filename> during boot, via the <literal>L</literal> or <literal>C</literal> directives.</entry> @@ -717,7 +848,7 @@ </row> <row> <entry><filename>/var/cache/<replaceable>package</replaceable></filename></entry> - <entry>Persistent cache data of the package. If this directory is flushed the application should work correctly on next invocation, though possibly slowed done due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary.</entry> + <entry>Persistent cache data of the package. If this directory is flushed the application should work correctly on next invocation, though possibly slowed down due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary.</entry> </row> <row> <entry><filename>/var/lib/<replaceable>package</replaceable></filename></entry> @@ -737,6 +868,88 @@ </refsect1> <refsect1> + <title>User Packages</title> + + <para>Programs running in user context should follow + strict rules when placing their own files in the + user's home directory. The following table lists + recommended locations in the home directory for + specific types of files supplied by the vendor if the + application is installed in the home directory. (Note + however, that user applications installed system-wide + should follow the rules outlined above regarding + placing vendor files.)</para> + + <table> + <title>User Package Vendor File Locations</title> + <tgroup cols='2' align='left' colsep='1' rowsep='1'> + <colspec colname="directory" /> + <colspec colname="purpose" /> + <thead> + <row> + <entry>Directory</entry> + <entry>Purpose</entry> + </row> + </thead> + <tbody> + <row> + <entry><filename>~/.local/bin</filename></entry> + <entry>Package executables that shall appear in the <varname>$PATH</varname> executable search path. It is not recommended to place internal executables or executables that are not commonly invoked from the shell in this directory, such as daemon executables. As this directory is shared with most other packages of the user special care should be taken to pick unique names for files placed here, that are unlikely to clash with other package's files.</entry> + </row> + <row> + <entry><filename>~/.local/lib/<replaceable>arch-id</replaceable></filename></entry> + <entry>Public shared libraries of the package. As above, be careful with using too generic names, and pick unique names for your libraries to place here to avoid name clashes.</entry> + </row> + <row> + <entry><filename>~/.local/lib/<replaceable>package</replaceable></filename></entry> + <entry>Private, static vendor resources of the package, compatible wih any architecture, or any other kind of read-only vendor data.</entry> + </row> + <row> + <entry><filename>~/.local/lib/<replaceable>arch-id</replaceable>/<replaceable>package</replaceable></filename></entry> + <entry>Private other vendor resources of the package that are architecture-specific and cannot be shared between architectures.</entry> + </row> + </tbody> + </tgroup> + </table> + + <para>Additional static vendor files may be installed + in the <filename>~/.local/share</filename> hierarchy, + to the locations defined by the various relevant + specifications.</para> + + <para>During runtime and for local configuration and + state additional directories are defined:</para> + + <table> + <title>User Package Variable File Locations</title> + <tgroup cols='2' align='left' colsep='1' rowsep='1'> + <colspec colname="directory" /> + <colspec colname="purpose" /> + <thead> + <row> + <entry>Directory</entry> + <entry>Purpose</entry> + </row> + </thead> + <tbody> + <row> + <entry><filename>~/.config/<replaceable>package</replaceable></filename></entry> + <entry>User-specific configuration and state for the package. It is required to default to safe fallbacks if this configuration is missing.</entry> + </row> + <row> + <entry><filename><varname>$XDG_RUNTIME_DIR</varname>/<replaceable>package</replaceable></filename></entry> + <entry>User runtime data for the package.</entry> + </row> + <row> + <entry><filename>~/.cache/<replaceable>package</replaceable></filename></entry> + <entry>Persistent cache data of the package. If this directory is flushed the application should work correctly on next invocation, though possibly slowed down due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary.</entry> + </row> + </tbody> + </tgroup> + </table> + </refsect1> + + <refsect1> <title>See Also</title> <para> <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |