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:
parent
5b105e0687
commit
de73c9f4b4
6 changed files with 352 additions and 276 deletions
55
.notes.md
55
.notes.md
|
@ -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
21
CHANGES
|
@ -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
|
||||
* Add basic Zsh completion (#71, #79)
|
||||
* Support directories in `.yadm/encrypt` (#81, #82)
|
||||
|
|
|
@ -3,15 +3,19 @@ CONTRIBUTORS
|
|||
Tim Byrne
|
||||
Espen Henriksen
|
||||
Cameron Eagans
|
||||
Ross Smith II
|
||||
Klas Mellbourn
|
||||
Jan Schulz
|
||||
Satoshi Ohki
|
||||
Siôn Le Roux
|
||||
Sébastien Gross
|
||||
Thomas Luzat
|
||||
Tomas Cernaj
|
||||
Uroš Golja
|
||||
Brayden Banks
|
||||
japm48
|
||||
Daniel Wagenknecht
|
||||
Franciszek Madej
|
||||
Mateusz Piotrowski
|
||||
Paraplegic Racehorse
|
||||
Patrick Hof
|
||||
Satoshi Ohki
|
||||
|
|
2
yadm
2
yadm
|
@ -20,7 +20,7 @@ if [ -z "$BASH_VERSION" ]; then
|
|||
[ "$YADM_TEST" != 1 ] && exec bash "$0" "$@"
|
||||
fi
|
||||
|
||||
VERSION=1.12.0
|
||||
VERSION=2.0.0
|
||||
|
||||
YADM_WORK="$HOME"
|
||||
YADM_DIR=
|
||||
|
|
497
yadm.md
497
yadm.md
|
@ -4,14 +4,15 @@
|
|||
## NAME
|
||||
yadm - Yet Another Dotfiles Manager
|
||||
|
||||
|
||||
## SYNOPSIS
|
||||
yadm command [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]
|
||||
|
||||
|
@ -31,15 +32,18 @@
|
|||
|
||||
yadm perms
|
||||
|
||||
yadm upgrade
|
||||
|
||||
yadm introspect category
|
||||
|
||||
|
||||
## DESCRIPTION
|
||||
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 based on the operating
|
||||
system or host name. Lastly, yadm supplies the ability to manage a
|
||||
subset of secure files, which are encrypted before they are included in
|
||||
the repository.
|
||||
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,
|
||||
which are encrypted before they are included in the repository.
|
||||
|
||||
|
||||
## COMMANDS
|
||||
git-command or git-alias
|
||||
|
@ -54,15 +58,15 @@
|
|||
The config command is not passed directly through. Instead use
|
||||
the gitconfig command (see below).
|
||||
|
||||
alt Create symbolic links and process Jinja templates for any man-
|
||||
aged files matching the naming rules described in the ALTERNATES
|
||||
and JINJA sections. It is usually unnecessary to run this com-
|
||||
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-
|
||||
ration yadm.auto-alt to "false".
|
||||
|
||||
bootstrap
|
||||
Execute $HOME/.yadm/bootstrap if it exists.
|
||||
Execute $HOME/.config/yadm/bootstrap if it exists.
|
||||
|
||||
clone url
|
||||
Clone a remote repository for tracking dotfiles. After the con-
|
||||
|
@ -83,29 +87,30 @@
|
|||
or
|
||||
yadm stash pop
|
||||
|
||||
The repository is stored in $HOME/.yadm/repo.git. By default,
|
||||
$HOME will be used as the work-tree, but this can be overridden
|
||||
with the -w option. yadm can be forced to overwrite an existing
|
||||
repository by providing the -f option. By default yadm will ask
|
||||
the user if the bootstrap program should be run (if it exists).
|
||||
The options --bootstrap or --no-bootstrap will either force the
|
||||
bootstrap to be run, or prevent it from being run, without
|
||||
prompting the user.
|
||||
The repository is stored in $HOME/.config/yadm/repo.git. By
|
||||
default, $HOME will be used as the work-tree, but this can be
|
||||
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 origin/master, you can specify it
|
||||
using the -b option. By default yadm will ask the user if the
|
||||
bootstrap program should be run (if it exists). The options
|
||||
--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
|
||||
works exactly they way git-config(1) does. See the CONFIGURA-
|
||||
TION section for more details.
|
||||
|
||||
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
|
||||
$HOME). Using the -l option will list the files stored without
|
||||
extracting them.
|
||||
|
||||
encrypt
|
||||
Encrypt all files matching the patterns found in
|
||||
$HOME/.yadm/encrypt. See the ENCRYPTION section for more
|
||||
details.
|
||||
Encrypt all files matching the patterns found in $HOME/.con-
|
||||
fig/yadm/encrypt. See the ENCRYPTION section for more details.
|
||||
|
||||
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
|
||||
|
@ -137,10 +142,10 @@
|
|||
help Print a summary of yadm commands.
|
||||
|
||||
init Initialize a new, empty repository for tracking dotfiles. The
|
||||
repository is stored in $HOME/.yadm/repo.git. By default, $HOME
|
||||
will be used as the work-tree, but this can be overridden with
|
||||
the -w option. yadm can be forced to overwrite an existing
|
||||
repository by providing the -f option.
|
||||
repository is stored in $HOME/.config/yadm/repo.git. By
|
||||
default, $HOME will be used as the work-tree, but this can be
|
||||
overridden with the -w option. yadm can be forced to overwrite
|
||||
an existing repository by providing the -f option.
|
||||
|
||||
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
|
||||
|
@ -153,28 +158,67 @@
|
|||
|
||||
perms Update permissions as described in the PERMISSIONS section. It
|
||||
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
|
||||
"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
|
||||
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
|
||||
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-
|
||||
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
|
||||
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-
|
||||
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
|
||||
used to override the repository directory.
|
||||
|
||||
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.
|
||||
|
||||
-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.
|
||||
|
||||
--yadm-repo
|
||||
|
@ -192,10 +236,11 @@
|
|||
--yadm-bootstrap
|
||||
Override the location of the yadm bootstrap program.
|
||||
|
||||
|
||||
## CONFIGURATION
|
||||
yadm uses a configuration file named $HOME/.yadm/config. This file
|
||||
uses the same format as git-config(1). Also, you can control the con-
|
||||
tents of the configuration file via the yadm config command (which
|
||||
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
|
||||
works exactly like git-config). For example, to disable alternates you
|
||||
can run the command:
|
||||
|
||||
|
@ -203,10 +248,23 @@
|
|||
|
||||
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
|
||||
Disable the automatic linking described in the section ALTER-
|
||||
NATES. If disabled, you may still run yadm alt manually to cre-
|
||||
ate the alternate links. This feature is enabled by default.
|
||||
Disable the automatic linking described in the section ALTER-
|
||||
NATES. If disabled, you may still run "yadm alt" manually to
|
||||
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
|
||||
Disable the automatic permission changes described in the sec-
|
||||
|
@ -218,168 +276,231 @@
|
|||
Disable the automatic creating of private directories described
|
||||
in the section PERMISSIONS.
|
||||
|
||||
yadm.ssh-perms
|
||||
Disable the permission changes to $HOME/.ssh/*. This feature is
|
||||
enabled by default.
|
||||
yadm.git-program
|
||||
Specify an alternate program to use instead of "git". By
|
||||
default, the first "git" found in $PATH is used.
|
||||
|
||||
yadm.gpg-perms
|
||||
Disable the permission changes to $HOME/.gnupg/*. This feature
|
||||
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
|
||||
Specify an alternate program to use instead of "gpg". By
|
||||
default, the first "gpg" found in $PATH is used.
|
||||
|
||||
yadm.git-program
|
||||
Specify an alternate program to use instead of "git". By
|
||||
default, the first "git" found in $PATH is used.
|
||||
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.cygwin-copy
|
||||
If set to "true", for Cygwin hosts, alternate files will be
|
||||
copies instead of symbolic links. This might be desirable,
|
||||
because non-Cygwin software may not properly interpret Cygwin
|
||||
symlinks.
|
||||
yadm.ssh-perms
|
||||
Disable the permission changes to $HOME/.ssh/*. This feature is
|
||||
enabled by default.
|
||||
|
||||
These last four "local" configurations are not stored in the
|
||||
$HOME/.yadm/config, they are stored in the local repository.
|
||||
The following four "local" configurations are not stored in the
|
||||
$HOME/.config/yadm/config, they are stored in the local repository.
|
||||
|
||||
|
||||
local.class
|
||||
Specify a CLASS for the purpose of symlinking alternate files.
|
||||
By default, no CLASS will be matched.
|
||||
Specify a class for the purpose of symlinking alternate files.
|
||||
By default, no class will be matched.
|
||||
|
||||
local.hostname
|
||||
Override the hostname for the purpose of symlinking alternate
|
||||
files.
|
||||
|
||||
local.os
|
||||
Override the OS for the purpose of symlinking alternate files.
|
||||
|
||||
local.hostname
|
||||
Override the HOSTNAME for the purpose of symlinking alternate
|
||||
files.
|
||||
|
||||
local.user
|
||||
Override the USER for the purpose of symlinking alternate files.
|
||||
Override the user for the purpose of symlinking alternate files.
|
||||
|
||||
|
||||
## 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
|
||||
a different operating system, host, or user. yadm implements a feature
|
||||
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:
|
||||
a different operating system, host, user, etc.
|
||||
|
||||
##
|
||||
##CLASS
|
||||
##CLASS.OS
|
||||
##CLASS.OS.HOSTNAME
|
||||
##CLASS.OS.HOSTNAME.USER
|
||||
##OS
|
||||
##OS.HOSTNAME
|
||||
##OS.HOSTNAME.USER
|
||||
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
|
||||
used.
|
||||
|
||||
If there are any files managed by yadm's repository, or listed in
|
||||
$HOME/.yadm/encrypt, which match this naming convention, symbolic links
|
||||
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:
|
||||
The suffix begins with "##", followed by any number of conditions sepa-
|
||||
rated by commas.
|
||||
|
||||
- $HOME/path/example.txt##
|
||||
- $HOME/path/example.txt##Work
|
||||
- $HOME/path/example.txt##Darwin
|
||||
- $HOME/path/example.txt##Darwin.host1
|
||||
- $HOME/path/example.txt##Darwin.host2
|
||||
- $HOME/path/example.txt##Linux
|
||||
- $HOME/path/example.txt##Linux.host1
|
||||
- $HOME/path/example.txt##Linux.host2
|
||||
##<condition>[,<condition>,...]
|
||||
|
||||
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
|
||||
letter.
|
||||
|
||||
<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
|
||||
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
|
||||
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.
|
||||
|
||||
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-
|
||||
NAME/USER, then no link will be created.
|
||||
If no "##default" version exists and no files have valid conditions,
|
||||
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.
|
||||
|
||||
CLASS must be manually set using yadm config local.class <class>. OS
|
||||
is determined by running uname -s, HOSTNAME by running hostname, and
|
||||
USER by running id -u -n. yadm will automatically create these links
|
||||
by default. This can be disabled using the yadm.auto-alt configuration.
|
||||
Even if disabled, links can be manually created by running yadm alt.
|
||||
yadm will automatically create these links by default. This can be dis-
|
||||
abled 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-
|
||||
NAME, or USER. For example, The following file could be linked for any
|
||||
host when the user is "harvey".
|
||||
|
||||
$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
|
||||
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
|
||||
following sets the CLASS to be "Work".
|
||||
following sets the class to be "Work".
|
||||
|
||||
yadm config local.class Work
|
||||
|
||||
Similarly, the values of OS, HOSTNAME, and USER can be manually over-
|
||||
ridden using the configuration options local.os, local.hostname, and
|
||||
Similarly, the values of os, hostname, and user can be manually over-
|
||||
ridden using the configuration options local.os, local.hostname, and
|
||||
local.user.
|
||||
|
||||
|
||||
## JINJA
|
||||
If the envtpl command is available, Jinja templates will also be pro-
|
||||
cessed to create or overwrite real files. yadm will treat files ending
|
||||
in
|
||||
## TEMPLATES
|
||||
If a template condition is defined in an alternate file's "##" suffix,
|
||||
and the necessary dependencies for the template are available, then the
|
||||
file will be processed to create or overwrite files.
|
||||
|
||||
##yadm.j2
|
||||
Supported template processors:
|
||||
|
||||
as Jinja templates. During processing, the following variables are set
|
||||
according to the rules explained in the ALTERNATES section:
|
||||
default
|
||||
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
|
||||
YADM_OS
|
||||
YADM_HOSTNAME
|
||||
YADM_USER
|
||||
j2cli To use the j2cli Jinja template processor, specify the value of
|
||||
"j2" or "j2cli".
|
||||
|
||||
In addition YADM_DISTRO is exposed as the value of lsb_release -si if
|
||||
lsb_release is locally available.
|
||||
envtpl To use the envtpl Jinja template processor, specify the value of
|
||||
"j2" or "envtpl".
|
||||
|
||||
For example, a file named whatever##yadm.j2 with the following content
|
||||
|
||||
{% if YADM_USER == 'harvey' -%}
|
||||
config={{YADM_CLASS}}-{{ YADM_OS }}
|
||||
{% else -%}
|
||||
NOTE: Specifying "j2" as the processor will attempt to use j2cli or
|
||||
envtpl, whichever is available.
|
||||
|
||||
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
|
||||
{% endif -%}
|
||||
{% endif %}
|
||||
|
||||
would output a file named whatever with the following content if the
|
||||
user is "harvey":
|
||||
|
@ -390,21 +511,27 @@
|
|||
|
||||
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
|
||||
It can be useful to manage confidential files, like SSH or GPG keys,
|
||||
across multiple systems. However, doing so would put plain text data
|
||||
into a Git repository, which often resides on a public system. yadm
|
||||
implements a feature which can make it easy to encrypt and decrypt a
|
||||
set of files so the encrypted version can be maintained in the Git
|
||||
repository. This feature will only work if the gpg(1) command is
|
||||
available.
|
||||
It can be useful to manage confidential files, like SSH or GPG keys,
|
||||
across multiple systems. However, doing so would put plain text data
|
||||
into a Git repository, which often resides on a public system. yadm can
|
||||
make it easy to encrypt and decrypt a set of files so the encrypted
|
||||
version can be maintained in the Git repository. This feature will
|
||||
only work if the gpg(1) command is available.
|
||||
|
||||
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
|
||||
configured work-tree (usually $HOME). For example:
|
||||
$HOME/.config/yadm/encrypt. This list of patterns should be relative
|
||||
to the configured work-tree (usually $HOME). For example:
|
||||
|
||||
.ssh/*.key
|
||||
.gnupg/*.gpg
|
||||
|
@ -417,9 +544,9 @@
|
|||
|
||||
The yadm encrypt command will find all files matching the patterns, and
|
||||
prompt for a password. Once a password has confirmed, the matching
|
||||
files will be encrypted and saved as $HOME/.yadm/files.gpg. The pat-
|
||||
terns and files.gpg should be added to the yadm repository so they are
|
||||
available across multiple systems.
|
||||
files will be encrypted and saved as $HOME/.config/yadm/files.gpg. The
|
||||
patterns and files.gpg should be added to the yadm repository so they
|
||||
are available across multiple systems.
|
||||
|
||||
To decrypt these files later, or on another system run yadm decrypt and
|
||||
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
|
||||
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
|
||||
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
|
||||
automatically update the permissions of some file paths. The "group"
|
||||
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/*
|
||||
|
||||
|
@ -459,17 +592,18 @@
|
|||
|
||||
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
|
||||
Git command. This can be disabled using the yadm.auto-private-dirs
|
||||
configuration.
|
||||
Git command. This can be disabled using the yadm.auto-private-dirs con-
|
||||
figuration.
|
||||
|
||||
|
||||
## HOOKS
|
||||
For every command yadm supports, a program can be provided to run
|
||||
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
|
||||
using a prefix of pre_ or post_, followed by the command which should
|
||||
trigger the hook. For example, to create a hook which is run after
|
||||
every yadm pull command, create a hook named post_pull. Hooks must
|
||||
have the executable file permission set.
|
||||
before or after that command. These are referred to as "hooks". yadm
|
||||
looks for hooks in the directory $HOME/.config/yadm/hooks. Each hook
|
||||
is named using a prefix of pre_ or post_, followed by the command which
|
||||
should trigger the hook. For example, to create a hook which is run
|
||||
after every yadm pull command, create a hook named post_pull. Hooks
|
||||
must have the executable file permission set.
|
||||
|
||||
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
|
||||
|
@ -495,18 +629,31 @@
|
|||
YADM_HOOK_WORK
|
||||
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
|
||||
to this directory.
|
||||
|
||||
$YADM_DIR/config
|
||||
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
|
||||
Git repository used by yadm.
|
||||
|
||||
|
@ -516,6 +663,7 @@
|
|||
$YADM_DIR/files.gpg
|
||||
All files encrypted with yadm encrypt are stored in this file.
|
||||
|
||||
|
||||
## EXAMPLES
|
||||
yadm init
|
||||
Create an empty repo for managing files
|
||||
|
@ -529,24 +677,27 @@
|
|||
yadm push -u origin master
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
||||
## REPORTING BUGS
|
||||
Report issues or create pull requests at GitHub:
|
||||
|
||||
https://github.com/TheLocehiliosan/yadm/issues
|
||||
|
||||
|
||||
## AUTHOR
|
||||
Tim Byrne <sultan@locehilios.com>
|
||||
|
||||
|
||||
## SEE ALSO
|
||||
git(1), gpg(1)
|
||||
|
||||
https://thelocehiliosan.github.io/yadm/
|
||||
https://yadm.io/
|
||||
|
||||
|
||||
|
||||
|
|
47
yadm.spec
47
yadm.spec
|
@ -1,7 +1,7 @@
|
|||
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
|
||||
Name: yadm
|
||||
Summary: Yet Another Dotfiles Manager
|
||||
Version: 1.12.0
|
||||
Version: 2.0.0
|
||||
Group: Development/Tools
|
||||
Release: 1%{?dist}
|
||||
URL: https://yadm.io
|
||||
|
@ -51,48 +51,3 @@ cd *yadm-*
|
|||
%attr(755,root,root) %{_bindir}/yadm
|
||||
%attr(644,root,root) %{_mandir}/man1/*
|
||||
%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
|
||||
|
|
Loading…
Reference in a new issue