variant symlinks (was Re: Anybody working on removing sendmail from base?)
John
jwd at bsdwins.com
Fri Oct 3 11:16:23 PDT 2003
I've had variant (magic) symlinks working under 4-stable for awhile
now. You can do some really neat stuff with them.
An old message concerning them can be found on the -stable
list, msgid <20030810040807.GA26220 at xxxxxxxxxxx>.
An older set of patches can be seen here:
http://people.freebsd.org/~jwd/mlinks/freebsd-magic-patches
http://people.freebsd.org/~jwd/mlinks/env-magic-patches
What you want requires both sets. It also requires some
patches to the shells to make sure the environment variables
are all handled in a known fashion.
I have some newer patch sets I need to upload.
The origin of the patchset comes from an old netbsd pr.
-John
%mount
/dev/ad0s1a on / (ufs, NFS exported, local, magiclinks)
cd /
ls -ald clstr
lrwxr-xr-x 1 root wheel 25 Oct 3 11:09 tst -> /clstr/@env_CLSTR/clstr
man mount
magiclinks
Expand special strings (beginning with ``@'') when
traversing symbolic links. See symlink(7) for a list of
supported strings.
man 7 symlink
MAGIC SYMLINKS
Symlinks in file systems with the MNT_MAGICLINKS flag set have ``magic''
patterns in symlinks expanded. Those patterns begin with ``@'' (an at-
sign), and end at the end of the pathname component (i.e. at the next
``/'', or at the end of the symbolic link if there are no more slashes).
The following patterns are supported:
@domainname Expands to the machine's domain name, as set by
setdomainname(3).
@env_XXXXX Expands to the current setting of the environment variable
XXXXX
@hostname Expands to the machine's host name, as set by
sethostname(3).
@kernel_ident Expands to the name of the config(8) file used to generate
the running kernel.
@machine Expands to the value of MACHINE for the system (also, the
same as make(1) 's ${MACHINE} variable).
@machine_arch Expands to the value of MACHINE_ARCH for the system (also,
the same as make(1) 's ${MACHINE_ARCH} variable).
@osrelease Expands to the operating system release of the running
kernel.
@ostype Expands to the operating system type of the running ker-
nel. (This will always be ``NetBSD'' for NetBSD systems.)
More information about the Kernel
mailing list