1
0
Fork 0
mirror of synced 2024-12-22 14:41:07 -05:00

Update web documentation for alternates

This commit is contained in:
Tim Byrne 2017-01-31 17:29:45 -06:00
parent 3733090df1
commit 2f95fca1c4
No known key found for this signature in database
GPG key ID: 6CBE24C2FD8CF76E

View file

@ -15,10 +15,14 @@ feature which will automatically create a symbolic link to the appropriate
version of a file, as long as you follow a specific naming convention. **yadm** can version of a file, as long as you follow a specific naming convention. **yadm** can
detect files with names ending in: detect files with names ending in:
| `##` | Default file linked | | `##` | Default file linked |
| `##OS` | Matching OS | | `##CLASS` | Matching Class |
| `##OS.HOSTNAME` | Matching OS & Hostname | | `##CLASS.OS` | Matching Class & OS |
| `##OS.HOSTNAME.USER` | Matching OS, Hostname, and User | | `##CLASS.OS.HOSTNAME` | Matching Class, OS & Hostname |
| `##CLASS.OS.HOSTNAME.USER` | Matching Class, OS, Hostname, & User |
| `##OS` | Matching OS |
| `##OS.HOSTNAME` | Matching OS & Hostname |
| `##OS.HOSTNAME.USER` | Matching OS, Hostname, & User |
If there are any files managed by **yadm**'s repository, or listed in If there are any files managed by **yadm**'s repository, or listed in
`$HOME/.yadm/encrypt`, which match this naming convention, symbolic links will `$HOME/.yadm/encrypt`, which match this naming convention, symbolic links will
@ -26,6 +30,7 @@ be created for the most appropriate version. This may best be demonstrated by
example. Assume the following files are managed by **yadm**'s repository: example. Assume the following files are managed by **yadm**'s repository:
$HOME/path/example.txt## $HOME/path/example.txt##
$HOME/path/example.txt##Work
$HOME/path/example.txt##Darwin $HOME/path/example.txt##Darwin
$HOME/path/example.txt##Darwin.host1 $HOME/path/example.txt##Darwin.host1
$HOME/path/example.txt##Darwin.host2 $HOME/path/example.txt##Darwin.host2
@ -43,7 +48,7 @@ which looks like this:
`$HOME/path/example.txt``$HOME/path/example.txt##Darwin` `$HOME/path/example.txt``$HOME/path/example.txt##Darwin`
Since the hostname doesn't match any of the managed files, the more generic Since the host name doesn't match any of the managed files, the more generic
version is chosen. version is chosen.
If running on a Linux server named `host4`, the link will be: If running on a Linux server named `host4`, the link will be:
@ -54,13 +59,43 @@ If running on a Solaris server, the link use the default `##` version:
`$HOME/path/example.txt``$HOME/path/example.txt##` `$HOME/path/example.txt``$HOME/path/example.txt##`
If no `##` version exists and no files match the current OS/HOST- NAME/USER, If running on a system, with `CLASS` set to "Work" ([see below](alternates#class-and-overrides)), the link will be:
`$HOME/path/example.txt``$HOME/path/example.txt##Work`
If no `##` version exists and no files match the current CLASS/OS/HOSTNAME/USER,
then no link will be created. then no link will be created.
| OS is determined by running `uname -s`, HOSTNAME by running `hostname -s`, and | **CLASS** must be manually set using `yadm config local.class <class>`.
USER by running `id -u -n`. **yadm** will automatically create these links by | **OS** is determined by running `uname -s`.
default. This can be disabled using the `yadm.auto-alt` configuration. Even if | **HOSTNAME** by running `hostname` and removing any domain.
disabled, links can be manually created by running **yadm** alt. | **USER** by running `id -u -n`.
**yadm** will automatically create these links by default. This can be disabled using the `yadm.auto-alt` configuration. Even if disabled, links can be manually created by running **yadm** alt.
## Wildcards
It is possible to use `%` as a "wildcard" in place of `CLASS`, `OS`, `HOSTNAME`,
or `USER`. For example, The following file could be linked for *any host* when the
user is "harvey".
```
$HOME/path/example.txt##%.%.harvey
```
## Class and Overrides
Class is a special value which is stored locally on each host (inside the local
repository). To use alternate symlinks using `CLASS`, you must set the value of
class using the configuration `local.class`. This is set like any other **yadm**
configuration—with the `yadm config` command. The following sets the `CLASS` to
be "Work".
yadm config local.class Work
Similarly, the values of `OS`, `HOSTNAME`, and `USER` can be manually
overridden using the configuration options `local.os`, `local.hostname`, and
`local.user`.
## Strategies for alternate files on different systems ## Strategies for alternate files on different systems