Release 1.05

Update version number and update documentation

* Improve portability of shebang line (#14)
* Support for symlinked directories (#17)
* Improve portability of tar parameters (#18)
* Support alternate gpg program (#19)
* Fallback to using `ls` if `/bin/ls` does not exist (#22)
This commit is contained in:
Tim Byrne 2016-09-08 08:08:22 -05:00
parent e40c054805
commit 05ed83ea34
No known key found for this signature in database
GPG Key ID: 6CBE24C2FD8CF76E
6 changed files with 36 additions and 192 deletions

View File

@ -1,3 +1,10 @@
1.05
* Improve portability of shebang line (#14)
* Support for symlinked directories (#17)
* Improve portability of tar parameters (#18)
* Support alternate gpg program (#19)
* Fallback to using `ls` if `/bin/ls` does not exist (#22)
1.04
* Support alternate paths for yadm data (#4, #5)
* Support asymmetric encryption (#7, #8)

172
README.md
View File

@ -1,175 +1,7 @@
# yadm - Yet Another Dotfiles Manager [![Build Status](https://travis-ci.org/TheLocehiliosan/yadm.svg?branch=master)](https://travis-ci.org/TheLocehiliosan/yadm)
_A house that does not have one warm, comfy chair in it is soulless._—May Sarton
When you live in a command line, configurations are a deeply personal thing. They are often crafted over years of experience, battles lost, lessons learned, advice followed, and ingenuity rewarded. When you are away from your own configurations, you are an orphaned refugee in unfamiliar and hostile surroundings. You feel clumsy and out of sorts. You are filled with a sense of longing to be back in a place you know. A place you built. A place where all the short-cuts have been worn bare by your own travels. A place you proudly call... `$HOME`.
Features, usage, examples and installation instructions can be found on the [website](https://thelocehiliosan.github.io/yadm/).
## Introduction
_Home is an invention on which no one has yet improved._—Ann Douglas
As so many others, I started out with a repository of dotfiles and a few scripts to symbolically link them around my home directory. This quickly became inadequate and I looked for solutions elsewhere. I've used two excellent tools; [homeschick](https://github.com/andsens/homeshick), and [vcsh](https://github.com/RichiH/vcsh). These tools are great, and you should check them out to understand their strengths. However, I didn't find all of the features I personally wished for in a single tool. **yadm** was written with the following goals:
- Use a single repository
- Few dependencies
- Ability to use alternate files based on OS or host
- Ability to encrypt and track confidential files
- Stay out of the way and let Git do what it's good at
## Installation
_Seek home for rest, for home is best._—Thomas Tusser
#### OSX
**yadm** can be installed using [Homebrew](https://github.com/Homebrew/homebrew).
brew install yadm
#### Fedora/Redhat/CentOS YUM/RPM
Several yum repositories are on Copr. Follow this link for [repositories and installation instructions](https://copr.fedorainfracloud.org/coprs/thelocehiliosan/yadm/).
#### Arch Linux
**yadm** is available in the Arch User Repos and can be installed with AUR helper or Makepkg
yaourt -S yadm
#### Gentoo Linux
**yadm** is available in the main gentoo portage tree, simply use `emerge` to
install it
emerge -atv app-admin/yadm
#### Other
You *can* simply download the **yadm** script and put it into your `$PATH`. Something like this:
curl -fLo /usr/local/bin/yadm https://github.com/TheLocehiliosan/yadm/raw/master/yadm && chmod a+x /usr/local/bin/yadm
## Getting Started
_I would not change my blest estate for all the world calls good or great._—Isaac Watts
If you know how to use Git, then you already know how to use **yadm**.
See the [man page](yadm.md) for a comprehensive explanation of commands and options.
#### If you don't currently have a repository
Start out with an empty local repository
yadm init
yadm add <important file>
yadm commit
Eventually you will want to push the local repo to a remote.
yadm remote add origin <url>
yadm push -u origin master
#### If you have an existing remote repository
This `clone` will attempt to merge your existing repository, but if it fails, it will do a reset instead and you'll have to decide best on how resolve the differences.
yadm clone <url>
yadm status
## Strategies for alternate files on different systems
_To feel at home, stay at home._—Clifton Fadiman
Where possible, you should try to use the same file on every system. Here are a few examples:
### .vimrc
let OS=substitute(system('uname -s'),"\n","","")
if (OS == "Darwin")
" do something that only makes sense on a Mac
endif
### .tmux.conf
# use reattach-to-user-namespace as the default command on OSX
if-shell "test -f /usr/local/bin/reattach-to-user-namespace" 'set -g default-command "reattach-to-user-namespace -l bash"'
### .bash_profile
system_type=$(uname -s)
if [ "$system_type" = "Darwin" ]; then
eval $(gdircolors $HOME/.dir_colors)
else
eval $(dircolors -b $HOME/.dir_colors)
fi
However, sometimes the type of file you are using doesn't allow for this type of logic. If a configuration can do an "include", you can include a specific alternate version using **yadm**. Consider these three files:
### .gitconfig
#---- .gitconfig -----------------
[log]
decorate = short
abbrevCommit = true
[include]
path = .gitconfig.local
#---- .gitconfig.local##Darwin ---
[user]
name = Tim Byrne
email = tim@personal.email.org
#---- .gitconfig.local##Linux ----
[user]
name = Dr. Tim Byrne
email = dr.byrne@work.email.com
Configuring Git this way includes `.gitconfig.local` in the standard `.gitconfig`. **yadm** will automatically link the correct version based on the operation system. The bulk of your configurations can go in a single file, and you just put the exceptions in OS-specific files.
Of course, you can use **yadm** to manage completely separate files for different systems as well.
### .signature
#---- .signature##
- Tim
#---- .signature##Darwin.host1
Sent from my MacBook
- Tim
#---- .signature##Linux.host2
Sincerely,
Dr. Tim Byrne
**yadm** will link the appropriate version for the current host, or use the default `##` version.
## Example of managing SSH configurations
_We shape our dwellings, and afterwards our dwellings shape us._—Winston Churchill
Below is an example of how **yadm** can be used to manage SSH configurations. The example demonstrates **yadm** directly managing the `config` file, managing a host-specific `authorized_keys` file, and storing the private SSH key as part of its encrypted files. This example assumes a typical working SSH configuration exists, and walks through the steps to bring it under **yadm**'s management.
yadm add ~/.ssh/config
mv ~/.ssh/authorized_keys ~/.ssh/authorized_keys##Linux.myhost
yadm add ~/.ssh/authorized_keys##Linux.myhost
echo '.ssh/id_rsa' >> ~/.yadm/encrypt
yadm add ~/.yadm/encrypt
yadm encrypt
------
yadm status
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: .ssh/authorized_keys##Linux.myhost
new file: .ssh/config
new file: .yadm/encrypt
new file: .yadm/files.gpg
------
ls ~/.ssh
authorized_keys -> ~/.ssh/authorized_keys##Linux.myhost
authorized_keys##Linux.myhost
config
rsa_id
First, the `config` file is simply added. This will cause the same `config` file to be used on other **yadm** managed hosts. The `authorized_keys` file needs to be host specific, so rename the file using the OS and hostname. After adding the renamed `authorized_keys##Linux.myhost`, **yadm** will automatically create the symlink for it. Last, the private key should be maintained in **yadm**'s encrypted files. Add a pattern to the `.yadm/encrypt` file which matches the private key. Then instruct **yadm** to encrypt all files matching the patterns found in `.yadm/encrypt`. Notice that the **yadm** repository is not tracking the private key directly, rather it tracks the collection of encrypted files `.yadm/files.gpg`. When these changes are brought onto another host, using the `yadm decrypt` command will extract the files stored.
[https://thelocehiliosan.github.io/yadm/](https://thelocehiliosan.github.io/yadm/)
<!-- vim: set spell lbr : -->

2
yadm
View File

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

11
yadm.1
View File

@ -1,5 +1,5 @@
." vim: set spell so=8:
.TH yadm 1 "22 April 2016" "1.04"
.TH yadm 1 "8 September 2016" "1.05"
.SH NAME
yadm \- Yet Another Dotfiles Manager
.SH SYNOPSIS
@ -504,7 +504,7 @@ Commit a new set of encrypted files
.SH REPORTING BUGS
Report issues or create pull requests at GitHub:
https://github.com/TheLocehiliosan/yadm
https://github.com/TheLocehiliosan/yadm/issues
.SH AUTHOR
Tim Byrne <sultan@locehilios.com>
.SH SEE ALSO
@ -512,9 +512,4 @@ Tim Byrne <sultan@locehilios.com>
.BR git (1),
.BR gpg (1)
Other management tools which inspired the creation of
.BR yadm :
.BR homeshick " <https://github.com/andsens/homeshick>
.BR vcsh " <https://github.com/RichiH/vcsh>
https://thelocehiliosan.github.io/yadm/

27
yadm.md
View File

@ -188,19 +188,23 @@
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.
## 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 operation 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.
sion of a file, as long as you follow a specific naming convention.
yadm can detect files with names ending in:
## or ##OS or ##OS.HOSTNAME or ##OS.HOSTNAME.USER
If there are any files managed by yadm's repository which match this
naming convention, symbolic links will be created for the most appro-
priate version. This may best be demonstrated by example. Assume the
If there are any files managed by yadm's repository which match this
naming convention, symbolic links will be created for the most appro-
priate version. This may best be demonstrated by example. Assume the
following files are managed by yadm's repository:
- $HOME/path/example.txt##
@ -221,7 +225,7 @@
$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.
If running on a Linux server named "host4", the link will be:
@ -232,9 +236,12 @@
$HOME/path/example.txt -> $HOME/path/example.txt##
If no "##" version exists and no files match the current OS/HOST-
If no "##" version exists and no files match the current OS/HOST-
NAME/USER, then no link will be created.
Links are also created for directories named this way, as long as they
have at least one yadm managed file within them.
OS is determined by running uname -s, HOSTNAME by running hostname -s,
and USER by running id -u -n. yadm will automatically create these
links by default. This can be disabled using the yadm.auto-alt configu-
@ -338,7 +345,7 @@
## REPORTING BUGS
Report issues or create pull requests at GitHub:
https://github.com/TheLocehiliosan/yadm
https://github.com/TheLocehiliosan/yadm/issues
## AUTHOR
Tim Byrne <sultan@locehilios.com>
@ -346,11 +353,7 @@
## SEE ALSO
git(1), gpg(1)
Other management tools which inspired the creation of yadm:
homeshick <https://github.com/andsens/homeshick>
vcsh <https://github.com/RichiH/vcsh>
https://thelocehiliosan.github.io/yadm/

View File

@ -1,6 +1,6 @@
Summary: Yet Another Dotfiles Manager
Name: yadm
Version: 1.04
Version: 1.05
Release: 1
URL: https://github.com/TheLocehiliosan/yadm
License: GPLv3
@ -33,6 +33,13 @@ install -m 644 yadm.1 ${RPM_BUILD_ROOT}%{_mandir}/man1
%attr(644,root,root) %{_mandir}/man1/*
%changelog
* Thu Sep 8 2016 Tim Byrne <sultan@locehilios.com> 1.05-1
- Improve portability of shebang line
- Support for symlinked directories
- Improve portability of tar parameters
- Support alternate gpg program
- Fallback to using ls if /bin/ls does not exist
* Fri Apr 22 2016 Tim Byrne <sultan@locehilios.com> 1.04-1
- Support alternate paths for yadm data
- Support asymmetric encryption