Add a default alternate suffix of ##
Now yadm chooses these three suffixes in order: - `##SYSTEM.HOSTNAME` - `##SYSTEM` - `##`
This commit is contained in:
parent
614b2cd8b8
commit
2024bd0bf1
3 changed files with 24 additions and 15 deletions
2
yadm
2
yadm
|
@ -107,7 +107,7 @@ function alt() {
|
||||||
#; regex for matching "<file>##SYSTEM.HOSTNAME"
|
#; regex for matching "<file>##SYSTEM.HOSTNAME"
|
||||||
match_system=$(uname -s)
|
match_system=$(uname -s)
|
||||||
match_host=$(hostname -s)
|
match_host=$(hostname -s)
|
||||||
match="^(.+)##($match_system|$match_system.$match_host)$"
|
match="^(.+)##($match_system|$match_system.$match_host|())$"
|
||||||
|
|
||||||
#; process relative to YADM_WORK
|
#; process relative to YADM_WORK
|
||||||
YADM_WORK=$(git config core.worktree)
|
YADM_WORK=$(git config core.worktree)
|
||||||
|
|
20
yadm.1
20
yadm.1
|
@ -247,10 +247,10 @@ implements a feature which will automatically create a symbolic link to
|
||||||
the appropriate version of a file, as long as you follow a specific naming
|
the appropriate version of a file, as long as you follow a specific naming
|
||||||
convention.
|
convention.
|
||||||
.B yadm
|
.B yadm
|
||||||
can detect files with names ending with:
|
can detect files with names ending in:
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
.BR ##SYSTEM " or " ##SYSTEM.HOSTNAME
|
.BR ##OS.HOSTNAME " or " ##OS " or " ##
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
If there are any files managed by
|
If there are any files managed by
|
||||||
|
@ -261,6 +261,7 @@ This may best be demonstrated by example. Assume the following files are managed
|
||||||
.BR yadm \'s
|
.BR yadm \'s
|
||||||
repository:
|
repository:
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##
|
||||||
- $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
|
||||||
|
@ -282,16 +283,19 @@ will create a symbolic link which looks like this:
|
||||||
|
|
||||||
Since the hostname doesn't match any of the managed files, the more generic version is chosen.
|
Since the hostname doesn't match any of the managed files, the more generic 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:
|
||||||
|
|
||||||
.IR $HOME/path/example.txt " -> " $HOME/path/example.txt##Linux
|
.IR $HOME/path/example.txt " -> " $HOME/path/example.txt##Linux
|
||||||
|
|
||||||
If running on a Solaris server, no link will be created because there are no
|
If running on a Solaris server, the link use the default "##" version:
|
||||||
files managed for that SYSTEM.
|
|
||||||
|
|
||||||
SYSTEM is determined by running
|
.IR $HOME/path/example.txt " -> " $HOME/path/example.txt##
|
||||||
.B uname\ -s
|
|
||||||
HOSTNAME by running
|
If no "##" version exists and no files match the current OS or HOSTNAME, then no link will be created.
|
||||||
|
|
||||||
|
OS is determined by running
|
||||||
|
.BR uname\ -s ,
|
||||||
|
and HOSTNAME by running
|
||||||
.BR hostname\ -s .
|
.BR hostname\ -s .
|
||||||
.B yadm
|
.B yadm
|
||||||
will automatically create these links by default. This can be disabled using the
|
will automatically create these links by default. This can be disabled using the
|
||||||
|
|
17
yadm.md
17
yadm.md
|
@ -149,15 +149,16 @@
|
||||||
a different operation system or simply for a different host. yadm
|
a different operation system or simply for a different host. yadm
|
||||||
implements a feature which will automatically create a symbolic link to
|
implements a feature which will automatically create a symbolic link to
|
||||||
the appropriate version of a file, as long as you follow a specific
|
the appropriate version of a file, as long as you follow a specific
|
||||||
naming convention. yadm can detect files with names ending with:
|
naming convention. yadm can detect files with names ending in:
|
||||||
|
|
||||||
##SYSTEM or ##SYSTEM.HOSTNAME
|
##OS.HOSTNAME or ##OS or ##
|
||||||
|
|
||||||
If there are any files managed by yadm's repository which match this
|
If there are any files managed by yadm's repository which match this
|
||||||
naming convention, symbolic links will be created for the most appro-
|
naming convention, symbolic links will be created for the most appro-
|
||||||
priate version. This may best be demonstrated by example. Assume the
|
priate version. This may best be demonstrated by example. Assume the
|
||||||
following files are managed by yadm's repository:
|
following files are managed by yadm's repository:
|
||||||
|
|
||||||
|
- $HOME/path/example.txt##
|
||||||
- $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
|
||||||
|
@ -178,14 +179,18 @@
|
||||||
Since the hostname doesn't match any of the managed files, the more
|
Since the hostname doesn't match any of the managed files, the more
|
||||||
generic version is chosen.
|
generic 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:
|
||||||
|
|
||||||
$HOME/path/example.txt -> $HOME/path/example.txt##Linux
|
$HOME/path/example.txt -> $HOME/path/example.txt##Linux
|
||||||
|
|
||||||
If running on a Solaris server, no link will be created because there
|
If running on a Solaris server, the link use the default "##" version:
|
||||||
are no files managed for that SYSTEM.
|
|
||||||
|
|
||||||
SYSTEM is determined by running uname -s HOSTNAME by running host-
|
$HOME/path/example.txt -> $HOME/path/example.txt##
|
||||||
|
|
||||||
|
If no "##" version exists and no files match the current OS or HOST-
|
||||||
|
NAME, then no link will be created.
|
||||||
|
|
||||||
|
OS is determined by running uname -s, and HOSTNAME by running host-
|
||||||
name -s. yadm will automatically create these links by default. This
|
name -s. yadm will automatically create these links by default. This
|
||||||
can be disabled using the yadm.auto-alt configuration. Even if dis-
|
can be disabled using the yadm.auto-alt configuration. Even if dis-
|
||||||
abled, links can be manually created by running yadm alt.
|
abled, links can be manually created by running yadm alt.
|
||||||
|
|
Loading…
Reference in a new issue