2015-07-16 20:38:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## NAME
|
|
|
|
|
yadm - Yet Another Dotfiles Manager
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
## SYNOPSIS
|
|
|
|
|
yadm command [options]
|
|
|
|
|
|
|
|
|
|
yadm git-command-or-alias [options]
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
yadm init [-f] [-w dir]
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
yadm clone url [-f] [-w dir] [-b branch] [--bootstrap] [--no-bootstrap]
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
|
|
|
|
yadm config name [value]
|
|
|
|
|
|
|
|
|
|
yadm config [-e]
|
|
|
|
|
|
|
|
|
|
yadm list [-a]
|
|
|
|
|
|
2017-02-10 17:32:07 -05:00
|
|
|
|
yadm bootstrap
|
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
yadm encrypt
|
|
|
|
|
|
2015-07-16 21:57:53 -04:00
|
|
|
|
yadm decrypt [-l]
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
|
|
|
|
yadm alt
|
|
|
|
|
|
|
|
|
|
yadm perms
|
|
|
|
|
|
2019-12-17 08:15:58 -05:00
|
|
|
|
yadm enter [ command ]
|
|
|
|
|
|
|
|
|
|
yadm git-crypt [ options ]
|
|
|
|
|
|
2020-08-08 16:08:23 -04:00
|
|
|
|
yadm transcrypt [ options ]
|
|
|
|
|
|
2021-01-07 10:24:11 -05:00
|
|
|
|
yadm upgrade [-f]
|
2019-11-07 08:58:14 -05:00
|
|
|
|
|
2017-05-04 08:22:48 -04:00
|
|
|
|
yadm introspect category
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
## DESCRIPTION
|
2023-01-23 14:25:54 -05:00
|
|
|
|
yadm is a tool for managing a collection of files across multiple com‐
|
|
|
|
|
puters, using a shared Git repository. In addition, yadm provides a
|
|
|
|
|
feature to select alternate versions of files for particular systems.
|
|
|
|
|
Lastly, yadm supplies the ability to manage a subset of secure files,
|
2019-11-07 08:58:14 -05:00
|
|
|
|
which are encrypted before they are included in the repository.
|
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
|
|
|
|
## COMMANDS
|
|
|
|
|
git-command or git-alias
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Any command not internally handled by yadm is passed through to
|
|
|
|
|
git(1). Git commands or aliases are invoked with the yadm man‐
|
2017-04-03 08:09:32 -04:00
|
|
|
|
aged repository. The working directory for Git commands will be
|
2015-07-16 20:38:43 -04:00
|
|
|
|
the configured work-tree (usually $HOME).
|
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Dotfiles are managed by using standard git commands; add, com‐
|
2015-07-16 20:38:43 -04:00
|
|
|
|
mit, push, pull, etc.
|
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
The config command is not passed directly through. Instead use
|
2015-07-16 20:38:43 -04:00
|
|
|
|
the gitconfig command (see below).
|
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
alt Create symbolic links and process templates for any managed
|
|
|
|
|
files matching the naming rules described in the ALTERNATES and
|
|
|
|
|
TEMPLATES sections. It is usually unnecessary to run this com‐
|
|
|
|
|
mand, as yadm automatically processes alternates by default.
|
|
|
|
|
This automatic behavior can be disabled by setting the configu‐
|
2017-04-03 08:09:32 -04:00
|
|
|
|
ration yadm.auto-alt to "false".
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2017-02-10 17:32:07 -05:00
|
|
|
|
bootstrap
|
2019-11-07 08:58:14 -05:00
|
|
|
|
Execute $HOME/.config/yadm/bootstrap if it exists.
|
2017-02-10 17:32:07 -05:00
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
clone url
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Clone a remote repository for tracking dotfiles. After the con‐
|
|
|
|
|
tents of the remote repository have been fetched, a "check out"
|
|
|
|
|
of the remote HEAD branch is attempted. If there are conflict‐
|
|
|
|
|
ing files already present in the work-tree, the local version
|
|
|
|
|
will be left unmodified and you'll have to review and resolve
|
2021-04-03 13:00:02 -04:00
|
|
|
|
the difference.
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
The repository is stored in $HOME/.local/share/yadm/repo.git.
|
2020-12-30 15:58:30 -05:00
|
|
|
|
By default, $HOME will be used as the work-tree, but this can be
|
2023-01-23 14:25:54 -05:00
|
|
|
|
overridden with the -w option. yadm can be forced to overwrite
|
|
|
|
|
an existing repository by providing the -f option. If you want
|
|
|
|
|
to use a branch other than the remote HEAD branch you can spec‐
|
|
|
|
|
ify it using the -b option. By default yadm will ask the user
|
|
|
|
|
if the bootstrap program should be run (if it exists). The op‐
|
|
|
|
|
tions --bootstrap or --no-bootstrap will either force the boot‐
|
|
|
|
|
strap to be run, or prevent it from being run, without prompting
|
|
|
|
|
the user.
|
|
|
|
|
|
|
|
|
|
config This command manages configurations for yadm. This command
|
2020-08-08 16:08:23 -04:00
|
|
|
|
works exactly the way git-config(1) does. See the CONFIGURATION
|
|
|
|
|
section for more details.
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
|
|
|
|
decrypt
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Decrypt all files stored in $HOME/.local/share/yadm/archive.
|
|
|
|
|
Files decrypted will be relative to the configured work-tree
|
2020-12-30 15:58:30 -05:00
|
|
|
|
(usually $HOME). Using the -l option will list the files stored
|
|
|
|
|
without extracting them.
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
|
|
|
|
encrypt
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Encrypt all files matching the patterns found in $HOME/.con‐
|
|
|
|
|
fig/yadm/encrypt. See the ENCRYPTION section for more details.
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2017-04-03 08:09:32 -04:00
|
|
|
|
enter Run a sub-shell with all Git variables set. Exit the sub-shell
|
|
|
|
|
the same way you leave your normal shell (usually with the
|
|
|
|
|
"exit" command). This sub-shell can be used to easily interact
|
|
|
|
|
with your yadm repository using "git" commands. This could be
|
2019-12-17 08:15:58 -05:00
|
|
|
|
useful if you are using a tool which uses Git directly, such as
|
|
|
|
|
tig, vim-fugitive, git-cola, etc.
|
2019-11-27 08:21:44 -05:00
|
|
|
|
|
2019-12-17 08:15:58 -05:00
|
|
|
|
Optionally, you can provide a command after "enter", and instead
|
|
|
|
|
of invoking your shell, that command will be run with all of the
|
|
|
|
|
Git variables exposed to the command's environment.
|
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Emacs Tramp and Magit can manage files by using this configura‐
|
2019-12-17 08:15:58 -05:00
|
|
|
|
tion:
|
2019-11-27 08:21:44 -05:00
|
|
|
|
|
2017-04-03 08:09:32 -04:00
|
|
|
|
(add-to-list 'tramp-methods
|
|
|
|
|
'("yadm"
|
|
|
|
|
(tramp-login-program "yadm")
|
|
|
|
|
(tramp-login-args (("enter")))
|
2019-11-27 08:21:44 -05:00
|
|
|
|
(tramp-login-env (("SHELL") ("/bin/sh")))
|
2017-04-03 08:09:32 -04:00
|
|
|
|
(tramp-remote-shell "/bin/sh")
|
|
|
|
|
(tramp-remote-shell-args ("-c"))))
|
|
|
|
|
|
2020-12-30 15:58:30 -05:00
|
|
|
|
With this config, use (magit-status "/yadm::").
|
2019-11-27 08:21:44 -05:00
|
|
|
|
|
2019-12-17 08:15:58 -05:00
|
|
|
|
git-crypt options
|
2023-01-23 14:25:54 -05:00
|
|
|
|
If git-crypt is installed, this command allows you to pass op‐
|
|
|
|
|
tions directly to git-crypt, with the environment configured to
|
|
|
|
|
use the yadm repository.
|
2019-12-17 08:15:58 -05:00
|
|
|
|
|
|
|
|
|
git-crypt enables transparent encryption and decryption of files
|
|
|
|
|
in a git repository. You can read https://github.com/AGWA/git-
|
|
|
|
|
crypt for details.
|
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
gitconfig
|
2019-12-17 08:15:58 -05:00
|
|
|
|
Pass options to the git config command. Since yadm already uses
|
2023-01-23 14:25:54 -05:00
|
|
|
|
the config command to manage its own configurations, this com‐
|
|
|
|
|
mand is provided as a way to change configurations of the repos‐
|
2019-12-17 08:15:58 -05:00
|
|
|
|
itory managed by yadm. One useful case might be to configure
|
|
|
|
|
the repository so untracked files are shown in status commands.
|
2015-07-26 17:56:22 -04:00
|
|
|
|
yadm initially configures its repository so that untracked files
|
2019-12-17 08:15:58 -05:00
|
|
|
|
are not shown. If you wish use the default Git behavior (to
|
2023-01-23 14:25:54 -05:00
|
|
|
|
show untracked files and directories), you can remove this con‐
|
2015-07-26 17:56:22 -04:00
|
|
|
|
figuration.
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2015-07-26 17:56:22 -04:00
|
|
|
|
yadm gitconfig --unset status.showUntrackedFiles
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
|
|
|
|
help Print a summary of yadm commands.
|
|
|
|
|
|
2019-12-17 08:15:58 -05:00
|
|
|
|
init Initialize a new, empty repository for tracking dotfiles. The
|
2020-12-30 15:58:30 -05:00
|
|
|
|
repository is stored in $HOME/.local/share/yadm/repo.git. By
|
2019-12-17 08:15:58 -05:00
|
|
|
|
default, $HOME will be used as the work-tree, but this can be
|
|
|
|
|
overridden with the -w option. yadm can be forced to overwrite
|
2019-11-07 08:58:14 -05:00
|
|
|
|
an existing repository by providing the -f option.
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
|
|
|
|
list Print a list of files managed by yadm. The -a option will cause
|
2019-12-17 08:15:58 -05:00
|
|
|
|
all managed files to be listed. Otherwise, the list will only
|
2015-07-16 20:38:43 -04:00
|
|
|
|
include files from the current directory or below.
|
|
|
|
|
|
2017-05-04 08:22:48 -04:00
|
|
|
|
introspect category
|
2019-12-17 08:15:58 -05:00
|
|
|
|
Report internal yadm data. Supported categories are commands,
|
2017-05-04 08:22:48 -04:00
|
|
|
|
configs, repo, and switches. The purpose of introspection is to
|
|
|
|
|
support command line completion.
|
|
|
|
|
|
2019-12-17 08:15:58 -05:00
|
|
|
|
perms Update permissions as described in the PERMISSIONS section. It
|
2023-01-23 14:25:54 -05:00
|
|
|
|
is usually unnecessary to run this command, as yadm automati‐
|
2019-12-17 08:15:58 -05:00
|
|
|
|
cally processes permissions by default. This automatic behavior
|
|
|
|
|
can be disabled by setting the configuration yadm.auto-perms to
|
2015-07-16 20:38:43 -04:00
|
|
|
|
"false".
|
|
|
|
|
|
2020-08-08 16:08:23 -04:00
|
|
|
|
transcrypt options
|
2023-01-23 14:25:54 -05:00
|
|
|
|
If transcrypt is installed, this command allows you to pass op‐
|
|
|
|
|
tions directly to transcrypt, with the environment configured to
|
|
|
|
|
use the yadm repository.
|
2020-08-08 16:08:23 -04:00
|
|
|
|
|
|
|
|
|
transcrypt enables transparent encryption and decryption of
|
|
|
|
|
files in a git repository. You can read
|
|
|
|
|
https://github.com/elasticdog/transcrypt for details.
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
upgrade
|
2020-12-30 15:58:30 -05:00
|
|
|
|
Version 3 of yadm uses a different directory for storing data.
|
|
|
|
|
When you start to use version 3 for the first time, you may see
|
2023-01-23 14:25:54 -05:00
|
|
|
|
warnings about moving your data to this new directory. The eas‐
|
2020-12-30 15:58:30 -05:00
|
|
|
|
iest way to accomplish this is by running "yadm upgrade". This
|
|
|
|
|
command will start by moving your yadm repo to the new path.
|
|
|
|
|
Next it will move any archive data. If the archive is tracked
|
|
|
|
|
within your yadm repo, this command will "stage" the renaming of
|
2021-01-07 10:24:11 -05:00
|
|
|
|
that file in the repo's index.
|
|
|
|
|
|
|
|
|
|
Upgrading will attempt to de-initialize and re-initialize your
|
2023-01-23 14:25:54 -05:00
|
|
|
|
submodules. If your submodules cannot be de-initialized, the up‐
|
|
|
|
|
grade will fail. The most common reason submodules will fail to
|
|
|
|
|
de-initialize is because they have local modifications. If you
|
|
|
|
|
are willing to lose the local modifications to those submodules,
|
|
|
|
|
you can use the -f option with the "upgrade" command to force
|
|
|
|
|
the de-initialization.
|
2021-01-07 10:24:11 -05:00
|
|
|
|
|
|
|
|
|
After running "yadm upgrade", you should run "yadm status" to
|
|
|
|
|
review changes which have been staged, and commit them to your
|
|
|
|
|
repository.
|
2020-12-30 15:58:30 -05:00
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
You can read https://yadm.io/docs/upgrade_from_2 for more infor‐
|
2019-11-07 08:58:14 -05:00
|
|
|
|
mation.
|
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
version
|
|
|
|
|
Print the version of yadm.
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
|
2016-04-18 18:24:04 -04:00
|
|
|
|
## OPTIONS
|
2020-12-30 15:58:30 -05:00
|
|
|
|
yadm supports a set of universal options that alter the paths it uses.
|
2023-01-23 14:25:54 -05:00
|
|
|
|
The default paths are documented in the FILES section. Any path speci‐
|
2020-12-30 15:58:30 -05:00
|
|
|
|
fied by these options must be fully qualified. If you always want to
|
|
|
|
|
override one or more of these paths, it may be useful to create an
|
|
|
|
|
alias for the yadm command. For example, the following alias could be
|
2016-04-18 18:24:04 -04:00
|
|
|
|
used to override the repository directory.
|
|
|
|
|
|
|
|
|
|
alias yadm='yadm --yadm-repo /alternate/path/to/repo'
|
|
|
|
|
|
2020-12-30 15:58:30 -05:00
|
|
|
|
The following is the full list of universal options. Each option
|
2021-04-03 13:00:02 -04:00
|
|
|
|
should be followed by a path.
|
2016-04-18 18:24:04 -04:00
|
|
|
|
|
|
|
|
|
-Y,--yadm-dir
|
2020-12-30 15:58:30 -05:00
|
|
|
|
Override the yadm directory. yadm stores its configurations
|
|
|
|
|
relative to this directory.
|
|
|
|
|
|
|
|
|
|
--yadm-data
|
|
|
|
|
Override the yadm data directory. yadm stores its data relative
|
|
|
|
|
to this directory.
|
2016-04-18 18:24:04 -04:00
|
|
|
|
|
|
|
|
|
--yadm-repo
|
|
|
|
|
Override the location of the yadm repository.
|
|
|
|
|
|
|
|
|
|
--yadm-config
|
|
|
|
|
Override the location of the yadm configuration file.
|
|
|
|
|
|
|
|
|
|
--yadm-encrypt
|
|
|
|
|
Override the location of the yadm encryption configuration.
|
|
|
|
|
|
|
|
|
|
--yadm-archive
|
|
|
|
|
Override the location of the yadm encrypted files archive.
|
|
|
|
|
|
2017-02-10 17:32:07 -05:00
|
|
|
|
--yadm-bootstrap
|
|
|
|
|
Override the location of the yadm bootstrap program.
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
## CONFIGURATION
|
2019-12-17 08:15:58 -05:00
|
|
|
|
yadm uses a configuration file named $HOME/.config/yadm/config. This
|
|
|
|
|
file uses the same format as git-config(1). Also, you can control the
|
|
|
|
|
contents of the configuration file via the yadm config command (which
|
2015-07-16 20:38:43 -04:00
|
|
|
|
works exactly like git-config). For example, to disable alternates you
|
|
|
|
|
can run the command:
|
|
|
|
|
|
|
|
|
|
yadm config yadm.auto-alt false
|
|
|
|
|
|
|
|
|
|
The following is the full list of supported configurations:
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
yadm.alt-copy
|
2023-01-23 14:25:54 -05:00
|
|
|
|
If set to "true", alternate files will be copies instead of sym‐
|
2019-12-17 08:15:58 -05:00
|
|
|
|
bolic links. This might be desirable, because some systems may
|
2019-11-07 08:58:14 -05:00
|
|
|
|
not properly support symlinks.
|
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
yadm.auto-alt
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Disable the automatic linking described in the section ALTER‐
|
2019-12-17 08:15:58 -05:00
|
|
|
|
NATES. If disabled, you may still run "yadm alt" manually to
|
2023-01-23 14:25:54 -05:00
|
|
|
|
create the alternate links. This feature is enabled by default.
|
2019-11-07 08:58:14 -05:00
|
|
|
|
|
|
|
|
|
yadm.auto-exclude
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Disable the automatic exclusion of patterns defined in
|
2019-11-07 08:58:14 -05:00
|
|
|
|
$HOME/.config/yadm/encrypt. This feature is enabled by default.
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
|
|
|
|
yadm.auto-perms
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Disable the automatic permission changes described in the sec‐
|
2019-12-17 08:15:58 -05:00
|
|
|
|
tion PERMISSIONS. If disabled, you may still run yadm perms
|
2023-01-23 14:25:54 -05:00
|
|
|
|
manually to update permissions. This feature is enabled by de‐
|
|
|
|
|
fault.
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2017-08-23 08:28:35 -04:00
|
|
|
|
yadm.auto-private-dirs
|
2019-12-17 08:15:58 -05:00
|
|
|
|
Disable the automatic creating of private directories described
|
2017-08-23 08:28:35 -04:00
|
|
|
|
in the section PERMISSIONS.
|
|
|
|
|
|
2020-12-30 15:58:30 -05:00
|
|
|
|
yadm.cipher
|
|
|
|
|
Configure which encryption system is used by the encrypt/decrypt
|
|
|
|
|
commands. Valid options are "gpg" and "openssl". The default is
|
2023-01-23 14:25:54 -05:00
|
|
|
|
"gpg". Detailed information can be found in the section ENCRYP‐
|
2020-12-30 15:58:30 -05:00
|
|
|
|
TION.
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
yadm.git-program
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Specify an alternate program to use instead of "git". By de‐
|
|
|
|
|
fault, the first "git" found in $PATH is used.
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2015-08-12 01:56:36 -04:00
|
|
|
|
yadm.gpg-perms
|
2020-12-30 15:58:30 -05:00
|
|
|
|
Disable the permission changes to $HOME/.gnupg/*. This feature
|
2015-08-12 01:56:36 -04:00
|
|
|
|
is enabled by default.
|
|
|
|
|
|
2016-09-08 09:08:22 -04:00
|
|
|
|
yadm.gpg-program
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Specify an alternate program to use instead of "gpg". By de‐
|
|
|
|
|
fault, the first "gpg" found in $PATH is used.
|
2016-09-08 09:08:22 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
yadm.gpg-recipient
|
|
|
|
|
Asymmetrically encrypt files with a gpg public/private key pair.
|
2020-12-30 15:58:30 -05:00
|
|
|
|
Provide a "key ID" to specify which public key to encrypt with.
|
2020-02-06 08:53:18 -05:00
|
|
|
|
The key must exist in your public keyrings. Multiple recipients
|
2020-12-30 15:58:30 -05:00
|
|
|
|
can be specified (separated by space). If left blank or not
|
|
|
|
|
provided, symmetric encryption is used instead. If set to
|
2023-01-23 14:25:54 -05:00
|
|
|
|
"ASK", gpg will interactively ask for recipients. See the EN‐
|
|
|
|
|
CRYPTION section for more details. This feature is disabled by
|
|
|
|
|
default.
|
2017-01-12 18:15:24 -05:00
|
|
|
|
|
2020-12-30 15:58:30 -05:00
|
|
|
|
yadm.openssl-ciphername
|
|
|
|
|
Specify which cipher should be used by openssl. "aes-256-cbc"
|
|
|
|
|
is used by default.
|
|
|
|
|
|
|
|
|
|
yadm.openssl-old
|
|
|
|
|
Newer versions of openssl support the pbkdf2 key derivation
|
|
|
|
|
function. This is used by default. If this configuration is set
|
|
|
|
|
to "true", openssl operations will use options compatible with
|
|
|
|
|
older versions of openssl. If you change this option, you will
|
|
|
|
|
need to recreate your encrypted archive.
|
|
|
|
|
|
|
|
|
|
yadm.openssl-program
|
|
|
|
|
Specify an alternate program to use instead of "openssl". By
|
|
|
|
|
default, the first "openssl" found in $PATH is used.
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
yadm.ssh-perms
|
|
|
|
|
Disable the permission changes to $HOME/.ssh/*. This feature is
|
|
|
|
|
enabled by default.
|
2017-07-10 00:07:50 -04:00
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
The following five "local" configurations are not stored in the
|
2019-11-07 08:58:14 -05:00
|
|
|
|
$HOME/.config/yadm/config, they are stored in the local repository.
|
2017-02-10 17:32:07 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local.class
|
2020-12-30 15:58:30 -05:00
|
|
|
|
Specify a class for the purpose of symlinking alternate files.
|
2023-01-23 14:25:54 -05:00
|
|
|
|
By default, no class will be matched. The local host can be as‐
|
|
|
|
|
signed multiple classes using command:
|
2022-03-16 10:26:11 -04:00
|
|
|
|
|
|
|
|
|
yadm config --add local.class <additional-class>
|
|
|
|
|
|
|
|
|
|
local.arch
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Override the architecture for the purpose of symlinking alter‐
|
2022-03-16 10:26:11 -04:00
|
|
|
|
nate files.
|
2017-02-10 17:32:07 -05:00
|
|
|
|
|
|
|
|
|
local.hostname
|
2020-12-30 15:58:30 -05:00
|
|
|
|
Override the hostname for the purpose of symlinking alternate
|
2017-02-10 17:32:07 -05:00
|
|
|
|
files.
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
local.os
|
|
|
|
|
Override the OS for the purpose of symlinking alternate files.
|
|
|
|
|
|
2017-02-10 17:32:07 -05:00
|
|
|
|
local.user
|
2019-11-07 08:58:14 -05:00
|
|
|
|
Override the user for the purpose of symlinking alternate files.
|
|
|
|
|
|
2017-02-10 17:32:07 -05:00
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
## ALTERNATES
|
|
|
|
|
When managing a set of files across different systems, it can be useful
|
|
|
|
|
to have an automated way of choosing an alternate version of a file for
|
2019-11-07 08:58:14 -05:00
|
|
|
|
a different operating system, host, user, etc.
|
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
yadm will automatically create a symbolic link to the appropriate ver‐
|
|
|
|
|
sion of a file, when a valid suffix is appended to the filename. The
|
|
|
|
|
suffix contains the conditions that must be met for that file to be
|
2019-11-07 08:58:14 -05:00
|
|
|
|
used.
|
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
The suffix begins with "##", followed by any number of conditions sepa‐
|
2019-11-07 08:58:14 -05:00
|
|
|
|
rated by commas.
|
|
|
|
|
|
|
|
|
|
##<condition>[,<condition>,...]
|
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Each condition is an attribute/value pair, separated by a period. Some
|
|
|
|
|
conditions do not require a "value", and in that case, the period and
|
|
|
|
|
value can be omitted. Most attributes can be abbreviated as a single
|
2019-11-07 08:58:14 -05:00
|
|
|
|
letter.
|
|
|
|
|
|
|
|
|
|
<attribute>[.<value>]
|
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
These are the supported attributes, in the order of the weighted prece‐
|
2019-11-07 08:58:14 -05:00
|
|
|
|
dence:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template, t
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Valid when the value matches a supported template processor.
|
2019-11-07 08:58:14 -05:00
|
|
|
|
See the TEMPLATES section for more details.
|
|
|
|
|
|
|
|
|
|
user, u
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Valid if the value matches the current user. Current user is
|
2019-11-07 08:58:14 -05:00
|
|
|
|
calculated by running id -u -n.
|
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
hostname, h
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Valid if the value matches the short hostname. Hostname is cal‐
|
2022-03-16 10:26:11 -04:00
|
|
|
|
culated by running uname -n, and trimming off any domain.
|
|
|
|
|
|
|
|
|
|
class, c
|
|
|
|
|
Valid if the value matches the local.class configuration. Class
|
|
|
|
|
must be manually set using yadm config local.class <class>. See
|
2023-01-23 14:25:54 -05:00
|
|
|
|
the CONFIGURATION section for more details about setting lo‐
|
|
|
|
|
cal.class.
|
2022-03-16 10:26:11 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
distro, d
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Valid if the value matches the distro. Distro is calculated by
|
|
|
|
|
running lsb_release -si or by inspecting the ID from /etc/os-re‐
|
|
|
|
|
lease.
|
2019-11-07 08:58:14 -05:00
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
distro_family, f
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Valid if the value matches the distro family. Distro family is
|
|
|
|
|
calculated by inspecting the ID_LIKE line from /etc/os-release.
|
2022-03-16 10:26:11 -04:00
|
|
|
|
|
2020-12-30 15:58:30 -05:00
|
|
|
|
os, o Valid if the value matches the OS. OS is calculated by running
|
2019-11-07 08:58:14 -05:00
|
|
|
|
uname -s.
|
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
arch, a
|
|
|
|
|
Valid if the value matches the architecture. Architecture is
|
|
|
|
|
calculated by running uname -m.
|
2019-11-07 08:58:14 -05:00
|
|
|
|
|
|
|
|
|
default
|
|
|
|
|
Valid when no other alternate is valid.
|
|
|
|
|
|
2020-12-30 15:58:30 -05:00
|
|
|
|
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
|
2022-03-16 10:26:11 -04:00
|
|
|
|
certain extension to e.g. make editors highlight the content
|
2020-12-30 15:58:30 -05:00
|
|
|
|
properly.
|
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
NOTE: The OS for "Windows Subsystem for Linux" is reported as "WSL",
|
2019-11-27 08:21:44 -05:00
|
|
|
|
even though uname identifies as "Linux".
|
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
You may use any number of conditions, in any order. An alternate will
|
|
|
|
|
only be used if ALL conditions are valid. For all files managed by
|
|
|
|
|
yadm's repository or listed in $HOME/.config/yadm/encrypt, if they
|
|
|
|
|
match this naming convention, symbolic links will be created for the
|
2019-11-07 08:58:14 -05:00
|
|
|
|
most appropriate version.
|
|
|
|
|
|
|
|
|
|
The "most appropriate" version is determined by calculating a score for
|
2022-03-16 10:26:11 -04:00
|
|
|
|
each version of a file. A template is always scored higher than any
|
|
|
|
|
symlink condition. The number of conditions is the next largest factor
|
2023-01-23 14:25:54 -05:00
|
|
|
|
in scoring. Files with more conditions will always be favored. Any in‐
|
|
|
|
|
valid condition will disqualify that file completely.
|
2019-11-07 08:58:14 -05:00
|
|
|
|
|
|
|
|
|
If you don't care to have all versions of alternates stored in the same
|
|
|
|
|
directory as the generated symlink, you can place them in the
|
2022-03-16 10:26:11 -04:00
|
|
|
|
$HOME/.config/yadm/alt directory. The generated symlink or processed
|
2019-11-07 08:58:14 -05:00
|
|
|
|
template will be created using the same relative path.
|
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
Alternate linking may best be demonstrated by example. Assume the fol‐
|
2019-11-07 08:58:14 -05:00
|
|
|
|
lowing files are managed by yadm's repository:
|
|
|
|
|
|
|
|
|
|
- $HOME/path/example.txt##default
|
|
|
|
|
- $HOME/path/example.txt##class.Work
|
|
|
|
|
- $HOME/path/example.txt##os.Darwin
|
|
|
|
|
- $HOME/path/example.txt##os.Darwin,hostname.host1
|
|
|
|
|
- $HOME/path/example.txt##os.Darwin,hostname.host2
|
|
|
|
|
- $HOME/path/example.txt##os.Linux
|
|
|
|
|
- $HOME/path/example.txt##os.Linux,hostname.host1
|
|
|
|
|
- $HOME/path/example.txt##os.Linux,hostname.host2
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
|
|
|
|
If running on a Macbook named "host2", yadm will create a symbolic link
|
|
|
|
|
which looks like this:
|
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
$HOME/path/example.txt -> $HOME/path/example.txt##os.Darwin,host‐
|
2019-11-07 08:58:14 -05:00
|
|
|
|
name.host2
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
However, on another Mackbook named "host3", yadm will create a symbolic
|
2015-07-16 20:38:43 -04:00
|
|
|
|
link which looks like this:
|
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
$HOME/path/example.txt -> $HOME/path/example.txt##os.Darwin
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
Since the hostname doesn't match any of the managed files, the more
|
2015-07-16 20:38:43 -04:00
|
|
|
|
generic version is chosen.
|
|
|
|
|
|
2015-07-19 13:06:51 -04:00
|
|
|
|
If running on a Linux server named "host4", the link will be:
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
$HOME/path/example.txt -> $HOME/path/example.txt##os.Linux
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
If running on a Solaris server, the link will use the default version:
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
$HOME/path/example.txt -> $HOME/path/example.txt##default
|
2015-07-19 13:06:51 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
If running on a system, with class set to "Work", the link will be:
|
2017-02-10 17:32:07 -05:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
$HOME/path/example.txt -> $HOME/path/example.txt##class.Work
|
2017-02-10 17:32:07 -05:00
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
If no "##default" version exists and no files have valid conditions,
|
2019-11-07 08:58:14 -05:00
|
|
|
|
then no link will be created.
|
2015-07-19 13:06:51 -04:00
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
Links are also created for directories named this way, as long as they
|
|
|
|
|
have at least one yadm managed file within them (at the top level).
|
2016-09-08 09:08:22 -04:00
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
yadm will automatically create these links by default. This can be dis‐
|
2022-03-16 10:26:11 -04:00
|
|
|
|
abled using the yadm.auto-alt configuration. Even if disabled, links
|
2019-11-07 08:58:14 -05:00
|
|
|
|
can be manually created by running yadm alt.
|
2017-02-10 17:32:07 -05:00
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
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
|
2017-02-10 17:32:07 -05:00
|
|
|
|
set like any other yadm configuration with the yadm config command. The
|
2019-11-07 08:58:14 -05:00
|
|
|
|
following sets the class to be "Work".
|
2017-02-10 17:32:07 -05:00
|
|
|
|
|
|
|
|
|
yadm config local.class Work
|
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
Similarly, the values of architecture, os, hostname, and user can be
|
2023-01-23 14:25:54 -05:00
|
|
|
|
manually overridden using the configuration options local.arch, lo‐
|
|
|
|
|
cal.os, local.hostname, and local.user.
|
2017-02-10 17:32:07 -05:00
|
|
|
|
|
2015-07-16 20:38:43 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
## TEMPLATES
|
2022-03-16 10:26:11 -04:00
|
|
|
|
If a template condition is defined in an alternate file's "##" suffix,
|
2019-11-07 08:58:14 -05:00
|
|
|
|
and the necessary dependencies for the template are available, then the
|
|
|
|
|
file will be processed to create or overwrite files.
|
2017-04-03 08:09:32 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
Supported template processors:
|
2017-04-03 08:09:32 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
default
|
2022-03-16 10:26:11 -04:00
|
|
|
|
This is yadm's built-in template processor. This processor is
|
2023-01-23 14:25:54 -05:00
|
|
|
|
very basic, with a Jinja-like syntax. The advantage of this pro‐
|
2022-03-16 10:26:11 -04:00
|
|
|
|
cessor is that it only depends upon awk, which is available on
|
|
|
|
|
most *nix systems. To use this processor, specify the value of
|
2019-11-07 08:58:14 -05:00
|
|
|
|
"default" or just leave the value off (e.g. "##template").
|
2017-04-03 08:09:32 -04:00
|
|
|
|
|
2020-08-08 16:08:23 -04:00
|
|
|
|
ESH ESH is a template processor written in POSIX compliant shell. It
|
2022-03-16 10:26:11 -04:00
|
|
|
|
allows executing shell commands within templates. This can be
|
|
|
|
|
used to reference your own configurations within templates, for
|
2020-08-08 16:08:23 -04:00
|
|
|
|
example:
|
|
|
|
|
|
|
|
|
|
<% yadm config mysection.myconfig %>
|
|
|
|
|
|
|
|
|
|
To use the ESH template processor, specify the value of "esh"
|
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|
|
|
j2cli To use the j2cli Jinja template processor, specify the value of
|
2019-11-07 08:58:14 -05:00
|
|
|
|
"j2" or "j2cli".
|
2017-04-03 08:09:32 -04:00
|
|
|
|
|
2019-11-07 08:58:14 -05:00
|
|
|
|
envtpl To use the envtpl Jinja template processor, specify the value of
|
|
|
|
|
"j2" or "envtpl".
|
2017-07-10 00:07:50 -04:00
|
|
|
|
|
2023-01-23 14:25:54 -05:00
|
|
|
|
NOTE: Specifying "j2" as the processor will attempt to use j2cli or en‐
|
|
|
|
|
vtpl, whichever is available.
|
2019-11-07 08:58:14 -05:00
|
|
|
|
|
2022-03-16 10:26:11 -04:00
|
|