Skip to content

Commit

Permalink
Add a default alternate suffix of ##
Browse files Browse the repository at this point in the history
Now yadm chooses these three suffixes in order:
 - `##SYSTEM.HOSTNAME`
 - `##SYSTEM`
 - `##`
  • Loading branch information
TheLocehiliosan committed Jul 19, 2015
1 parent 614b2cd commit 2024bd0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion yadm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function alt() {
#; regex for matching "<file>##SYSTEM.HOSTNAME"
match_system=$(uname -s)
match_host=$(hostname -s)
match="^(.+)##($match_system|$match_system.$match_host)$"
match="^(.+)##($match_system|$match_system.$match_host|())$"

#; process relative to YADM_WORK
YADM_WORK=$(git config core.worktree)
Expand Down
20 changes: 12 additions & 8 deletions yadm.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
convention.
.B yadm
can detect files with names ending with:
can detect files with names ending in:

.RS
.BR ##SYSTEM " or " ##SYSTEM.HOSTNAME
.BR ##OS.HOSTNAME " or " ##OS " or " ##
.RE

If there are any files managed by
Expand All @@ -261,6 +261,7 @@ This may best be demonstrated by example. Assume the following files are managed
.BR yadm \'s
repository:

- $HOME/path/example.txt##
- $HOME/path/example.txt##Darwin
- $HOME/path/example.txt##Darwin.host1
- $HOME/path/example.txt##Darwin.host2
Expand All @@ -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.

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

If running on a Solaris server, no link will be created because there are no
files managed for that SYSTEM.
If running on a Solaris server, the link use the default "##" version:

SYSTEM is determined by running
.B uname\ -s
HOSTNAME by running
.IR $HOME/path/example.txt " -> " $HOME/path/example.txt##

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 .
.B yadm
will automatically create these links by default. This can be disabled using the
Expand Down
17 changes: 11 additions & 6 deletions yadm.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,16 @@
a different operation system or simply for a different host. yadm
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 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
naming convention, symbolic links will be created for the most appro-
priate version. This may best be demonstrated by example. Assume the
following files are managed by yadm's repository:

- $HOME/path/example.txt##
- $HOME/path/example.txt##Darwin
- $HOME/path/example.txt##Darwin.host1
- $HOME/path/example.txt##Darwin.host2
Expand All @@ -178,14 +179,18 @@
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:

$HOME/path/example.txt -> $HOME/path/example.txt##Linux

If running on a Solaris server, no link will be created because there
are no files managed for that SYSTEM.
If running on a Solaris server, the link use the default "##" version:

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
can be disabled using the yadm.auto-alt configuration. Even if dis-
abled, links can be manually created by running yadm alt.
Expand Down

0 comments on commit 2024bd0

Please sign in to comment.