1
0
Fork 0
mirror of synced 2024-12-21 14:11:08 -05:00

Release 1.08

Update version number and update documentation

* Fix bug alternates based on `CLASS` (#51)
* Support globs and paths with space in .yadm/encrypt (#53, #54)
* Add support for alternate files using Jinja templates (#56, #58)
* Add `enter` command, for creating a sub-shell (#57)
* Support local.hostname properly (#59)
This commit is contained in:
Tim Byrne 2017-04-03 07:09:32 -05:00
parent 9824de5410
commit df4652d6de
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12
6 changed files with 163 additions and 99 deletions

View file

@ -1,3 +1,10 @@
1.08
* Fix bug alternates based on `CLASS` (#51)
* Support globs and paths with space in .yadm/encrypt (#53, #54)
* Add support for alternate files using Jinja templates (#56, #58)
* Add `enter` command, for creating a sub-shell (#57)
* Support local.hostname properly (#59)
1.07 1.07
* Add `CLASS` to supported alt-link patterns (#21) * Add `CLASS` to supported alt-link patterns (#21)
* Add bootstrap command (#42) * Add bootstrap command (#42)

View file

@ -2,10 +2,12 @@ CONTRIBUTORS
Tim Byrne Tim Byrne
Espen Henriksen Espen Henriksen
Paraplegic Racehorse Jan Schulz
Patrick Hof Patrick Hof
Satoshi Ohki Satoshi Ohki
Siôn Le Roux Siôn Le Roux
Sébastien Gross
Tomas Cernaj Tomas Cernaj
Uroš Golja Uroš Golja
Franciszek Madej Franciszek Madej
Paraplegic Racehorse

2
yadm
View file

@ -19,7 +19,7 @@ if [ -z "$BASH_VERSION" ]; then
[ "$YADM_TEST" != 1 ] && exec bash "$0" "$@" [ "$YADM_TEST" != 1 ] && exec bash "$0" "$@"
fi fi
VERSION=1.07 VERSION=1.08
YADM_WORK="$HOME" YADM_WORK="$HOME"
YADM_DIR="$HOME/.yadm" YADM_DIR="$HOME/.yadm"

2
yadm.1
View file

@ -1,5 +1,5 @@
." vim: set spell so=8: ." vim: set spell so=8:
.TH yadm 1 "10 February 2017" "1.07" .TH yadm 1 "3 April 2017" "1.08"
.SH NAME .SH NAME
yadm \- Yet Another Dotfiles Manager yadm \- Yet Another Dotfiles Manager
.SH SYNOPSIS .SH SYNOPSIS

242
yadm.md
View file

@ -23,6 +23,8 @@
yadm encrypt yadm encrypt
yadm enter
yadm decrypt [-l] yadm decrypt [-l]
yadm alt yadm alt
@ -41,7 +43,7 @@
git-command or git-alias git-command or git-alias
Any command not internally handled by yadm is passed through to Any command not internally handled by yadm is passed through to
git(1). Git commands or aliases are invoked with the yadm man- git(1). Git commands or aliases are invoked with the yadm man-
aged repository. The working directory for git commands will be aged repository. The working directory for Git commands will be
the configured work-tree (usually $HOME). the configured work-tree (usually $HOME).
Dotfiles are managed by using standard git commands; add, com- Dotfiles are managed by using standard git commands; add, com-
@ -50,107 +52,122 @@
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 for any managed files matching the naming alt Create symbolic links and process Jinja templates for any man-
rules describe in the ALTERNATES section. It is usually unnec- aged files matching the naming rules described in the ALTERNATES
essary to run this command, as yadm automatically processes and JINJA sections. It is usually unnecessary to run this com-
alternates by default. This automatic behavior can be disabled mand, as yadm automatically processes alternates by default.
by setting the configuration yadm.auto-alt to "false". This automatic behavior can be disabled by setting the configu-
ration yadm.auto-alt to "false".
bootstrap bootstrap
Execute $HOME/.yadm/bootstrap if it exists. Execute $HOME/.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-
tents of the remote repository have been fetched, a "merge" of tents of the remote repository have been fetched, a "merge" of
origin/master is attempted. If there are conflicting files origin/master is attempted. If there are conflicting files
already present in the work-tree, this merge will fail and already present in the work-tree, this merge will fail and
instead a "reset" of origin/master will be done, followed by a instead a "reset" of origin/master will be done, followed by a
"stash". This "stash" operation will preserve the original data. "stash". This "stash" operation will preserve the original data.
You can review the stashed conflicts by running the command You can review the stashed conflicts by running the command
yadm stash show -p yadm stash show -p
from within your $HOME directory. If you want to restore the from within your $HOME directory. If you want to restore the
stashed data, you can run stashed data, you can run
yadm stash apply yadm stash apply
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/.yadm/repo.git. By default,
$HOME will be used as the work-tree, but this can be overridden $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 with the -w option. yadm can be forced to overwrite an existing
repository by providing the -f option. By default yadm will ask repository by providing the -f option. By default yadm will ask
the user if the bootstrap program should be run (if it exists). the user if the bootstrap program should be run (if it exists).
The options --bootstrap or --no-bootstrap will either force the The options --bootstrap or --no-bootstrap will either force the
bootstrap to be run, or prevent it from being run, without bootstrap to be run, or prevent it from being run, without
prompting the user. 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/.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/.yadm/encrypt. See the ENCRYPTION section for more $HOME/.yadm/encrypt. See the ENCRYPTION section for more
details. 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
"exit" command). This sub-shell can be used to easily interact
with your yadm repository using "git" commands. This could be
useful if you are using a tool which uses Git directly. For
example, Emacs Tramp and Magit can manage files by using this
configuration:
(add-to-list 'tramp-methods
'("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
gitconfig gitconfig
Pass options to the git config command. Since yadm already uses Pass options to the git config command. Since yadm already uses
the config command to manage its own configurations, this com- the config command to manage its own configurations, this com-
mand is provided as a way to change configurations of the repos- mand is provided as a way to change configurations of the repos-
itory managed by yadm. One useful case might be to configure itory managed by yadm. One useful case might be to configure
the repository so untracked files are shown in status commands. the repository so untracked files are shown in status commands.
yadm initially configures its repository so that untracked files yadm initially configures its repository so that untracked files
are not shown. If you wish use the default git behavior (to are not shown. If you wish use the default Git behavior (to
show untracked files and directories), you can remove this con- show untracked files and directories), you can remove this con-
figuration. figuration.
yadm gitconfig --unset status.showUntrackedFiles yadm gitconfig --unset status.showUntrackedFiles
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/.yadm/repo.git. By default, $HOME
will be used as the work-tree, but this can be overridden with will be used as the work-tree, but this can be overridden with
the -w option. yadm can be forced to overwrite an existing the -w option. yadm can be forced to overwrite an existing
repository by providing the -f option. 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
include files from the current directory or below. include files from the current directory or below.
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".
version version
Print the version of yadm. Print the version of yadm.
## 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
@ -169,9 +186,9 @@
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/.yadm/config. This file
uses the same format as git-config(1). Also, you can control the con- 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 tents 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:
@ -180,14 +197,14 @@
The following is the full list of supported configurations: The following is the full list of supported configurations:
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 cre-
ate the alternate links. This feature is enabled by default. ate the alternate links. 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-
tion PERMISSIONS. If disabled, you may still run yadm perms tion PERMISSIONS. If disabled, you may still run yadm perms
manually to update permissions. This feature is enabled by manually to update permissions. This feature is enabled by
default. default.
yadm.ssh-perms yadm.ssh-perms
@ -195,39 +212,39 @@
enabled by default. enabled by default.
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 yadm.gpg-recipient
Asymmetrically encrypt files with a gpg public/private key pair. Asymmetrically encrypt files with a gpg public/private key pair.
Provide a "key ID" to specify which public key to encrypt with. Provide a "key ID" to specify which public key to encrypt with.
The key must exist in your public keyrings. If left blank or The key must exist in your public keyrings. If left blank or
not provided, symmetric encryption is used instead. If set to not provided, symmetric encryption is used instead. If set to
"ASK", gpg will interactively ask for recipients. See the "ASK", gpg will interactively ask for recipients. See the
ENCRYPTION section for more details. This feature is disabled ENCRYPTION section for more details. This feature is disabled
by default. 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.git-program
Specify an alternate program to use instead of "git". By Specify an alternate program to use instead of "git". By
default, the first "git" found in $PATH is used. default, the first "git" found in $PATH is used.
These last four "local" configurations are not stored in the These last four "local" configurations are not stored in the
$HOME/.yadm/config, they are stored in the local repository. $HOME/.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.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 local.hostname
Override the HOSTNAME for the purpose of symlinking alternate Override the HOSTNAME for the purpose of symlinking alternate
files. files.
local.user local.user
@ -238,7 +255,7 @@
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, or user. yadm implements a feature
which will automatically create a symbolic link to the appropriate ver- which will automatically create a symbolic link to the appropriate ver-
sion of a file, as long as you follow a specific naming convention. 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 can detect files with names ending in any of the following:
## ##
@ -250,10 +267,10 @@
##OS.HOSTNAME ##OS.HOSTNAME
##OS.HOSTNAME.USER ##OS.HOSTNAME.USER
If there are any files managed by yadm's repository, or listed in If there are any files managed by yadm's repository, or listed in
$HOME/.yadm/encrypt, which match this naming convention, symbolic links $HOME/.yadm/encrypt, which match this naming convention, symbolic links
will be created for the most appropriate version. This may best be will be created for the most appropriate version. This may best be
demonstrated by example. Assume the following files are managed by demonstrated by example. Assume the following files are managed by
yadm's repository: yadm's repository:
- $HOME/path/example.txt## - $HOME/path/example.txt##
@ -275,7 +292,7 @@
$HOME/path/example.txt -> $HOME/path/example.txt##Darwin $HOME/path/example.txt -> $HOME/path/example.txt##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:
@ -293,73 +310,108 @@
If no "##" version exists and no files match the current CLASS/OS/HOST- If no "##" version exists and no files match the current CLASS/OS/HOST-
NAME/USER, then no link will be created. NAME/USER, 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 CLASS must be manually set using yadm config local.class <class>. OS
is determined by running uname -s, HOSTNAME by running hostname, and is determined by running uname -s, HOSTNAME by running hostname, and
USER by running id -u -n. yadm will automatically create these links USER by running id -u -n. yadm will automatically create these links
by default. This can be disabled using the yadm.auto-alt configuration. by default. This can be disabled using the yadm.auto-alt configuration.
Even if disabled, links can be manually created by running yadm alt. 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- 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 NAME, or USER. For example, The following file could be linked for any
host when the user is "harvey". host when the user is "harvey".
$HOME/path/example.txt##%.%.harvey $HOME/path/example.txt##%.%.harvey
CLASS is a special value which is stored locally on each host (inside CLASS is a special value which is stored locally on each host (inside
the local repository). To use alternate symlinks using CLASS, you must the local repository). To use alternate symlinks using CLASS, you must
set the value of class using the configuration local.class. This is 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
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
##yadm.j2
as Jinja templates. During processing, the following variables are set
according to the rules explained in the ALTERNATES section:
YADM_CLASS
YADM_OS
YADM_HOSTNAME
YADM_USER
For example, a file named whatever##yadm.j2 with the following content
{% if YADM_USER == 'harvey' -%}
config={{YADM_CLASS}}-{{ YADM_OS }}
{% else -%}
config=dev-whatever
{% endif -%}
would output a file named whatever with the following content if the
user is "harvey":
config=work-Linux
and the following otherwise:
config=dev-whatever
See http://jinja.pocoo.org/ for an overview of Jinja.
## 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
implements a feature which can make it easy to encrypt and decrypt a 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 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 repository. This feature will 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/.yadm/encrypt. This list of patterns should be relative to the
configured work-tree (usually $HOME). For example: configured work-tree (usually $HOME). For example:
.ssh/*.key .ssh/*.key
.gnupg/*.gpg .gnupg/*.gpg
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/.yadm/files.gpg. The pat-
terns and files.gpg should be added to the yadm repository so they are terns and files.gpg should be added to the yadm repository so they are
available across multiple systems. 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
are automatically updated as described in the PERMISSIONS section. are automatically updated as described in the PERMISSIONS section.
Symmetric encryption is used by default, but asymmetric encryption may Symmetric encryption is used by default, but asymmetric encryption may
be enabled using the yadm.gpg-recipient configuration. be enabled using the yadm.gpg-recipient configuration.
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.
## 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. This can result in confiden- sions are dependent upon the user's umask. This can result in confiden-
tial files with lax permissions. tial files with lax permissions.
To prevent this, yadm will automatically update the permissions of con- To prevent this, yadm will automatically update the permissions of con-
fidential files. The "group" and "others" permissions will be removed fidential files. The "group" and "others" permissions will be removed
from the following files: from the following files:
- $HOME/.yadm/files.gpg - $HOME/.yadm/files.gpg
@ -371,13 +423,13 @@
- The GPG directory and files, .gnupg/* - The GPG directory and files, .gnupg/*
yadm will automatically update permissions by default. This can be dis- yadm will automatically update permissions by default. This can be dis-
abled using the yadm.auto-perms configuration. Even if disabled, per- abled using the yadm.auto-perms configuration. Even if disabled, per-
missions can be manually updated by running yadm perms. The SSH direc- missions can be manually updated by running yadm perms. The SSH direc-
tory processing can be disabled using the yadm.ssh-perms configuration. tory processing can be disabled using the yadm.ssh-perms configuration.
## FILES ## FILES
The following are the default paths yadm uses for its own data. These The following are the default paths yadm uses for its own data. These
paths can be altered using universal options. See the OPTIONS section paths can be altered using universal options. See the OPTIONS section
for details. for details.
$HOME/.yadm $HOME/.yadm

View file

@ -1,6 +1,6 @@
Summary: Yet Another Dotfiles Manager Summary: Yet Another Dotfiles Manager
Name: yadm Name: yadm
Version: 1.07 Version: 1.08
Release: 1%{?dist} Release: 1%{?dist}
URL: https://github.com/TheLocehiliosan/yadm URL: https://github.com/TheLocehiliosan/yadm
License: GPLv3 License: GPLv3
@ -37,6 +37,9 @@ install -m 644 yadm.1 ${RPM_BUILD_ROOT}%{_mandir}/man1
%doc CHANGES CONTRIBUTORS README.md %doc CHANGES CONTRIBUTORS README.md
%changelog %changelog
* 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 * Fri Feb 10 2017 Tim Byrne <sultan@locehilios.com> - 1.07-1
- Bump version to 1.07 - Bump version to 1.07