mirror of
https://github.com/TheLocehiliosan/yadm
synced 2025-06-10 11:33:57 +00:00
updated yadm.1 with exact weights example and negatives.
This commit is contained in:
parent
c74faa5301
commit
99593d9661
62
yadm.1
62
yadm.1
@ -489,16 +489,18 @@ These are the supported attributes, in the order of the weighted precedence:
|
|||||||
Valid when the value matches a supported template processor.
|
Valid when the value matches a supported template processor.
|
||||||
See the TEMPLATES section for more details.
|
See the TEMPLATES section for more details.
|
||||||
.TP
|
.TP
|
||||||
.BR user ,\ u
|
.BR user ,\ u\
|
||||||
Valid if the value matches the current user.
|
Valid if the value matches the current user.
|
||||||
Current user is calculated by running
|
Current user is calculated by running
|
||||||
.BR "id \-u \-n" .
|
.BR "id \-u \-n" .
|
||||||
|
.BR [ weight\ = \ 64]
|
||||||
.TP
|
.TP
|
||||||
.BR hostname ,\ h
|
.BR hostname ,\ h
|
||||||
Valid if the value matches the short hostname.
|
Valid if the value matches the short hostname.
|
||||||
Hostname is calculated by running
|
Hostname is calculated by running
|
||||||
.BR "uname \-n" ,
|
.BR "uname \-n" ,
|
||||||
and trimming off any domain.
|
and trimming off any domain.
|
||||||
|
.BR [ weight\ = \ 32]
|
||||||
.TP
|
.TP
|
||||||
.BR class ,\ c
|
.BR class ,\ c
|
||||||
Valid if the value matches the
|
Valid if the value matches the
|
||||||
@ -508,6 +510,7 @@ Class must be manually set using
|
|||||||
.BR "yadm config local.class <class>" .
|
.BR "yadm config local.class <class>" .
|
||||||
See the CONFIGURATION section for more details about setting
|
See the CONFIGURATION section for more details about setting
|
||||||
.BR local.class .
|
.BR local.class .
|
||||||
|
.BR [ weight\ = \ 16]
|
||||||
.TP
|
.TP
|
||||||
.BR distro ,\ d
|
.BR distro ,\ d
|
||||||
Valid if the value matches the distro.
|
Valid if the value matches the distro.
|
||||||
@ -515,22 +518,26 @@ Distro is calculated by running
|
|||||||
.B "lsb_release \-si"
|
.B "lsb_release \-si"
|
||||||
or by inspecting the ID from
|
or by inspecting the ID from
|
||||||
.BR "/etc/os-release" .
|
.BR "/etc/os-release" .
|
||||||
|
.BR [ weight\ = \ 8]
|
||||||
.TP
|
.TP
|
||||||
.BR distro_family ,\ f
|
.BR distro_family ,\ f
|
||||||
Valid if the value matches the distro family.
|
Valid if the value matches the distro family.
|
||||||
Distro family is calculated by inspecting the ID_LIKE line from
|
Distro family is calculated by inspecting the ID_LIKE line from
|
||||||
.B "/etc/os-release"
|
.B "/etc/os-release"
|
||||||
(or ID if no ID_LIKE line is found).
|
(or ID if no ID_LIKE line is found).
|
||||||
|
.BR [ weight\ = \ 4]
|
||||||
.TP
|
.TP
|
||||||
.BR os ,\ o
|
.BR os ,\ o
|
||||||
Valid if the value matches the OS.
|
Valid if the value matches the OS.
|
||||||
OS is calculated by running
|
OS is calculated by running
|
||||||
.BR "uname \-s" .
|
.BR "uname \-s" .
|
||||||
|
.BR [ weight\ = \ 2]
|
||||||
.TP
|
.TP
|
||||||
.BR arch ,\ a
|
.BR arch ,\ a
|
||||||
Valid if the value matches the architecture.
|
Valid if the value matches the architecture.
|
||||||
Architecture is calculated by running
|
Architecture is calculated by running
|
||||||
.BR "uname \-m" .
|
.BR "uname \-m" .
|
||||||
|
.BR [ weight\ = \ 1]
|
||||||
.TP
|
.TP
|
||||||
.B default
|
.B default
|
||||||
Valid when no other alternate is valid.
|
Valid when no other alternate is valid.
|
||||||
@ -575,6 +582,7 @@ files are managed by yadm's repository:
|
|||||||
- $HOME/path/example.txt##os.Linux
|
- $HOME/path/example.txt##os.Linux
|
||||||
- $HOME/path/example.txt##os.Linux,hostname.host1
|
- $HOME/path/example.txt##os.Linux,hostname.host1
|
||||||
- $HOME/path/example.txt##os.Linux,hostname.host2
|
- $HOME/path/example.txt##os.Linux,hostname.host2
|
||||||
|
- $HOME/path/example.txt##~os.Linux,~os.Darwin,~os.SunOS
|
||||||
|
|
||||||
If running on a Macbook named "host2",
|
If running on a Macbook named "host2",
|
||||||
yadm will create a symbolic link which looks like this:
|
yadm will create a symbolic link which looks like this:
|
||||||
@ -601,9 +609,61 @@ If running on a system, with class set to "Work", the link will be:
|
|||||||
|
|
||||||
.IR $HOME/path/example.txt " -> " $HOME/path/example.txt##class.Work
|
.IR $HOME/path/example.txt " -> " $HOME/path/example.txt##class.Work
|
||||||
|
|
||||||
|
Negative conditions are supported via the "~" prefix. If running within
|
||||||
|
Windows Subsystem for Linux, where the os is reported as WSL, the link will be:
|
||||||
|
|
||||||
|
.IR $HOME/path/example.txt " -> " $HOME/path/example.txt##~os.Linux,~os.Darwin,~os.SunOS
|
||||||
|
|
||||||
|
Negative conditions use the weight which corresponds to the attached attribute.
|
||||||
|
|
||||||
If no "##default" version exists and no files have valid conditions, then no
|
If no "##default" version exists and no files have valid conditions, then no
|
||||||
link will be created.
|
link will be created.
|
||||||
|
|
||||||
|
Weighting for multiple valid alternatives is calculated using the weights specified
|
||||||
|
above. For instance, on a Linux server named "host1" with class set to "Work", the
|
||||||
|
alternatives will have the following weights:
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##default
|
||||||
|
|
||||||
|
Used if there are no other valid alternatives.
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##class.Work
|
||||||
|
|
||||||
|
1064 = (1000 + 64 (class)) * 1 (valid)
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##os.Darwin
|
||||||
|
|
||||||
|
0 = (1000 + 2 (os)) * 0 (invalid)
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##os.Darwin,hostname.host1
|
||||||
|
|
||||||
|
0 = (1000 + 2 (os) + 32 (hostname)) * 0 (invalid)
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##os.Darwin,hostname.host2
|
||||||
|
|
||||||
|
0 = (1000 + 2 (os) + 32 (hostname)) * 0 (invalid)
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##os.Linux
|
||||||
|
|
||||||
|
1002 = (1000 + 2 (os)) * 1 (valid)
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##os.Linux,hostname.host1
|
||||||
|
|
||||||
|
1034 = (1000 + 2 (os) + 32 (hostname)) * 1 (valid)
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##os.Linux,hostname.host2
|
||||||
|
|
||||||
|
1034 = (1000 + 2 (os) + 32 (hostname)) * 0 (invalid)
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##~os.Linux,~os.Darwin,~os.SunOS
|
||||||
|
|
||||||
|
1006 = (1000 + 2 (~os) + 2 (~os) + 2 (~os)) * 0 (invalid)
|
||||||
|
|
||||||
|
In this case, with a Linux server named "host1" with class set to "Work", the link will
|
||||||
|
be:
|
||||||
|
|
||||||
|
.IR $HOME/path/example.txt " -> " $HOME/path/example.txt##class.Work
|
||||||
|
|
||||||
Links are also created for directories named this way, as long as they have at
|
Links are also created for directories named this way, as long as they have at
|
||||||
least one yadm managed file within them.
|
least one yadm managed file within them.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user