The s6-update-symlinks program
s6-update-symlinks links the content of several similar directory trees
under a single tree. Its main use is to replace search paths like $PATH
or $MANPATH, by creating a unique access tree based on the source trees.
Name conflicts are solved by giving precedence to the last named directory.
Subdirectories are created exactly as needed ; what can be shared is
s6-update-symlinks is useful when one wants to combine
a logical package system, like Dan Bernstein's
physical filesystem constraints, like /, /usr and
/usr/local on separate filesystems.
s6-update-symlinks d src1 src2 ...
- d is the destination directory. It will be created if it doesn't
- src1, src2, ... are the directory containing the files
to be linked.
- d and srcn must be
absolute paths, else s6-update-symlinks refuses to run. Using
relative paths doesn't make sense here, anyway.
- If src2 is empty, then d becomes a link to src1.
- If src1 is empty or entirely overridden by src2, then
d becomes a link to src2.
- If src1/file exists but not src2/file, then d
becomes a real directory and d/file a link to src1/file.
Then if src2/file2 exists, d/file2 links to it.
- And so on with other src directories, and subdirs.
- If s6-update-symlinks manages to performs all the requested
tasks, it exits 0. If it encounters a hard error, it exits 111. If it is
unable to resolve a conflict between given sources, it exits 100.
s6-update-symlinks /command /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin
makes all files under /bin, ..., /usr/local/sbin
available under /command. The programs linked are the same as the ones
that would be accessed with PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin".
s6-update-symlinks /package /initrd/package /slash/package /usr/package /usr/local/package
builds a /package hierarchy with what it finds in the listed
directories. This allows oddities like, for instance, having the daemontools
sources in /usr/package/admin/daemontools/src, and the daemontools
binaries in /initrd/package/admin/daemontools/bin, but accessing
both through /package/admin/daemontools/.