(New page: == Symlinks == There are two ways of making a symlink, either as a relative link or an absolute link. In Fedora, neither method is required. Packagers should use their best judgement when ...) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
A relative symlink is a symlink which points to a file or directory relative to the position of the symlink. For example, this command would create a relative symlink: | A relative symlink is a symlink which points to a file or directory relative to the position of the symlink. For example, this command would create a relative symlink: | ||
<pre> | <pre> | ||
ln -s ../.. | ln -s ../..%{_bindir}/foo %{buildroot}/bin/foo | ||
</pre> | </pre> | ||
Pros: | Pros: | ||
* Relative symlinks | * Relative symlinks will point to the same file inside or outside of a chroot. | ||
Cons: | Cons: | ||
Line 15: | Line 15: | ||
* Relative symlinks may break or behave unexpectedly when a part of a filesystem is mounted to a custom location. | * Relative symlinks may break or behave unexpectedly when a part of a filesystem is mounted to a custom location. | ||
* Relative symlinks may break when bind mounting or symlinking directories. | * Relative symlinks may break when bind mounting or symlinking directories. | ||
* Relative symlinks make it more difficult to use rpm system macros. | * Relative symlinks may make it more difficult to use rpm system macros. | ||
=== Absolute Symlinks === | === Absolute Symlinks === | ||
An absolute symlink is a symlink which points to an absolute file or directory path. For example, this command would create an absolute symlink: | An absolute symlink is a symlink which points to an absolute file or directory path. For example, this command would create an absolute symlink: | ||
<pre> | <pre> | ||
ln -s | ln -s %{_bindir}/foo %{buildroot}/bin/foo | ||
</pre> | </pre> | ||
Line 30: | Line 30: | ||
Cons: | Cons: | ||
* Absolute symlinks may break when used with chroots. | * Absolute symlinks may break when used with chroots. | ||
== Discussion == | |||
See [[Talk:PackagingDrafts/Symlinks]] for discussion | |||
[[Category:Packaging guidelines drafts]] |
Latest revision as of 20:34, 17 February 2009
Symlinks
There are two ways of making a symlink, either as a relative link or an absolute link. In Fedora, neither method is required. Packagers should use their best judgement when deciding which method of symlink creation is appropriate.
Relative Symlinks
A relative symlink is a symlink which points to a file or directory relative to the position of the symlink. For example, this command would create a relative symlink:
ln -s ../..%{_bindir}/foo %{buildroot}/bin/foo
Pros:
- Relative symlinks will point to the same file inside or outside of a chroot.
Cons:
- Much more complicated to create than absolute symlinks
- Relative symlinks may break or behave unexpectedly when a part of a filesystem is mounted to a custom location.
- Relative symlinks may break when bind mounting or symlinking directories.
- Relative symlinks may make it more difficult to use rpm system macros.
Absolute Symlinks
An absolute symlink is a symlink which points to an absolute file or directory path. For example, this command would create an absolute symlink:
ln -s %{_bindir}/foo %{buildroot}/bin/foo
Pros:
- Much easier to create than relative symlinks.
- Absolute symlinks work properly when bind mounting or symlinking directories.
- Absolute symlinks work well with rpm system macros.
Cons:
- Absolute symlinks may break when used with chroots.
Discussion
See Talk:PackagingDrafts/Symlinks for discussion