TheLocehiliosan / yadm

Yet Another Dotfiles Manager
https://yadm.io/
GNU General Public License v3.0
4.92k stars 176 forks source link

Add suffix to ~/.local/share/yadm/archive to indicate encryption method #397

Closed rasa closed 2 years ago

rasa commented 2 years ago

Is your feature request related to a problem?

yadm has to be configured the same on every decrypting system to match the settings on the encrypting system.

Describe the solution you'd like

Yadm uses the suffix of the archive to automatically decrypt the archive. Here are some examples:

yadm.cipher yadm.openssl-ciphername yadm.openssl-old archive name
gpg archive.gpg
openssl (default) false archive.aes-256-cbc
(or aes256)
openssl (default) true archive.aes-256-cbc_old
(or aes256_old)
openssl aes-192-cbc false archive.aes-192-cbc
(or aes192)
openssl aes-192-cbc true archive.aes-192-cbc_old
(or aes192_old)
transcrypt archive.transcrypt
git-crypt archive.git-crypt

We could also solve this by creating a file with the config settings, called say ~/.local/share/yadm/archive.conf, but parsing it could prove problematic, so using the file extension seems cleaner. But this would allow full backward compatibility.

TheLocehiliosan commented 2 years ago

This seems like it would add a lot of complication. What would happen if there are multiple archives in the repository?

rasa commented 2 years ago

This seems like it would add a lot of complication. What would happen if there are multiple archives in the repository?

Good point. Yadm would need to be smart enough to remove an old archive when a new archive is created. It might be too complicated, but if there's interest, I could explore creating a draft PR for discussion.

rasa commented 2 years ago

Another solution could be to add yadm save-config and yadm restore-config commands. Something akin to:

yadm config -l >~/.config/yadm/settings.conf
yadm add ~/.config/yadm/settings.conf

and

IFS=$'\n' read -d '' -r -a lines <~/.config/yadm/settings.conf
for line in "${lines[@]}"; do
  yadm config "${line%=*}" "${line##*=}"
done

Edit: and maybe a yadm show-config as well:

cat ~/.config/yadm/settings.conf

or

read -d '' -r settings <~/.config/yadm/settings.conf
printf '%s\n' "${settings}"
github-actions[bot] commented 2 years ago

This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.