Release 2.0.0

Update version number and update documentation

* Support XDG base directory specification
* Redesign alternate processing
* Add built-in default template processor
* Allow storing alternates in yadm dir (#90)
* Add support for j2cli template processor
* Ignore encrypted files (#69)
* Support DISTRO in alternates (#72)
* Support `source` in templates (#163)
* Change yadm.cygwin-copy to yadm.alt-copy
* Support `-b <branch>` when cloning (#133)
* Support includes for j2-based templates (#114)
* Remove stale/invalid linked alternates (#65)
* Add support for Mingw/Msys (#102)
* Allow `-l` to pass thru to the `yadm config` command
* Improve processing of `yadm/encrypt`
* Fix bugs in legacy alternate processing
* Fix bug with hidden private files
* Improve support for older versions of Git
* Add upgrade command
This commit is contained in:
Tim Byrne 2019-11-07 07:58:14 -06:00
parent 5b105e0687
commit de73c9f4b4
No known key found for this signature in database
GPG Key ID: 14DB4FC2465A4B12
6 changed files with 352 additions and 276 deletions

View File

@ -1,55 +0,0 @@
## New release checklist
○ Version bump EVERYTHING
○ Copyright year update?
○ Rebuild contribs
○ Rebuild man
○ Update specfile
○ Update CHANGES
○ Tag X.XX
○ Merge dev → master
○ Update Homebrew
○ Update Copr
○ Tweet
## Homebrew update
brew update
cd $(brew --repo homebrew/core)
git fetch --unshallow origin # only if still a shallow clone,
#this might just fail if this was already done
git remote add TheLocehiliosan git@github.com:TheLocehiliosan/homebrew-core.git
git push -f TheLocehiliosan master:master
vim Formula/yadm.rb
brew install --build-from-source yadm
brew reinstall --verbose --debug yadm (✗₂)
brew audit --strict yadm
brew test yadm
git add Formula/yadm.rb
git commit -S -m 'yadm X.XX'
git push TheLocehiliosan master:yadm-X.XX
Open pull request
## Copr update
checkout yadm-rpm
bring in yadm.spec from yadm repo
update version in Makefile
make tarball
make buildhost
cd yadm-rpm
because centos 6,7...
add 'Group: Development/Tools'
disable BuildRequires
disable %check
fedpkg --dist f25 local
that should leave a src RPM in the yadm-rpm dir
create a new build by uploading the src rpm to copr

21
CHANGES
View File

@ -1,3 +1,24 @@
2.0.0
* Support XDG base directory specification
* Redesign alternate processing
* Add built-in default template processor
* Allow storing alternates in yadm dir (#90)
* Add support for j2cli template processor
* Ignore encrypted files (#69)
* Support DISTRO in alternates (#72)
* Support `source` in templates (#163)
* Change yadm.cygwin-copy to yadm.alt-copy
* Support `-b <branch>` when cloning (#133)
* Support includes for j2-based templates (#114)
* Remove stale/invalid linked alternates (#65)
* Add support for Mingw/Msys (#102)
* Allow `-l` to pass thru to the `yadm config` command
* Improve processing of `yadm/encrypt`
* Fix bugs in legacy alternate processing
* Fix bug with hidden private files
* Improve support for older versions of Git
* Add upgrade command
1.12.0 1.12.0
* Add basic Zsh completion (#71, #79) * Add basic Zsh completion (#71, #79)
* Support directories in `.yadm/encrypt` (#81, #82) * Support directories in `.yadm/encrypt` (#81, #82)

View File

@ -3,15 +3,19 @@ CONTRIBUTORS
Tim Byrne Tim Byrne
Espen Henriksen Espen Henriksen
Cameron Eagans Cameron Eagans
Ross Smith II
Klas Mellbourn Klas Mellbourn
Jan Schulz Jan Schulz
Satoshi Ohki
Siôn Le Roux Siôn Le Roux
Sébastien Gross Sébastien Gross
Thomas Luzat Thomas Luzat
Tomas Cernaj Tomas Cernaj
Uroš Golja Uroš Golja
Brayden Banks
japm48 japm48
Daniel Wagenknecht
Franciszek Madej Franciszek Madej
Mateusz Piotrowski
Paraplegic Racehorse Paraplegic Racehorse
Patrick Hof Patrick Hof
Satoshi Ohki

2
yadm
View File

@ -20,7 +20,7 @@ if [ -z "$BASH_VERSION" ]; then
[ "$YADM_TEST" != 1 ] && exec bash "$0" "$@" [ "$YADM_TEST" != 1 ] && exec bash "$0" "$@"
fi fi
VERSION=1.12.0 VERSION=2.0.0
YADM_WORK="$HOME" YADM_WORK="$HOME"
YADM_DIR= YADM_DIR=

497
yadm.md
View File

@ -4,14 +4,15 @@
## NAME ## NAME
yadm - Yet Another Dotfiles Manager yadm - Yet Another Dotfiles Manager
## SYNOPSIS ## SYNOPSIS
yadm command [options] yadm command [options]
yadm git-command-or-alias [options] yadm git-command-or-alias [options]
yadm init [-f] [-w directory] yadm init [-f] [-w dir]
yadm clone url [-f] [-w directory] [--bootstrap] [--no-bootstrap] yadm clone url [-f] [-w dir] [-b branch] [--bootstrap] [--no-bootstrap]
yadm config name [value] yadm config name [value]
@ -31,15 +32,18 @@
yadm perms yadm perms
yadm upgrade
yadm introspect category yadm introspect category
## DESCRIPTION ## DESCRIPTION
yadm is a tool for managing a collection of files across multiple com- yadm is a tool for managing a collection of files across multiple com-
puters, using a shared Git repository. In addition, yadm provides a puters, using a shared Git repository. In addition, yadm provides a
feature to select alternate versions of files based on the operating feature to select alternate versions of files for particular systems.
system or host name. Lastly, yadm supplies the ability to manage a Lastly, yadm supplies the ability to manage a subset of secure files,
subset of secure files, which are encrypted before they are included in which are encrypted before they are included in the repository.
the repository.
## COMMANDS ## COMMANDS
git-command or git-alias git-command or git-alias
@ -54,15 +58,15 @@
The config command is not passed directly through. Instead use The config command is not passed directly through. Instead use
the gitconfig command (see below). the gitconfig command (see below).
alt Create symbolic links and process Jinja templates for any man- alt Create symbolic links and process templates for any managed
aged files matching the naming rules described in the ALTERNATES files matching the naming rules described in the ALTERNATES and
and JINJA sections. It is usually unnecessary to run this com- TEMPLATES sections. It is usually unnecessary to run this com-
mand, as yadm automatically processes alternates by default. mand, as yadm automatically processes alternates by default.
This automatic behavior can be disabled by setting the configu- This automatic behavior can be disabled by setting the configu-
ration yadm.auto-alt to "false". ration yadm.auto-alt to "false".
bootstrap bootstrap
Execute $HOME/.yadm/bootstrap if it exists. Execute $HOME/.config/yadm/bootstrap if it exists.
clone url clone url
Clone a remote repository for tracking dotfiles. After the con- Clone a remote repository for tracking dotfiles. After the con-
@ -83,29 +87,30 @@
or or
yadm stash pop yadm stash pop
The repository is stored in $HOME/.yadm/repo.git. By default, The repository is stored in $HOME/.config/yadm/repo.git. By
$HOME will be used as the work-tree, but this can be overridden default, $HOME will be used as the work-tree, but this can be
with the -w option. yadm can be forced to overwrite an existing overridden with the -w option. yadm can be forced to overwrite
repository by providing the -f option. By default yadm will ask an existing repository by providing the -f option. If you want
the user if the bootstrap program should be run (if it exists). to use a branch other than origin/master, you can specify it
The options --bootstrap or --no-bootstrap will either force the using the -b option. By default yadm will ask the user if the
bootstrap to be run, or prevent it from being run, without bootstrap program should be run (if it exists). The options
prompting the user. --bootstrap or --no-bootstrap will either force the bootstrap to
be run, or prevent it from being run, without prompting the
user.
config This command manages configurations for yadm. This command config This command manages configurations for yadm. This command
works exactly they way git-config(1) does. See the CONFIGURA- works exactly they way git-config(1) does. See the CONFIGURA-
TION section for more details. TION section for more details.
decrypt decrypt
Decrypt all files stored in $HOME/.yadm/files.gpg. Files Decrypt all files stored in $HOME/.config/yadm/files.gpg. Files
decrypted will be relative to the configured work-tree (usually decrypted will be relative to the configured work-tree (usually
$HOME). Using the -l option will list the files stored without $HOME). Using the -l option will list the files stored without
extracting them. extracting them.
encrypt encrypt
Encrypt all files matching the patterns found in Encrypt all files matching the patterns found in $HOME/.con-
$HOME/.yadm/encrypt. See the ENCRYPTION section for more fig/yadm/encrypt. See the ENCRYPTION section for more details.
details.
enter Run a sub-shell with all Git variables set. Exit the sub-shell 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 the same way you leave your normal shell (usually with the
@ -137,10 +142,10 @@
help Print a summary of yadm commands. help Print a summary of yadm commands.
init Initialize a new, empty repository for tracking dotfiles. The init Initialize a new, empty repository for tracking dotfiles. The
repository is stored in $HOME/.yadm/repo.git. By default, $HOME repository is stored in $HOME/.config/yadm/repo.git. By
will be used as the work-tree, but this can be overridden with default, $HOME will be used as the work-tree, but this can be
the -w option. yadm can be forced to overwrite an existing overridden with the -w option. yadm can be forced to overwrite
repository by providing the -f option. an existing repository by providing the -f option.
list Print a list of files managed by yadm. The -a option will cause list Print a list of files managed by yadm. The -a option will cause
all managed files to be listed. Otherwise, the list will only all managed files to be listed. Otherwise, the list will only
@ -153,28 +158,67 @@
perms Update permissions as described in the PERMISSIONS section. It perms Update permissions as described in the PERMISSIONS section. It
is usually unnecessary to run this command, as yadm automati- is usually unnecessary to run this command, as yadm automati-
cally processes permissions by default. This automatic behavior cally processes permissions by default. This automatic behavior
can be disabled by setting the configuration yadm.auto-perms to can be disabled by setting the configuration yadm.auto-perms to
"false". "false".
upgrade
Version 2 of yadm uses a different directory for storing your
configurations. When you start to use version 2 for the first
time, you may see warnings about moving your data to this new
directory. The easiest 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 configuration data
to the new path. If the configurations are tracked within your
yadm repo, this command will "stage" the renaming of those files
in the repo's index. Upgrading will also re-initialize all sub-
modules you have added (otherwise they will be broken when the
repo moves). After running "yadm upgrade", you should run "yadm
status" to review changes which have been staged, and commit
them to your repository.
You can read https://yadm.io/docs/upgrade_from_1 for more infor-
mation.
version version
Print the version of yadm. Print the version of yadm.
## COMPATIBILITY
Beginning with version 2.0.0, yadm introduced a couple major changes
which may require you to adjust your configurations. See the upgrade
command for help making those adjustments.
First, yadm now uses the "XDG Base Directory Specification" to find its
configurations. You can read https://yadm.io/docs/upgrade_from_1 for
more information.
Second, the naming conventions for alternate files have been changed.
You can read https://yadm.io/docs/alternates for more information.
If you want to retain the old functionality, you can set an environment
variable, YADM_COMPATIBILITY=1. Doing so will automatically use the
old yadm directory, and process alternates the same as the pre-2.0.0
version. This compatibility mode is deprecated, and will be removed in
future versions. This mode exists solely for transitioning to the new
paths and naming of alternates.
## OPTIONS ## OPTIONS
yadm supports a set of universal options that alter the paths it uses. yadm supports a set of universal options that alter the paths it uses.
The default paths are documented in the FILES section. Any path speci- The default paths are documented in the FILES section. Any path speci-
fied by these options must be fully qualified. If you always want to 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 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 alias for the yadm command. For example, the following alias could be
used to override the repository directory. used to override the repository directory.
alias yadm='yadm --yadm-repo /alternate/path/to/repo' alias yadm='yadm --yadm-repo /alternate/path/to/repo'
The following is the full list of universal options. Each option The following is the full list of universal options. Each option
should be followed by a fully qualified path. should be followed by a fully qualified path.
-Y,--yadm-dir -Y,--yadm-dir
Override the yadm directory. yadm stores its data relative to Override the yadm directory. yadm stores its data relative to
this directory. this directory.
--yadm-repo --yadm-repo
@ -192,10 +236,11 @@
--yadm-bootstrap --yadm-bootstrap
Override the location of the yadm bootstrap program. Override the location of the yadm bootstrap program.
## CONFIGURATION ## CONFIGURATION
yadm uses a configuration file named $HOME/.yadm/config. This file yadm uses a configuration file named $HOME/.config/yadm/config. This
uses the same format as git-config(1). Also, you can control the con- file uses the same format as git-config(1). Also, you can control the
tents of the configuration file via the yadm config command (which contents of the configuration file via the yadm config command (which
works exactly like git-config). For example, to disable alternates you works exactly like git-config). For example, to disable alternates you
can run the command: can run the command:
@ -203,10 +248,23 @@
The following is the full list of supported configurations: The following is the full list of supported configurations:
yadm.alt-copy
If set to "true", alternate files will be copies instead of sym-
bolic links. This might be desirable, because some systems may
not properly support symlinks.
NOTE: The deprecated yadm.cygwin-copy option used by older ver-
sions of yadm has been replaced by yadm.alt-copy. The old
option will be removed in the next version of yadm.
yadm.auto-alt yadm.auto-alt
Disable the automatic linking described in the section ALTER- Disable the automatic linking described in the section ALTER-
NATES. If disabled, you may still run yadm alt manually to cre- NATES. If disabled, you may still run "yadm alt" manually to
ate the alternate links. This feature is enabled by default. create the alternate links. This feature is enabled by default.
yadm.auto-exclude
Disable the automatic exclusion of patterns defined in
$HOME/.config/yadm/encrypt. This feature is enabled by default.
yadm.auto-perms yadm.auto-perms
Disable the automatic permission changes described in the sec- Disable the automatic permission changes described in the sec-
@ -218,168 +276,231 @@
Disable the automatic creating of private directories described Disable the automatic creating of private directories described
in the section PERMISSIONS. in the section PERMISSIONS.
yadm.ssh-perms yadm.git-program
Disable the permission changes to $HOME/.ssh/*. This feature is Specify an alternate program to use instead of "git". By
enabled by default. default, the first "git" found in $PATH is used.
yadm.gpg-perms yadm.gpg-perms
Disable the permission changes to $HOME/.gnupg/*. This feature Disable the permission changes to $HOME/.gnupg/*. This feature
is enabled by default. is enabled by default.
yadm.gpg-recipient
Asymmetrically encrypt files with a gpg public/private key pair.
Provide a "key ID" to specify which public key to encrypt with.
The key must exist in your public keyrings. If left blank or
not provided, symmetric encryption is used instead. If set to
"ASK", gpg will interactively ask for recipients. See the
ENCRYPTION section for more details. This feature is disabled
by default.
yadm.gpg-program yadm.gpg-program
Specify an alternate program to use instead of "gpg". By Specify an alternate program to use instead of "gpg". By
default, the first "gpg" found in $PATH is used. default, the first "gpg" found in $PATH is used.
yadm.git-program yadm.gpg-recipient
Specify an alternate program to use instead of "git". By Asymmetrically encrypt files with a gpg public/private key pair.
default, the first "git" found in $PATH is used. Provide a "key ID" to specify which public key to encrypt with.
The key must exist in your public keyrings. If left blank or
not provided, symmetric encryption is used instead. If set to
"ASK", gpg will interactively ask for recipients. See the
ENCRYPTION section for more details. This feature is disabled
by default.
yadm.cygwin-copy yadm.ssh-perms
If set to "true", for Cygwin hosts, alternate files will be Disable the permission changes to $HOME/.ssh/*. This feature is
copies instead of symbolic links. This might be desirable, enabled by default.
because non-Cygwin software may not properly interpret Cygwin
symlinks.
These last four "local" configurations are not stored in the The following four "local" configurations are not stored in the
$HOME/.yadm/config, they are stored in the local repository. $HOME/.config/yadm/config, they are stored in the local repository.
local.class local.class
Specify a CLASS for the purpose of symlinking alternate files. Specify a class for the purpose of symlinking alternate files.
By default, no CLASS will be matched. By default, no class will be matched.
local.hostname
Override the hostname for the purpose of symlinking alternate
files.
local.os local.os
Override the OS for the purpose of symlinking alternate files. Override the OS for the purpose of symlinking alternate files.
local.hostname
Override the HOSTNAME for the purpose of symlinking alternate
files.
local.user local.user
Override the USER for the purpose of symlinking alternate files. Override the user for the purpose of symlinking alternate files.
## ALTERNATES ## ALTERNATES
When managing a set of files across different systems, it can be useful 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 to have an automated way of choosing an alternate version of a file for
a different operating system, host, or user. yadm implements a feature a different operating system, host, user, etc.
which will automatically create a symbolic link to the appropriate ver-
sion of a file, as long as you follow a specific naming convention.
yadm can detect files with names ending in any of the following:
## yadm will automatically create a symbolic link to the appropriate ver-
##CLASS sion of a file, when a valid suffix is appended to the filename. The
##CLASS.OS suffix contains the conditions that must be met for that file to be
##CLASS.OS.HOSTNAME used.
##CLASS.OS.HOSTNAME.USER
##OS
##OS.HOSTNAME
##OS.HOSTNAME.USER
If there are any files managed by yadm's repository, or listed in The suffix begins with "##", followed by any number of conditions sepa-
$HOME/.yadm/encrypt, which match this naming convention, symbolic links rated by commas.
will be created for the most appropriate version. This may best be
demonstrated by example. Assume the following files are managed by
yadm's repository:
- $HOME/path/example.txt## ##<condition>[,<condition>,...]
- $HOME/path/example.txt##Work
- $HOME/path/example.txt##Darwin Each condition is an attribute/value pair, separated by a period. Some
- $HOME/path/example.txt##Darwin.host1 conditions do not require a "value", and in that case, the period and
- $HOME/path/example.txt##Darwin.host2 value can be omitted. Most attributes can be abbreviated as a single
- $HOME/path/example.txt##Linux letter.
- $HOME/path/example.txt##Linux.host1
- $HOME/path/example.txt##Linux.host2 <attribute>[.<value>]
These are the supported attributes, in the order of the weighted prece-
dence:
template, t
Valid when the value matches a supported template processor.
See the TEMPLATES section for more details.
user, u
Valid if the value matches the current user. Current user is
calculated by running id -u -n.
distro, d
Valid if the value matches the distro. Distro is calculated by
running lsb_release -si.
os, o Valid if the value matches the OS. OS is calculated by running
uname -s.
class, c
Valid if the value matches the local.class configuration. Class
must be manually set using yadm config local.class <class>. See
the CONFIGURATION section for more details about setting
local.class.
hostname, h
Valid if the value matches the short hostname. Hostname is cal-
culated by running hostname, and trimming off any domain.
default
Valid when no other alternate is valid.
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
most appropriate version.
The "most appropriate" version is determined by calculating a score for
each version of a file. A template is always scored higher than any
symlink condition. The number of conditions is the next largest factor
in scoring. Files with more conditions will always be favored. Any
invalid condition will disqualify that file completely.
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
$HOME/.config/yadm/alt directory. The generated symlink or processed
template will be created using the same relative path.
Alternate linking may best be demonstrated by example. Assume the fol-
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
If running on a Macbook named "host2", yadm will create a symbolic link If running on a Macbook named "host2", yadm will create a symbolic link
which looks like this: which looks like this:
$HOME/path/example.txt -> $HOME/path/example.txt##Darwin.host2 $HOME/path/example.txt -> $HOME/path/example.txt##os.Darwin,host-
name.host2
However, on another Mackbook named "host3", yadm will create a symbolic However, on another Mackbook named "host3", yadm will create a symbolic
link which looks like this: link which looks like this:
$HOME/path/example.txt -> $HOME/path/example.txt##Darwin $HOME/path/example.txt -> $HOME/path/example.txt##os.Darwin
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##os.Linux
If running on a Solaris server, the link use the default "##" version: If running on a Solaris server, the link will use the default version:
$HOME/path/example.txt -> $HOME/path/example.txt## $HOME/path/example.txt -> $HOME/path/example.txt##default
If running on a system, with CLASS set to "Work", the link will be: If running on a system, with class set to "Work", the link will be:
$HOME/path/example.txt -> $HOME/path/example.txt##WORK $HOME/path/example.txt -> $HOME/path/example.txt##class.Work
If no "##" version exists and no files match the current CLASS/OS/HOST- If no "##default" version exists and no files have valid conditions,
NAME/USER, then no link will be created. then no link will be created.
Links are also created for directories named this way, as long as they Links are also created for directories named this way, as long as they
have at least one yadm managed file within them. have at least one yadm managed file within them.
CLASS must be manually set using yadm config local.class <class>. OS yadm will automatically create these links by default. This can be dis-
is determined by running uname -s, HOSTNAME by running hostname, and abled using the yadm.auto-alt configuration. Even if disabled, links
USER by running id -u -n. yadm will automatically create these links can be manually created by running yadm alt.
by default. This can be disabled using the yadm.auto-alt configuration.
Even if disabled, links can be manually created by running yadm alt.
It is possible to use "%" as a "wildcard" in place of CLASS, OS, HOST- Class is a special value which is stored locally on each host (inside
NAME, or USER. For example, The following file could be linked for any the local repository). To use alternate symlinks using class, you must
host when the user is "harvey". set the value of class using the configuration local.class. This is
$HOME/path/example.txt##%.%.harvey
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
set like any other yadm configuration with the yadm config command. The set like any other yadm configuration with the yadm config command. The
following sets the CLASS to be "Work". following sets the class to be "Work".
yadm config local.class Work yadm config local.class Work
Similarly, the values of OS, HOSTNAME, and USER can be manually over- Similarly, the values of os, hostname, and user can be manually over-
ridden using the configuration options local.os, local.hostname, and ridden using the configuration options local.os, local.hostname, and
local.user. local.user.
## JINJA ## TEMPLATES
If the envtpl command is available, Jinja templates will also be pro- If a template condition is defined in an alternate file's "##" suffix,
cessed to create or overwrite real files. yadm will treat files ending and the necessary dependencies for the template are available, then the
in file will be processed to create or overwrite files.
##yadm.j2 Supported template processors:
as Jinja templates. During processing, the following variables are set default
according to the rules explained in the ALTERNATES section: This is yadm's built-in template processor. This processor is
very basic, with a Jinja-like syntax. The advantage of this pro-
cessor is that it only depends upon awk, which is available on
most *nix systems. To use this processor, specify the value of
"default" or just leave the value off (e.g. "##template").
YADM_CLASS j2cli To use the j2cli Jinja template processor, specify the value of
YADM_OS "j2" or "j2cli".
YADM_HOSTNAME
YADM_USER
In addition YADM_DISTRO is exposed as the value of lsb_release -si if envtpl To use the envtpl Jinja template processor, specify the value of
lsb_release is locally available. "j2" or "envtpl".
For example, a file named whatever##yadm.j2 with the following content
{% if YADM_USER == 'harvey' -%} NOTE: Specifying "j2" as the processor will attempt to use j2cli or
config={{YADM_CLASS}}-{{ YADM_OS }} envtpl, whichever is available.
{% else -%}
If the template processor specified is available, templates will be
processed to create or overwrite files.
During processing, the following variables are available in the tem-
plate:
Default Jinja Description
------------- ------------- --------------------------
yadm.class YADM_CLASS Locally defined yadm class
yadm.distro YADM_DISTRO lsb_release -si
yadm.hostname YADM_HOSTNAME hostname (without domain)
yadm.os YADM_OS uname -s
yadm.user YADM_USER id -u -n
yadm.source YADM_SOURCE Template filename
Examples:
whatever##template with the following content
{% if yadm.user == 'harvey' %}
config={{yadm.class}}-{{yadm.os}}
{% else %}
config=dev-whatever config=dev-whatever
{% endif -%} {% endif %}
would output a file named whatever with the following content if the would output a file named whatever with the following content if the
user is "harvey": user is "harvey":
@ -390,21 +511,27 @@
config=dev-whatever config=dev-whatever
See http://jinja.pocoo.org/ for an overview of Jinja. An equivalent Jinja template named whatever##template.j2 would look
like:
{% if YADM_USER == 'harvey' -%}
config={{YADM_CLASS}}-{{YADM_OS}}
{% else -%}
config=dev-whatever
{% endif -%}
## ENCRYPTION ## ENCRYPTION
It can be useful to manage confidential files, like SSH or GPG keys, It can be useful to manage confidential files, like SSH or GPG keys,
across multiple systems. However, doing so would put plain text data across multiple systems. However, doing so would put plain text data
into a Git repository, which often resides on a public system. yadm into a Git repository, which often resides on a public system. yadm can
implements a feature which can make it easy to encrypt and decrypt a make it easy to encrypt and decrypt a set of files so the encrypted
set of files so the encrypted version can be maintained in the Git version can be maintained in the Git repository. This feature will
repository. This feature will only work if the gpg(1) command is only work if the gpg(1) command is available.
available.
To use this feature, a list of patterns must be created and saved as To use this feature, a list of patterns must be created and saved as
$HOME/.yadm/encrypt. This list of patterns should be relative to the $HOME/.config/yadm/encrypt. This list of patterns should be relative
configured work-tree (usually $HOME). For example: to the configured work-tree (usually $HOME). For example:
.ssh/*.key .ssh/*.key
.gnupg/*.gpg .gnupg/*.gpg
@ -417,9 +544,9 @@
The yadm encrypt command will find all files matching the patterns, and The yadm encrypt command will find all files matching the patterns, and
prompt for a password. Once a password has confirmed, the matching prompt for a password. Once a password has confirmed, the matching
files will be encrypted and saved as $HOME/.yadm/files.gpg. The pat- files will be encrypted and saved as $HOME/.config/yadm/files.gpg. The
terns and files.gpg should be added to the yadm repository so they are patterns and files.gpg should be added to the yadm repository so they
available across multiple systems. are available across multiple systems.
To decrypt these files later, or on another system run yadm decrypt and To decrypt these files later, or on another system run yadm decrypt and
provide the correct password. After files are decrypted, permissions provide the correct password. After files are decrypted, permissions
@ -431,15 +558,21 @@
NOTE: It is recommended that you use a private repository when keeping NOTE: It is recommended that you use a private repository when keeping
confidential files, even though they are encrypted. confidential files, even though they are encrypted.
Patterns found in $HOME/.config/yadm/encrypt are automatically added to
the repository's info/exclude file every time yadm encrypt is run.
This is to prevent accidentally committing sensitive data to the repos-
itory. This can be disabled using the yadm.auto-exclude configuration.
## PERMISSIONS ## PERMISSIONS
When files are checked out of a Git repository, their initial permis- When files are checked out of a Git repository, their initial permis-
sions are dependent upon the user's umask. Because of this, yadm will sions are dependent upon the user's umask. Because of this, yadm will
automatically update the permissions of some file paths. The "group" automatically update the permissions of some file paths. The "group"
and "others" permissions will be removed from the following files: and "others" permissions will be removed from the following files:
- $HOME/.yadm/files.gpg - $HOME/.config/yadm/files.gpg
- All files matching patterns in $HOME/.yadm/encrypt - All files matching patterns in $HOME/.config/yadm/encrypt
- The SSH directory and files, .ssh/* - The SSH directory and files, .ssh/*
@ -459,17 +592,18 @@
When running a Git command and .ssh or .gnupg directories do not exist, When running a Git command and .ssh or .gnupg directories do not exist,
yadm will create those directories with mask 0700 prior to running the yadm will create those directories with mask 0700 prior to running the
Git command. This can be disabled using the yadm.auto-private-dirs Git command. This can be disabled using the yadm.auto-private-dirs con-
configuration. figuration.
## HOOKS ## HOOKS
For every command yadm supports, a program can be provided to run For every command yadm supports, a program can be provided to run
before or after that command. These are referred to as "hooks". yadm before or after that command. These are referred to as "hooks". yadm
looks for hooks in the directory $HOME/.yadm/hooks. Each hook is named looks for hooks in the directory $HOME/.config/yadm/hooks. Each hook
using a prefix of pre_ or post_, followed by the command which should is named using a prefix of pre_ or post_, followed by the command which
trigger the hook. For example, to create a hook which is run after should trigger the hook. For example, to create a hook which is run
every yadm pull command, create a hook named post_pull. Hooks must after every yadm pull command, create a hook named post_pull. Hooks
have the executable file permission set. must have the executable file permission set.
If a pre_ hook is defined, and the hook terminates with a non-zero exit If a pre_ hook is defined, and the hook terminates with a non-zero exit
status, yadm will refuse to run the yadm command. For example, if a status, yadm will refuse to run the yadm command. For example, if a
@ -495,18 +629,31 @@
YADM_HOOK_WORK YADM_HOOK_WORK
The path to the work-tree The path to the work-tree
## FILES
The following are the default paths yadm uses for its own data. These
paths can be altered using universal options. See the OPTIONS section
for details.
$HOME/.yadm ## FILES
All of yadm's configurations are relative to the "yadm directory".
yadm uses the "XDG Base Directory Specification" to determine this
directory. If the environment variable $XDG_CONFIG_HOME is defined as
a fully qualified path, this directory will be $XDG_CONFIG_HOME/yadm.
Otherwise it will be $HOME/.config/yadm.
The following are the default paths yadm uses for its own data. Most
of these paths can be altered using universal options. See the OPTIONS
section for details.
$HOME/.config/yadm
The yadm directory. By default, all data yadm stores is relative The yadm directory. By default, all data yadm stores is relative
to this directory. to this directory.
$YADM_DIR/config $YADM_DIR/config
Configuration file for yadm. Configuration file for yadm.
$YADM_DIR/alt
This is a directory to keep "alternate files" without having
them side-by-side with the resulting symlink or processed tem-
plate. Alternate files placed in this directory will be created
relative to $HOME instead.
$YADM_DIR/repo.git $YADM_DIR/repo.git
Git repository used by yadm. Git repository used by yadm.
@ -516,6 +663,7 @@
$YADM_DIR/files.gpg $YADM_DIR/files.gpg
All files encrypted with yadm encrypt are stored in this file. All files encrypted with yadm encrypt are stored in this file.
## EXAMPLES ## EXAMPLES
yadm init yadm init
Create an empty repo for managing files Create an empty repo for managing files
@ -529,24 +677,27 @@
yadm push -u origin master yadm push -u origin master
Initial push of master to origin Initial push of master to origin
echo .ssh/*.key >> $HOME/.yadm/encrypt echo .ssh/*.key >> $HOME/.config/yadm/encrypt
Add a new pattern to the list of encrypted files Add a new pattern to the list of encrypted files
yadm encrypt ; yadm add ~/.yadm/files.gpg ; yadm commit yadm encrypt ; yadm add ~/.config/yadm/files.gpg ; yadm commit
Commit a new set of encrypted files Commit a new set of encrypted files
## REPORTING BUGS ## REPORTING BUGS
Report issues or create pull requests at GitHub: Report issues or create pull requests at GitHub:
https://github.com/TheLocehiliosan/yadm/issues https://github.com/TheLocehiliosan/yadm/issues
## AUTHOR ## AUTHOR
Tim Byrne <sultan@locehilios.com> Tim Byrne <sultan@locehilios.com>
## SEE ALSO ## SEE ALSO
git(1), gpg(1) git(1), gpg(1)
https://thelocehiliosan.github.io/yadm/ https://yadm.io/

View File

@ -1,7 +1,7 @@
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
Name: yadm Name: yadm
Summary: Yet Another Dotfiles Manager Summary: Yet Another Dotfiles Manager
Version: 1.12.0 Version: 2.0.0
Group: Development/Tools Group: Development/Tools
Release: 1%{?dist} Release: 1%{?dist}
URL: https://yadm.io URL: https://yadm.io
@ -51,48 +51,3 @@ cd *yadm-*
%attr(755,root,root) %{_bindir}/yadm %attr(755,root,root) %{_bindir}/yadm
%attr(644,root,root) %{_mandir}/man1/* %attr(644,root,root) %{_mandir}/man1/*
%doc %{_pkgdocdir} %doc %{_pkgdocdir}
%changelog
* Wed Oct 25 2017 Tim Byrne <sultan@locehilios.com> - 1.12.0-1
- Bump version to 1.12.0
- Include zsh completion
* Wed Aug 23 2017 Tim Byrne <sultan@locehilios.com> - 1.11.1-1
- Bump version to 1.11.1
* Mon Jul 10 2017 Tim Byrne <sultan@locehilios.com> - 1.11.0-1
- Bump version to 1.11.0
* Wed May 10 2017 Tim Byrne <sultan@locehilios.com> - 1.10.0-1
- Bump version to 1.10.0
- Transition to semantic versioning
* Thu May 4 2017 Tim Byrne <sultan@locehilios.com> - 1.09-1
- Bump version to 1.09
- Add yadm.bash_completion
* Mon Apr 3 2017 Tim Byrne <sultan@locehilios.com> - 1.08-1
- Bump version to 1.08
* Fri Feb 10 2017 Tim Byrne <sultan@locehilios.com> - 1.07-1
- Bump version to 1.07
* Fri Jan 13 2017 Tim Byrne <sultan@locehilios.com> - 1.06-1
- Bump version to 1.06
* Tue May 17 2016 Tim Byrne <sultan@locehilios.com> - 1.04-3
- Add missing docs
- Fix changelog format
- Remove file attribute for docs and license
* Mon May 16 2016 Tim Byrne <sultan@locehilios.com> - 1.04-2
- Add %%check
- Add %%{?dist}
- Add build dependencies
- Add license and docs
- Remove %%defattr
- Remove group tag
- Sync RPM description with man page
* Fri Apr 22 2016 Tim Byrne <sultan@locehilios.com> - 1.04-1
- Initial RPM release