Compare commits
5 commits
f32efe7db8
...
0e804e28ce
Author | SHA1 | Date | |
---|---|---|---|
|
0e804e28ce | ||
|
ec10041024 | ||
|
3a1b236147 | ||
|
1aecf166f7 | ||
|
fccbd9348e |
3 changed files with 39 additions and 20 deletions
16
README.md
16
README.md
|
@ -18,11 +18,12 @@
|
||||||
**yadm** is a tool for managing [dotfiles][].
|
**yadm** is a tool for managing [dotfiles][].
|
||||||
|
|
||||||
* Based on [Git][], with full range of Git's features
|
* Based on [Git][], with full range of Git's features
|
||||||
* Supports system-specific alternative files or templated files
|
* Supports system-specific [alternative][feature-alternates] files or
|
||||||
* Encryption of private data using [GnuPG][], [OpenSSL][], [transcrypt][], or
|
[templated][feature-templates] files
|
||||||
[git-crypt][]
|
* [Encryption][feature-encryption] of private data using [GnuPG][],
|
||||||
* Customizable initialization (bootstrapping)
|
[OpenSSL][], [transcrypt][], or [git-crypt][]
|
||||||
* Customizable hooks for before and after any operation
|
* Customizable initialization ([bootstrapping][feature-bootstrap])
|
||||||
|
* Customizable [hooks][feature-hooks] for before and after any operation
|
||||||
|
|
||||||
Complete features, usage, examples and installation instructions can be found on
|
Complete features, usage, examples and installation instructions can be found on
|
||||||
the [yadm.io][website-link] website.
|
the [yadm.io][website-link] website.
|
||||||
|
@ -63,6 +64,11 @@ The star count helps others discover yadm.
|
||||||
[develop-commits]: https://github.com/yadm-dev/yadm/commits/develop
|
[develop-commits]: https://github.com/yadm-dev/yadm/commits/develop
|
||||||
[develop-date]: https://img.shields.io/github/last-commit/yadm-dev/yadm/develop.svg?label=develop
|
[develop-date]: https://img.shields.io/github/last-commit/yadm-dev/yadm/develop.svg?label=develop
|
||||||
[dotfiles]: https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory
|
[dotfiles]: https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory
|
||||||
|
[feature-alternates]: https://yadm.io/docs/alternates
|
||||||
|
[feature-bootstrap]: https://yadm.io/docs/bootstrap
|
||||||
|
[feature-hooks]: https://yadm.io/docs/hooks
|
||||||
|
[feature-encryption]: https://yadm.io/docs/encryption
|
||||||
|
[feature-templates]: https://yadm.io/docs/templates
|
||||||
[gh-pages-badge]: https://img.shields.io/github/actions/workflow/status/yadm-dev/yadm/test.yml?branch=gh-pages
|
[gh-pages-badge]: https://img.shields.io/github/actions/workflow/status/yadm-dev/yadm/test.yml?branch=gh-pages
|
||||||
[git-crypt]: https://github.com/AGWA/git-crypt
|
[git-crypt]: https://github.com/AGWA/git-crypt
|
||||||
[homebrew-badge]: https://img.shields.io/homebrew/v/yadm.svg
|
[homebrew-badge]: https://img.shields.io/homebrew/v/yadm.svg
|
||||||
|
|
|
@ -14,11 +14,16 @@ if [[ ! -d "$BOOTSTRAP_D" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find -L "$BOOTSTRAP_D" -type f | sort | while IFS= read -r bootstrap; do
|
declare -a bootstraps
|
||||||
if [[ -x "$bootstrap" && ! "$bootstrap" =~ "##" && ! "$bootstrap" =~ "~$" ]]; then
|
while IFS= read -r bootstrap; do
|
||||||
if ! "$bootstrap"; then
|
if [[ -x "$bootstrap" && ! "$bootstrap" =~ "##" && ! "$bootstrap" =~ ~$ ]]; then
|
||||||
echo "Error: bootstrap '$bootstrap' failed" >&2
|
bootstraps+=("$bootstrap")
|
||||||
exit 1
|
fi
|
||||||
fi
|
done < <(find -L "$BOOTSTRAP_D" -type f | sort)
|
||||||
|
|
||||||
|
for bootstrap in "${bootstraps[@]}"; do
|
||||||
|
if ! "$bootstrap"; then
|
||||||
|
echo "Error: bootstrap '$bootstrap' failed" >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
26
yadm
26
yadm
|
@ -77,6 +77,10 @@ CHANGES_POSSIBLE=0
|
||||||
# 0: skip auto_bootstrap, 1: ask, 2: perform bootstrap, 3: prevent bootstrap
|
# 0: skip auto_bootstrap, 1: ask, 2: perform bootstrap, 3: prevent bootstrap
|
||||||
DO_BOOTSTRAP=0
|
DO_BOOTSTRAP=0
|
||||||
|
|
||||||
|
# flag to indicate if the program should be quiet or not
|
||||||
|
# YES: be quiet, NO: be more noisy
|
||||||
|
QUIET="NO"
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
|
||||||
require_git
|
require_git
|
||||||
|
@ -120,7 +124,7 @@ function main() {
|
||||||
-a) # used by list()
|
-a) # used by list()
|
||||||
LIST_ALL="YES"
|
LIST_ALL="YES"
|
||||||
;;
|
;;
|
||||||
-d) # used by all commands
|
-d|--debug) # used by all commands
|
||||||
DEBUG="YES"
|
DEBUG="YES"
|
||||||
;;
|
;;
|
||||||
-f) # used by init(), clone() and upgrade()
|
-f) # used by init(), clone() and upgrade()
|
||||||
|
@ -130,6 +134,9 @@ function main() {
|
||||||
DO_LIST="YES"
|
DO_LIST="YES"
|
||||||
[[ "$YADM_COMMAND" =~ ^(clone|config)$ ]] && YADM_ARGS+=("$1")
|
[[ "$YADM_COMMAND" =~ ^(clone|config)$ ]] && YADM_ARGS+=("$1")
|
||||||
;;
|
;;
|
||||||
|
-q|--quiet) # used by all commands
|
||||||
|
QUIET="YES"
|
||||||
|
;;
|
||||||
-w) # used by init() and clone()
|
-w) # used by init() and clone()
|
||||||
YADM_WORK="$(qualify_path "$2" "work tree")"
|
YADM_WORK="$(qualify_path "$2" "work tree")"
|
||||||
shift
|
shift
|
||||||
|
@ -246,7 +253,7 @@ function score_file() {
|
||||||
record_template "$tgt" "$cmd" "$src"
|
record_template "$tgt" "$cmd" "$src"
|
||||||
else
|
else
|
||||||
debug "No supported template processor for template $src"
|
debug "No supported template processor for template $src"
|
||||||
[ -n "$loud" ] && echo "No supported template processor for template $src"
|
[ "$QUIET" = "NO" ] && echo "No supported template processor for template $src"
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
# unsupported values
|
# unsupported values
|
||||||
|
@ -586,10 +593,6 @@ function alt() {
|
||||||
local local_distro_family
|
local local_distro_family
|
||||||
set_local_alt_values
|
set_local_alt_values
|
||||||
|
|
||||||
# only be noisy if the "alt" command was run directly
|
|
||||||
local loud=
|
|
||||||
[ "$YADM_COMMAND" = "alt" ] && loud="YES"
|
|
||||||
|
|
||||||
# decide if a copy should be done instead of a symbolic link
|
# decide if a copy should be done instead of a symbolic link
|
||||||
local do_copy=0
|
local do_copy=0
|
||||||
[ "$(config --bool yadm.alt-copy)" == "true" ] && do_copy=1
|
[ "$(config --bool yadm.alt-copy)" == "true" ] && do_copy=1
|
||||||
|
@ -734,7 +737,7 @@ function alt_linking() {
|
||||||
if [ -n "$template_cmd" ]; then
|
if [ -n "$template_cmd" ]; then
|
||||||
# a template is defined, process the template
|
# a template is defined, process the template
|
||||||
debug "Creating $tgt from template $src"
|
debug "Creating $tgt from template $src"
|
||||||
[ -n "$loud" ] && echo "Creating $tgt from template $src"
|
[ "$QUIET" = "NO" ] && echo "Creating $tgt from template $src"
|
||||||
# ensure the destination path exists
|
# ensure the destination path exists
|
||||||
assert_parent "$tgt"
|
assert_parent "$tgt"
|
||||||
# remove any existing symlink before processing template
|
# remove any existing symlink before processing template
|
||||||
|
@ -743,7 +746,7 @@ function alt_linking() {
|
||||||
elif [ -n "$src" ]; then
|
elif [ -n "$src" ]; then
|
||||||
# a link source is defined, create symlink
|
# a link source is defined, create symlink
|
||||||
debug "Linking $src to $tgt"
|
debug "Linking $src to $tgt"
|
||||||
[ -n "$loud" ] && echo "Linking $src to $tgt"
|
[ "$QUIET" = "NO" ] && echo "Linking $src to $tgt"
|
||||||
# ensure the destination path exists
|
# ensure the destination path exists
|
||||||
assert_parent "$tgt"
|
assert_parent "$tgt"
|
||||||
if [ "$do_copy" -eq 1 ]; then
|
if [ "$do_copy" -eq 1 ]; then
|
||||||
|
@ -1200,6 +1203,11 @@ Commands:
|
||||||
yadm git-crypt [OPTIONS] - Run git-crypt commands for the yadm repo
|
yadm git-crypt [OPTIONS] - Run git-crypt commands for the yadm repo
|
||||||
yadm transcrypt [OPTIONS] - Run transcrypt commands for the yadm repo
|
yadm transcrypt [OPTIONS] - Run transcrypt commands for the yadm repo
|
||||||
|
|
||||||
|
General Options:
|
||||||
|
--help - Display this help message
|
||||||
|
-d, --debug - Enable debug output
|
||||||
|
-q, --quiet - Suppress output
|
||||||
|
|
||||||
Files:
|
Files:
|
||||||
\$HOME/.config/yadm/config - yadm's configuration file
|
\$HOME/.config/yadm/config - yadm's configuration file
|
||||||
\$HOME/.config/yadm/encrypt - List of globs to encrypt/decrypt
|
\$HOME/.config/yadm/encrypt - List of globs to encrypt/decrypt
|
||||||
|
@ -2069,7 +2077,7 @@ function auto_alt() {
|
||||||
if [ "$CHANGES_POSSIBLE" = "1" ] ; then
|
if [ "$CHANGES_POSSIBLE" = "1" ] ; then
|
||||||
auto_alt=$(config --bool yadm.auto-alt)
|
auto_alt=$(config --bool yadm.auto-alt)
|
||||||
if [ "$auto_alt" != "false" ] ; then
|
if [ "$auto_alt" != "false" ] ; then
|
||||||
[ -d "$YADM_REPO" ] && alt
|
[ -d "$YADM_REPO" ] && QUIET="YES" alt
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue