Commit Graph

299 Commits

Author SHA1 Message Date
Erik Flodin 8a3fb1a518
Make yadm enter work with zsh and tramp
zle must be disabled when using tramp, otherwise it doesn't work.
2020-12-29 23:58:05 +01:00
Erik Flodin 5e9c5cf66c
Issue legacy path warnings to stderr
To make it possible to ignore the warning e.g. when running yadm
introspect repo in the bash completion.
2020-12-27 22:33:15 +01:00
Tim Byrne df2ff5ec70
Remove deprecated option cygwin-copy 2020-12-26 12:34:58 -06:00
Tim Byrne d45d53ff39
Fix typo 2020-12-23 10:40:36 -06:00
Tim Byrne f9337101ee
Adjust formatting
Also use `{...;}` instead of `(...)`
2020-12-22 11:51:46 -06:00
Tim Byrne c2cb41cdd5
Merge pull request #150 from addshore/patch-1 2020-12-22 11:17:05 -06:00
Tim Byrne 7f23dde912
Merge pull request #210 from abathur/fix_regexp_space 2020-12-22 11:01:51 -06:00
Tim Byrne d298b42653
Merge pull request #257 from erijo/extension 2020-12-22 10:08:30 -06:00
Tim Byrne 999e0f11f8
Merge pull request #259 from erijo/cleanups 2020-12-22 09:54:01 -06:00
Tim Byrne 56e48947d0
Merge pull request #271 from rasa/patch-3 2020-12-22 09:41:06 -06:00
Tim Byrne c4b419d98e
Add --version and --help as yadm internal commands (#267) 2020-12-21 17:06:14 -06:00
Tim Byrne e3d2ea2863
Combine local and assignments where appropriate 2020-12-21 17:06:14 -06:00
Ross Smith II e2d9c06168
Fix paths in yadm help output
For completeness, I added the bootstrap script too.
2020-12-18 09:44:01 -08:00
Tim Byrne 80d8949850
Update regex to match horizontal white space only 2020-12-06 22:36:12 -06:00
Tim Byrne 4b5f16d73a
Improve support for default branches (#231, #232)
Unless a branch is specified, the default remote HEAD is used during
clone. Also a local master branch is not created if it is not the remote
HEAD.
2020-12-06 13:23:25 -06:00
Tim Byrne 4cb13d5d08
Remove unnecessary LEGACY_WARNING_ISSUED flag 2020-11-25 23:18:26 -06:00
Tim Byrne 13a3cdc8a8
Remove reporting of invalid alts 2020-11-25 23:18:25 -06:00
Tim Byrne 7997dc9a3d
Update upgrade
Upgrade will only move 2.0.0 paths to 3.0.0 standards
2020-11-25 23:18:25 -06:00
Tim Byrne fc66b6b71b
Support XDG_DATA_HOME (#208)
* Create a YADM_DATA base (that is the source for repo & archive)
* Add --yadm-data to override
* Default YADM_DATA will be determined by XDG_DATA_HOME
2020-11-22 17:09:44 -06:00
Erik Flodin f22c4d04cc
Add support for the extension "condition"
This special condition doesn't affect the selection process and is only
supported to support syntax highlighting and language detection for alt files
as reported in #239.
2020-10-25 10:41:52 +01:00
Erik Flodin 4e1fb0166e
Reuse if pattern in template_default's condition pattern 2020-10-18 22:40:06 +02:00
Erik Flodin 3ce59314f5
Remove unused function alt_past_linking
Unused as of b19c78b8
2020-10-18 22:20:06 +02:00
Tim Byrne b19c78b8e2
Remove support for YADM_COMPATIBILITY=1 (#242) 2020-10-17 17:41:09 -05:00
Erik Flodin 9bcf070dfe
Add support for including files using the default template processor
The syntax is '{% include "file" %}' where file is either an absolute path or a
path relative to the current template file's directory.

Variables in the included file will be replaced as for the main template. But
the included file can't include files itself.
2020-10-12 16:13:50 +02:00
Tim Byrne 2e035d9e05
Refactor encryption option generation 2020-10-07 01:21:55 -05:00
Tim Byrne c2a4d9cb27
Use OPENSSL_OPTS for encryption too 2020-10-05 22:32:18 -05:00
Tim Byrne 59c60a4675
Change default archive name to "archive" 2020-09-25 12:10:34 -05:00
Tim Byrne 05ae6f0257
Add config yadm.openssl-old
The newer versions (OpenSSL 1.1.1 or LibreSSL 2.9.1) support the pbkdf2
key derivation function, while older versions do not. In addition the
new versions have changed the default digest to SHA256 instead of MD5.

Files encrypted with older versions would throw warnings about
deprecated key derivation used files encrypted with newer versions +
pbkdf2 would not be decryptable using older versions These problems
matter, when many users maintain their dotfiles across different systems
with different levels of OpenSSL support.

A new boolean config option has been added, yadm.openssl-old

* If false, use options -pbkdf2 -iter 100000 -md sha512
* If true, use options -md md5 (and if decrypting with newer versions
  warnings will be printed)
2020-09-25 10:04:18 -05:00
Tim Byrne 47d4ea5f7e
Merge branch 'feature/alt-cyphers-138' into develop 2020-09-21 21:02:07 -05:00
Tim Byrne 0d94dfd8d7
Truncate using parameter expansion
I'm not completely sure truncation is actually needed, but regardless
this removes the dependency on `cut`.
2020-08-20 13:08:19 -05:00
Adam Jimerson a13311feac
Adjust file mode check for BSD based systems
Adjusts the file mode check for BSD based systems as default BSD stat
uses "-f '%p'" to report the file mode. Also since `stat -p '%p'
"$filename"` reports more information than just read, write, execute
perms, pipe the output through `cut` to grab only the last three digits.

Signed-off-by: Adam Jimerson <vendion@gmail.com>
2020-08-19 09:36:14 -04:00
Tim Byrne 7628a1b61d
Release 2.5.0
Update version number and update documentation

* Support for transcrypt (#197)
* Support ESH templates (#220)
* Preserve file mode of template (#193)
* Fish shell completions (#224)
* Fix alt processing when worktree is `/` (#198)
* Assert config directory if missing (#226, #227)
* Documentation improvements (#229)
2020-08-09 15:54:31 -05:00
Tim Byrne 6098f76616
Set default cipher in only one place 2020-07-17 14:43:29 -05:00
Tim Byrne d9adc80209
Adjust indent 2020-07-17 14:42:58 -05:00
Tim Byrne 4ae504c533
Merge alternative cyphers changes into develop 2020-07-17 14:07:10 -05:00
Tim Byrne 24e3dab328
Fix alternate file processing when worktree is / (#198) 2020-07-17 11:17:58 -05:00
Tim Byrne 102ba5d558
Preserve file mode of template (#193)
Any processed templates will inherit the file mode of the source
template.
2020-07-11 21:52:28 -05:00
Tim Byrne 6654e29c62
Merge pull request #220 2020-07-08 16:17:24 -05:00
Tim Byrne ed4a4a5fbd
Fix bug with out-of-sync sources
The indexes of targets, scores, sources, etc. must be kept in sync.
2020-07-08 16:16:48 -05:00
Tim Byrne b056051603
Identify yadm's configuration using $YADM_CONFIG 2020-07-08 16:16:48 -05:00
jonasc 60b23e33e8
Assert existence of config file's parent directory
Fixes TheLocehiliosan/yadm#226

When a config file path is passed to yadm whose parent directory does
not exist, git (and hence yadm) fails without writing the file.
Yadm should, however, make sure that the directory exists s.t. git can
just write to the file.
2020-07-08 15:13:03 -05:00
Jonathan Daigle bea6e5506a
Process config alt before any other.
This allows to version the configuration, using alt and to still be
able to use those configuration values in esh template
(using <% yamd config some-config %> )
2020-05-27 21:13:19 -04:00
Jonathan Daigle f348e154c7
Add support for ESH 2020-05-27 19:38:15 -04:00
Travis A. Everett 9132b6dec9
Fix regexp with space for compatibility 2020-04-02 22:41:08 -05:00
Tim Byrne 778c33145c
Remove legacy code which was reintroduced 2020-02-28 07:58:07 -06:00
Tim Byrne 0995f38b06
Merge pull request #138 from ldotlopez/master
I signed all commits first
2020-02-27 08:24:25 -06:00
Luis López 9fe5377749
Fix some typos and code style 2020-02-27 08:21:27 -06:00
Luis López 7698adfd77
Rebase on top of upstream/develop 2020-02-27 08:21:14 -06:00
Luis López 8e2d85de7f
Merge from upstream 2020-02-27 08:20:45 -06:00
Luis López 67ce492b2a
Added undocumented config `yadm.openssl-ciphername` 2020-02-27 07:44:44 -06:00
Luis López bde5ecbc66
Deduplicate openssl cipher name code (and change default value) 2020-02-27 07:44:41 -06:00
Luis López baaeb88628
Initial support for alternative cyphers.
This patch implements an OpenSSL cypher (via openssl enc command). It has to be enabled using yadm.cypher configuration key.

Some rough edges:
- archive file refers to GPG (.gpg extension)
- no test cases
2020-02-27 07:43:57 -06:00
James Clark 77d2da4e9b
Support architecture in alternates (#202) 2020-02-22 02:08:53 +00:00
Tim Byrne 4b99ece480
Support transcrypt (#197)
Support is inherently provided by `enter`, which supports a command.
I've added a `transcrypt` command, which is really just an alias
under-the-hood for "enter transcrypt".
2020-02-21 08:05:56 -06:00
Tim Byrne ee9ffb6828
Reorder command list 2020-02-21 07:55:58 -06:00
Tim Byrne dd86c8a691
Release 2.4.0
Update version number and update documentation

* Support multiple keys in `yadm.gpg-recipient` (#139)
* Ensure all templates are written atomically (#142)
* Add encrypt_with_checksums to the hooks collection (#188)
* Escape white space in YADM_HOOK_FULL_COMMAND (#187)
* Improve parsing of os-release (#194)
* Improve identification of WSL (#196)
* Fix troff warnings emitted by man page (#195)
* Write encrypt-based exclusions during decrypt
2020-02-06 07:53:18 -06:00
Tim Byrne 79e93e38bc
Fix error when /proc/version is missing 2020-02-03 08:30:50 -06:00
Ross Smith II 062181be4a
Simplify WSL identification 2020-02-03 08:27:54 -06:00
Tim Byrne 69cde7f83c
Exclude files listed in yadm/encrypt when decrypt is called
Previously this would only happen when encrypting.
2020-01-30 09:39:10 -06:00
Tim Byrne ccb75b97ea
Escape space in YADM_HOOK_FULL_COMMAND (#187)
Backslashes are used to escape spaces, tabs, and backslashes. This
allows hooks to identify separate parameters (which are space
delimited).
2020-01-24 08:33:07 -06:00
Tim Byrne 76c82c763e
Improve identification of WSL (#196)
Ignore case when searching for Microsoft inside /proc/version.
2020-01-20 07:52:50 -06:00
Tim Byrne 04b98a96cb
Ensure all templates are written atomically
This takes jonasc's change, and applies it to all template writing. Also
removes the dependency on mktemp, and only moves files if they are
successfully written.
2020-01-16 16:27:59 -06:00
Tim Byrne 3e42bd9f52
Merge pull request #142 from jonasc/master
Resolved conflicts, and signed commit from jonasc.
2020-01-16 12:59:32 -06:00
jonasc a1845c6e8a
Write template result to temporary file and move
This prevents problems with programs which watch the file for changes and will
first be presented an empty file.
One such example which will show a notification message about an empty config
file is Alacritty.
By writing to a tempory file and then moving it (atomically?) to the real
location this problem is mitigated.
2020-01-16 12:58:38 -06:00
Tim Byrne 0b22220e3c
Merge pull request #139 from stigtsp/multiple-gpg-recipients 2020-01-14 08:08:44 -06:00
Tim Byrne 4546636336
Merge pull request #194 from rasa/rasa/remove-quotes-from-distro 2020-01-14 07:14:04 -06:00
Martin Zuther 499837bd80
apply code review changes 2019-12-30 00:34:27 +01:00
Martin Zuther 45b218d5c1
support encrypted files in "yadm list"
* export some helper functions to hooks
2019-12-29 15:21:55 +01:00
Martin Zuther bd19e31c6e
get rid of dirname 2019-12-29 12:51:29 +01:00
Martin Zuther c190333fdf
correctly export array to subscript
* fix shellcheck errors and warnings
2019-12-28 16:09:19 +01:00
Martin Zuther 91266ca8eb
Check encrypted files with SHA-512/256 checksums 2019-12-27 18:15:04 +01:00
Tim Byrne b4fd9e19c2
Release 2.3.0
Update version number and update documentation

* Support git-crypt (#168)
* Support specifying a command after `yadm enter`
* Expose GIT_WORK_TREE during `yadm enter` (#160)
* Support GNUPGHOME environment variable (#134)
* Assert private dirs, only when worktree = $HOME (#171)
2019-12-17 07:15:58 -06:00
Tim Byrne 7ad28c3a97
Set exit status when running a command from `enter` 2019-12-16 17:11:07 -06:00
Tim Byrne d3a2a06184
Support git-crypt (#168)
Support is inherently provided by `enter`, which now supports a command.
I've added a `git-crypt` command, which is really just an alias
under-the-hood for "enter git-crypt".
2019-12-16 17:11:06 -06:00
Tim Byrne b9f5fdaafa
Support GNUPGHOME environment variable (#134) 2019-12-14 13:24:39 -06:00
Tim Byrne 84a173551e
Only assert private dirs, when worktree = $HOME (#171) 2019-12-14 13:24:32 -06:00
Tim Byrne cc1993dc14
Move logic around assert_private_dirs to be more efficient 2019-12-12 08:09:30 -06:00
Tim Byrne 46105aae47
Set YADM_WORK within configure_paths 2019-12-12 08:00:10 -06:00
Tim Byrne 18e5fcfacc
Only assert private dirs, when worktree = $HOME 2019-12-11 08:37:45 -06:00
Tim Byrne e7d2406af3
Export GIT_WORK_TREE during `yadm enter` (#160) 2019-12-08 15:17:47 -06:00
Tim Byrne 32baf81b56
Support specifying a command after `yadm enter` 2019-12-08 15:17:47 -06:00
Ross Smith II 43ac19398a
Remove quotes from distro name 2019-12-06 20:38:37 -08:00
Tim Byrne 96bce8dbac
Release 2.2.0
Update version number and update documentation

* Resolve hostname using `uname -n` (#182)
* Use /etc/os-release if lsb_release is missing (#175)
* Issue warning for any invalid alternates found (#183)
* Add support for gawk (#180)
2019-12-05 16:53:16 -06:00
Tim Byrne 4d23bbcf11
Standardize on &> when not appending output 2019-12-04 22:39:00 -06:00
Tim Byrne 758a2e0c26
Automatically prefer `gawk` over `awk` 2019-12-04 22:18:22 -06:00
Tim Byrne c0310a43a2
Merge pull request #180 from rasa/rasa/use-gawk-on-openwrt 2019-12-04 17:53:36 -06:00
Tim Byrne 3d10309665
Issue warning for any invalid alternates found (#183) 2019-12-03 08:38:11 -06:00
Tim Byrne 6bf0852609
Use /etc/os-release if lsb_release is missing (#175) 2019-11-30 18:31:27 -06:00
Tim Byrne 96839a5743
Remove dependency on `hostname` (#182) 2019-11-30 10:27:28 -06:00
Tim Byrne 75c19c9cc0
Release 2.1.0
Update version number and update documentation

* Use relative symlinks for alternates (#100, #177)
* Support double-star globs in .config/yadm/encrypt (#109)
* Improve bash completion (#136)
* Update docs about using magit (#123)
* Note exception for WSL (#113)
2019-11-27 07:21:44 -06:00
Tim Byrne 510169eb7f
Support double-star globs in encrypt (#109)
This will only work for Bash >=4, there the shell option "globstar" is
supported.
2019-11-26 16:24:51 -06:00
Tim Byrne 5634c09a8a
Refactor symlink code
Update variable names, favoring the terminology used by `ln`.
* source (original file containing data)
* target (the symlink file, pointing to source)
2019-11-25 08:24:46 -06:00
Tim Byrne 61576a6ae1
Use relative symlinks for alt (#100)
* Fix broken support for .config/yadm/alt
* Removes dependence on external basename / dirname
2019-11-25 07:27:54 -06:00
Tim Byrne 98392b9a9c
Add function relative_path
This function will create a path relative to another, without the use of
an external program like dirname.
2019-11-24 13:15:42 -06:00
Ross Smith II 2bf98a5ade
Use gawk on OpenWrt, as awk is BusyBox version
The BusyBox version of awk fails with this error:
awk: bad regex '[\\.^$(){}\[\]|*+?]': Repetition not preceded by valid expression
2019-11-23 19:39:57 -08:00
Tim Byrne 98915151a3
Revert version change 2019-11-17 12:39:05 -06:00
Ross Smith II 539ffd3ffc
Make symlinks relative 2019-11-13 08:17:06 -08:00
Tim Byrne 5aa1a7be75
Release 2.0.1
Update version number and update documentation

* Fix bug with worktree permissions (#174)
2019-11-12 07:49:26 -06:00
Ross Smith II 8633083716
Don't glob into parent dirs 2019-11-12 06:50:54 -06:00
Tim Byrne de73c9f4b4
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
2019-11-07 21:38:53 -06:00