1
0
Fork 0
mirror of synced 2024-12-04 06:35:36 -05:00

Compare commits

...

10 commits

Author SHA1 Message Date
LiteLotus
78eb48938a
Merge 69f6dbeebc into ec10041024 2024-11-26 10:30:12 -05:00
Erik Flodin
ec10041024
Call bootstrap scripts with a tty
Inspired by #449 but using read instead of mapfile to make it work with bash
3. Fixes #344.
2024-11-24 20:18:22 +01:00
Erik Flodin
3a1b236147
Link features in README.md to yadm.io (as suggested in #346) 2024-11-24 17:03:56 +01:00
Lamar Daughma
69f6dbeebc switched to better function replacement 2022-01-28 17:30:18 +00:00
Lamar Daughma
9ed1af1fab Merge branch 'master' of github.com:Lite5h4dow/yadm 2022-01-28 13:01:08 +00:00
Lamar Daughma
04544b4d8f removing dead space 2022-01-28 13:00:24 +00:00
LiteLotus
89d7df0d1b
Merge branch 'TheLocehiliosan:master' into master 2022-01-28 12:57:52 +00:00
Lamar Daughma
c6b4bde04c finishing vars print 2022-01-28 12:36:00 +00:00
Lamar Daughma
cee2b5753c adding better variable detection 2022-01-28 11:17:17 +00:00
Lamar Daughma
7b76dabe7b adding verify command 2021-11-24 15:49:00 +00:00
3 changed files with 129 additions and 13 deletions

View file

@ -18,11 +18,12 @@
**yadm** is a tool for managing [dotfiles][].
* Based on [Git][], with full range of Git's features
* Supports system-specific alternative files or templated files
* Encryption of private data using [GnuPG][], [OpenSSL][], [transcrypt][], or
[git-crypt][]
* Customizable initialization (bootstrapping)
* Customizable hooks for before and after any operation
* Supports system-specific [alternative][feature-alternates] files or
[templated][feature-templates] files
* [Encryption][feature-encryption] of private data using [GnuPG][],
[OpenSSL][], [transcrypt][], or [git-crypt][]
* 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
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-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
[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
[git-crypt]: https://github.com/AGWA/git-crypt
[homebrew-badge]: https://img.shields.io/homebrew/v/yadm.svg

View file

@ -14,11 +14,16 @@ if [[ ! -d "$BOOTSTRAP_D" ]]; then
exit 1
fi
find -L "$BOOTSTRAP_D" -type f | sort | while IFS= read -r bootstrap; do
if [[ -x "$bootstrap" && ! "$bootstrap" =~ "##" && ! "$bootstrap" =~ "~$" ]]; then
if ! "$bootstrap"; then
echo "Error: bootstrap '$bootstrap' failed" >&2
exit 1
fi
declare -a bootstraps
while IFS= read -r bootstrap; do
if [[ -x "$bootstrap" && ! "$bootstrap" =~ "##" && ! "$bootstrap" =~ ~$ ]]; then
bootstraps+=("$bootstrap")
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
done

109
yadm
View file

@ -99,7 +99,7 @@ function main() {
# parse command line arguments
local retval=0
internal_commands="^(alt|bootstrap|clean|clone|config|decrypt|encrypt|enter|git-crypt|help|--help|init|introspect|list|perms|transcrypt|upgrade|version|--version)$"
internal_commands="^(alt|bootstrap|clean|clone|config|decrypt|encrypt|enter|echo|git-crypt|help|--help|init|introspect|list|perms|transcrypt|upgrade|version|--version)$"
if [ -z "$*" ] ; then
# no argumnts will result in help()
help
@ -144,7 +144,7 @@ function main() {
[ ! -d "$YADM_WORK" ] && error_out "Work tree does not exist: [$YADM_WORK]"
HOOK_COMMAND="$YADM_COMMAND"
invoke_hook "pre"
$YADM_COMMAND "${YADM_ARGS[@]}"
${YADM_COMMAND/echo/yecho} "${YADM_ARGS[@]}"
else
# any other commands are simply passed through to git
HOOK_COMMAND="$1"
@ -1199,6 +1199,7 @@ Commands:
yadm enter [COMMAND] - Run sub-shell with GIT variables set
yadm git-crypt [OPTIONS] - Run git-crypt commands for the yadm repo
yadm transcrypt [OPTIONS] - Run transcrypt commands for the yadm repo
yadm echo [OPTIONS] - View yadm internal commands and file paths
Files:
\$HOME/.config/yadm/config - yadm's configuration file
@ -1485,6 +1486,110 @@ function version() {
}
function print_variables(){
local local_class
local local_system
local local_host
local local_user
local local_distro
set_local_alt_values
if [[ -z "$2" ]]; then
echo "Yadm variables:
distro=$local_distro
system=$local_system
hostname=$local_host
user=$local_user
class=$local_class
"
else
case "$2" in
class)
echo $local_class
;;
system)
echo $local_system
;;
host)
echo $local_host
;;
user)
echo $local_user
;;
distro)
echo $local_distro
;;
*)
echo "$2 is not a valid option"
esac
fi
}
function print_paths(){
if [[ -z "$2" ]] ; then
echo "yadm paths:
repo=$YADM_REPO
yadm_dir=$YADM_DIR
config=$YADM_CONFIG
encrypt=$YADM_ENCRYPT
archive=$YADM_ARCHIVE
"
else
case "$2" in
repo)
echo $YADM_REPO
;;
dir|yadm_dir)
echo $YADM_DIR
;;
config)
echo $YADM_CONFIG
;;
encrypt)
echo $YADM_ENCRYPT
;;
archive)
echo $YADM_ARCHIVE
;;
*)
echo " in path "
echo "$2 is not a valid option"
esac
fi
}
function yecho() {
#verify internal yadm variables
if [[ $# -eq 0 ]] ; then
print_variables
print_paths
fi
while [[ $# -gt 0 ]] ; do
case "$1" in
vars|variables)
print_variables "${YADM_ARGS[@]}"
if [[ ! -z "$2" ]] ; then
shift
fi
;;
paths|path)
print_paths "${YADM_ARGS[@]}"
if [[ ! -z "$2" ]] ; then
shift
fi
;;
*)
echo "$1 is not a valid command"
;;
esac
shift
done
}
# ****** Utility Functions ******
function exclude_encrypted() {