Hi,

if you die it can be useful that your successor has your passwords. If
you are dead, it is to late to deal with this. So you have have to push
your passwords to a trustworthy person when you are still alive.

This can be done easily with pass because you only have to initialize
pass with the gpg-key of the trustworthy person, using git and pushing
the git repo to a server.

If you do not like to push the passwords to a server the patch crates a
git bundle-file which can be send to the trustworthy person via mail.

The command automates this example:
https://git-scm.com/docs/git-bundle#_example

Oskar Hahn


From 630e537d774ac4303901a9eafbac6c14594e105e Mon Sep 17 00:00:00 2001
From: Oskar Hahn <[email protected]>
Date: Sun, 16 Aug 2015 13:22:39 +0200
Subject: [PATCH] Added bundle command

---
 man/pass.1            |  5 +++++
 src/password-store.sh | 30 ++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/man/pass.1 b/man/pass.1
index e1fe605..da92de9 100644
--- a/man/pass.1
+++ b/man/pass.1
@@ -155,6 +155,11 @@ is set to \fItrue\fP, then all commits will be signed using \fIuser.signingkey\f
 default git signing key. This config key may be turned on using:
 .B `pass git config --bool --add pass.signcommits true`
 .TP
+\fBbundle\fP [ \fI filename\fP ]
+Creats a git bundle of the pass git repository to send it to a trustworthy person.
+This command is usefull for you digital legacy. If you die, the trustworthy person is
+able look at you passwords and act in your intrest.
+.TP
 \fBhelp\fP
 Show usage message.
 .TP
diff --git a/src/password-store.sh b/src/password-store.sh
index d535a74..15fd9a2 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -248,6 +248,9 @@ cmd_usage() {
 	    $PROGRAM git git-command-args...
 	        If the password store is a git repository, execute a git command
 	        specified by git-command-args.
+	    $PROGRAM bundle [filename]
+	        Creats a git bundle of the pass git repository to send it to a
+	        trustworthy person.
 	    $PROGRAM help
 	        Show this text.
 	    $PROGRAM version
@@ -569,6 +572,32 @@ cmd_git() {
 	fi
 }
 
+cmd_bundle() {
+	if [[ ! -d $GIT_DIR ]]; then
+		die "Error: The password store is not a git repository. Try \"$PROGRAM git init\"."
+	fi
+
+	local bundle_ref
+	local filename=${1-pass.bundle}
+	local tag_name="last_pass_bundle"
+	local commit_id=$(cmd_git rev-parse master)
+	if cmd_git rev-parse $tag_name &>/dev/null; then
+		# The tag exists.
+		bundle_ref="${tag_name}..${commit_id}"
+	else
+		# The tag does not exist. Create a boundle of the whole repo.
+
+		# To get all commits the bundle_ref has to be 'master'
+		# $commit_id does not work.
+		bundle_ref="master"
+	fi
+	if cmd_git bundle create $filename $bundle_ref -- &>/dev/null; then
+	    cmd_git tag -f $tag_name $commit_id
+	else
+	    die "Error: There are no changes in you password store. Call \"$PROGRAM git tag -d $tag_name\" to reset the bundle."
+	fi
+}
+
 #
 # END subcommand functions
 #
@@ -590,6 +619,7 @@ case "$1" in
 	rename|mv) shift;		cmd_copy_move "move" "$@" ;;
 	copy|cp) shift;			cmd_copy_move "copy" "$@" ;;
 	git) shift;			cmd_git "$@" ;;
+	bundle) shift;			cmd_bundle "$@" ;;
 	*) COMMAND="show";		cmd_show "$@" ;;
 esac
 exit 0
-- 
2.5.0

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to