Add option to list encrypted files

This commit is contained in:
Tim Byrne 2015-07-16 20:57:53 -05:00
parent 5a44ef25ca
commit d1fe16407d
3 changed files with 62 additions and 47 deletions

16
yadm
View File

@ -65,6 +65,9 @@ function main() {
-f) #; used by init() and clone()
FORCE="YES"
;;
-l) #; used by decrypt()
DO_LIST="YES"
;;
-w) #; used by init() and clone()
if [[ ! "$2" =~ ^/ ]] ; then
error_out "You must specify a fully qualified work tree"
@ -194,10 +197,16 @@ function decrypt() {
YADM_WORK=$(git config core.worktree)
if [ "$DO_LIST" == "YES" ] ; then
tar_option="t"
else
tar_option="x"
fi
#; decrypt the archive
(gpg -d "$YADM_ARCHIVE" || echo 1) | tar xv -C "$YADM_WORK"
(gpg -d "$YADM_ARCHIVE" || echo 1) | tar v$tar_option -C "$YADM_WORK"
if [ $? = 0 ] ; then
echo "All files decrypted."
[ ! "$DO_LIST" == "YES" ] && echo "All files decrypted."
else
error_out "Unable to extract encrypted files."
fi
@ -265,13 +274,14 @@ Commands:
yadm list [-a] - List tracked files
yadm alt - Create links for alternates
yadm encrypt - Encrypt files
yadm decrypt - Decrypt files
yadm decrypt [-l] - Decrypt files
yadm perms - Fix perms for private files
Files:
\$HOME/.yadm/config - yadm's configuration file
\$HOME/.yadm/repo.git - yadm's Git repository
\$HOME/.yadm/encrypt - List of globs used for encrypt/decrypt
\$HOME/.yadm/files.gpg - Encrypted data stored here
Use "man yadm" for complete documentation.
EOF

4
yadm.1
View File

@ -36,6 +36,7 @@ list
.BR yadm " encrypt
.BR yadm " decrypt
.RB [ -l ]
.BR yadm " alt
@ -136,6 +137,9 @@ Decrypt all files stored in
Files decrypted will be relative to the configured
.IR work-tree " (usually
.IR $HOME ).
Using the
.B -l
option will list the files stored without extracting them.
.TP
.B encrypt
Encrypt all files matching the patterns found in

View File

@ -21,7 +21,7 @@
yadm encrypt
yadm decrypt
yadm decrypt [-l]
yadm alt
@ -78,7 +78,8 @@
decrypt
Decrypt all files stored in $HOME/.yadm/files.gpg. Files
decrypted will be relative to the configured work-tree (usually
$HOME).
$HOME). Using the -l option will list the files stored without
extracting them.
encrypt
Encrypt all files matching the patterns found in