Skip to content

Commit e3f5c13

Browse files
committed
Update documentation to match changes in 3.5.0
1 parent 34dc9bd commit e3f5c13

File tree

4 files changed

+45
-26
lines changed

4 files changed

+45
-26
lines changed

_docs/020_install.md

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ zypper modifyrepo -p 100 utilities
4444

4545
A version of yadm is available via standard package repositories. Use `apt-get` to install.
4646

47+
```
48+
sudo apt-get install yadm
49+
```
50+
4751
## Arch Linux
4852

4953
yadm is available in the official repository, simply use `pacman` to install it.

_docs/060_alternates.md

+24-11
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,21 @@ conditions do not require a "value", and in that case, the period and value can
2626
be omitted. Most attributes can be abbreviated as a single letter. Values are
2727
compared case-insensitive.
2828

29+
Prefixing an attribute with "~" negates the condition, meaning the condition is
30+
considered only if the attribute/value pair evaluates to false.
31+
2932
| Attribute | Meaning |
3033
| - | - |
31-
| `arch`, `a` | Valid if the value matches the architecture. Architecture is calculated by running <code>uname&nbsp;&#8209;m</code>. |
32-
| `class`, `c` | Valid if the value matches the local.class configuration. Class must be manually set using <code>yadm&nbsp;config&nbsp;local.class&nbsp;&lt;class&gt;</code>. |
34+
| `arch`, `a` | Valid if the value matches the architecture. Architecture is calculated by running `uname -m`. |
35+
| `class`, `c` | Valid if the value matches the local.class configuration. Class must be manually set using `yadm config local.class <class>`. |
3336
| `default` | Valid when no other alternate is valid. |
34-
| `distro`, `d` | Valid if the value matches the distro. Distro is calculated by running <code>lsb_release&nbsp;&#8209;si</code> or inspecting `ID` from <code>/etc/os-release</code> |
35-
| `distro_family`, `f` | Valid if the value matches the distro family. Distro family is calculated by inspecting `ID_LIKE` from <code>/etc/os-release</code> (or `ID` if `ID_LIKE` isn't found) |
37+
| `distro`, `d` | Valid if the value matches the distro. Distro is calculated by running `lsb_release -si` or inspecting `ID` from `/etc/os-release`. |
38+
| `distro_family`, `f` | Valid if the value matches the distro family. Distro family is calculated by inspecting `ID_LIKE` from `/etc/os-release` (or `ID` if `ID_LIKE` isn't found). |
3639
| `extension`, `e` | A special "condition" that doesn't affect the selection process. Its purpose is instead to allow the alternate file to end with a certain extension to e.g. make editors highlight the content properly. |
37-
| `hostname`, `h` | Valid if the value matches the short hostname. Hostname is calculated by running <code>uname&nbsp;&#8209;n</code>, and trimming off any domain. |
38-
| `os`, `o` | Valid if the value matches the OS. OS is calculated by running <code>uname&nbsp;&#8209;s</code>. <sup>*</sup> |
40+
| `hostname`, `h` | Valid if the value matches the short hostname. Hostname is calculated by running `uname -n`, and trimming off any domain. |
41+
| `os`, `o` | Valid if the value matches the OS. OS is calculated by running `uname -s`. <sup>*</sup> |
3942
| `template`, `t` | Valid when the value matches a supported template processor. See the [Templates](/docs/templates) section for more details. |
40-
| `user`, `u` | Valid if the value matches the current user. Current user is calculated by running <code>id&nbsp;&#8209;u&nbsp;&#8209;n</code>. |
43+
| `user`, `u` | Valid if the value matches the current user. Current user is calculated by running `id -u -n`. |
4144

4245
<sub><sup>*
4346
The OS for "Windows Subsystem for Linux" is reported as "WSL", even though uname identifies as "Linux".
@@ -54,8 +57,9 @@ symbolic links will be created for the most appropriate version.
5457
The "most appropriate" version is determined by calculating a score for each
5558
version of a file. A [template](/docs/templates) is always scored higher than
5659
any symlink condition. The number of conditions is the next largest factor in
57-
scoring. Files with more conditions will always be favored. Any invalid
58-
condition will disqualify that file completely.
60+
scoring. Files with more conditions will always be favored. Negative conditions
61+
(prefixed with "~") are scored only relative to the number of non-negated
62+
conditions. Any invalid condition will disqualify that file completely.
5963

6064
If you don't care to have all versions of alternates stored in the same
6165
directory as the generated symlink, you can place them in the
@@ -67,6 +71,7 @@ files are managed by yadm's repository:
6771

6872
$HOME/path/example.txt##default
6973
$HOME/path/example.txt##class.Work
74+
$HOME/path/example.txt##class.Work,~os.Darwin
7075
$HOME/path/example.txt##os.Darwin
7176
$HOME/path/example.txt##os.Darwin,hostname.host1
7277
$HOME/path/example.txt##os.Darwin,hostname.host2
@@ -91,20 +96,28 @@ If running on a Solaris server, the link will use the default version:
9196

9297
`$HOME/path/example.txt``$HOME/path/example.txt##default`
9398

94-
If running on a system, with class set to `Work`, the link will be:
99+
If running on a Macbook, with class set to `Work`, the link will be:
95100

96101
`$HOME/path/example.txt``$HOME/path/example.txt##class.Work`
97102

103+
If running on a system with class set to `Work`, but instead within Windows
104+
Subsystem for Linux, where the os is reported as WSL, the link will be:
105+
106+
`$HOME/path/example.txt``$HOME/path/example.txt##class.Work,~os.Darwin`
107+
98108
If no `##default` version exists and no files have valid conditions, then no
99109
link will be created.
100110

101111
Links are also created for directories named this way, as long as they have at
102-
least one yadm managed file within them (at the top level).
112+
least one yadm managed file within them.
103113

104114
yadm will automatically create these links by default. This can be disabled
105115
using the `yadm.auto-alt` configuration. Even if disabled, links can be manually
106116
created by running `yadm alt`.
107117

118+
Created links are automatically added to the repository's `info/exclude`
119+
file. This can be disabled using the `yadm.auto-exclude` configuration.
120+
108121
## Class and Overrides
109122

110123
Class is a special value which is stored locally on each host (inside the local

_docs/070_templates.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,25 @@ Also, `j2` will be processed by either j2cli or envtpl, whichever is found.
3737
When template processors run, they will be provided the following set of data.
3838

3939

40-
| Default (built-in) | Jinja or ESH | Description | Source |
41-
| - | - | - | - |
42-
| `yadm.arch` | `YADM_ARCH` | Architecture | <code>uname&nbsp;&#8209;m</code> |
43-
| `yadm.class` | `YADM_CLASS` | Last defined class | <code>yadm&nbsp;config&nbsp;local.class</code> |
44-
| `yadm.classes` | `YADM_CLASSES` | All classes | <code>yadm&nbsp;config &#8209;&#8209;get&#8209;all&nbsp;local.class</code> |
45-
| `yadm.distro` | `YADM_DISTRO` | Distribution | <code>lsb_release&nbsp;&#8209;si</code><br/>or <code>/etc/os-release</code> |
46-
| `yadm.distro_family` | `YADM_DISTRO_FAMILY` | Distribution Family | `ID_LIKE` from<code>/etc/os&#8209;release</code> |
47-
| `yadm.hostname` | `YADM_HOSTNAME` | Hostname | <code>uname&nbsp;&#8209;n</code> (without domain) |
48-
| `yadm.os` | `YADM_OS` | Operating system | <code>uname&nbsp;&#8209;s</code> <sup>*</sup> |
49-
| `yadm.source` | `YADM_SOURCE` | Template filename | (fully qualified path) |
50-
| `yadm.user` | `YADM_USER` | Current user | <code>id&nbsp;&#8209;u&nbsp;&#8209;n</code> |
51-
| `env.VAR` | | Env variables | Any VAR in the environment while yadm templates are processed |
40+
| Default (built-in) | Jinja or ESH | Description | Source |
41+
| - | - | - | - |
42+
| `yadm.arch` | `YADM_ARCH` | Architecture | `uname -m` |
43+
| `yadm.class` | `YADM_CLASS` | Last defined class | `yadm config local.class` |
44+
| `yadm.classes` | `YADM_CLASSES` | All classes | `yadm config --get-all local.class` |
45+
| `yadm.distro` | `YADM_DISTRO` | Distribution | `lsb_release -si`<br/>or `/etc/os-release` |
46+
| `yadm.distro_family` | `YADM_DISTRO_FAMILY` | Distribution family | `ID_LIKE` from`/etc/os-release` |
47+
| `yadm.filename` | | Current filename | (fully qualified path) <sup>*</sup> |
48+
| `yadm.hostname` | `YADM_HOSTNAME` | Hostname | `uname -n` (without domain) |
49+
| `yadm.os` | `YADM_OS` | Operating system | `uname -s` <sup>*</sup> |
50+
| `yadm.source` | `YADM_SOURCE` | Template filename | (fully qualified path) |
51+
| `yadm.user` | `YADM_USER` | Current user | `id -u -n` |
52+
| `env.VAR` | | Env variables | Any VAR in the environment while yadm templates are processed |
5253

5354
<sub><sup>*
55+
Current filename differ from template filename in included files.
56+
<br/>*
5457
The OS for "Windows Subsystem for Linux" is reported as "WSL", even though uname identifies as "Linux".
55-
<br/>
56-
*
58+
<br/>*
5759
If `lsb_release` is not available, "distro" will be the ID specified in `/etc/os-release`.
5860
</sup></sub>
5961

_docs/110_faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Another option is to add patterns to
180180
`$HOME/.local/share/yadm/repo.git/info/exclude`.
181181
If you use this file, be sure to add your patterns above any
182182
`yadm-auto-excludes` line, as all lines below this can be overwritten by yadm
183-
when encrypting data.
183+
when creating alternate links, template files or encrypting data.
184184

185185
## Integrations
186186

0 commit comments

Comments
 (0)