(debian-policy.info)Symbolic links


Next: Device files Prev: Scripts Up: Files<2>
Enter node , (file) or (file)node

10.5 Symbolic links
===================

In general, symbolic links within a top-level directory should be
relative, and symbolic links pointing from one top-level directory to or
into another should be absolute.  (A top-level directory is a
sub-directory of the root directory ‘/’.)  For example, a symbolic link
from ‘/usr/lib/foo’ to ‘/usr/share/bar’ should be relative
(‘../share/bar’), but a symbolic link from ‘/var/run’ to ‘/run’ should
be absolute.  (1) Symbolic links must not traverse above the root
directory.

In addition, symbolic links should be specified as short as possible,
i.e., link targets like ‘foo/../bar’ are deprecated.

Note that when creating a relative link using ‘ln’ it is not necessary
for the target of the link to exist relative to the working directory
you’re running ‘ln’ from, nor is it necessary to change directory to the
directory where the link is to be made.  Simply include the string that
should appear as the target of the link (this will be a pathname
relative to the directory in which the link resides) as the first
argument to ‘ln’.

For example, in your ‘Makefile’ or ‘debian/rules’, you can do things
like:

     ln -fs gcc $(prefix)/bin/cc
     ln -fs gcc debian/tmp/usr/bin/cc
     ln -fs ../sbin/sendmail $(prefix)/bin/runq
     ln -fs ../sbin/sendmail debian/tmp/usr/bin/runq

A symbolic link pointing to a compressed file (in the sense that it is
meant to be uncompressed with ‘unzip’ or ‘zless’ etc.)  should always
have the same file extension as the referenced file.  (For example, if a
file ‘foo.gz’ is referenced by a symbolic link, the filename of the link
has to end with “‘.gz’” too, as in ‘bar.gz’.)

   ---------- Footnotes ----------

   (1) This is necessary to allow top-level directories to be symlinks.
If linking ‘/var/run’ to ‘/run’ were done with the relative symbolic
link ‘../run’, but ‘/var’ were a symbolic link to ‘/srv/disk1’, the
symbolic link would point to ‘/srv/run’ rather than the intended target.


automatically generated by info2www version 1.2.2.9