From 5e0351c7ade458c9da8ff9e13cdfa72b975f052d Mon Sep 17 00:00:00 2001 From: "Paul Buetow (mars.fritz.box)" Date: Sat, 21 Dec 2013 12:00:03 +0100 Subject: add snapshotdir --- bin/pwgrep.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/pwgrep.sh b/bin/pwgrep.sh index 7f74930..42bdc58 100755 --- a/bin/pwgrep.sh +++ b/bin/pwgrep.sh @@ -25,7 +25,8 @@ declare DEFAULTDB=private.gpg declare DEFAULTFILESTOREDIR=filestore declare DEFAULTFILESTORECATEGORY=default -declare -r PWGREP_VERSION=0.8.8 +declare DEFAULTSNAPSHOTDIR=~/.pwgrep.snapshots +declare -r PWGREP_VERSION=0.9.0 [ -z "$RCFILE" ] && RCFILE=~/.pwgreprc @@ -60,6 +61,9 @@ function configure () { # For password revisions. [ -z "$WORKDIR" ] && echo export WORKDIR=~/git/pwdb + # The dir there to store offline snapshots, which are something like backups + [ -z "$SNAPSHOTDIR" ] && echo export SNAPSHOTDIR=$DEFAULTSNAPSHOTDIR + # Enter here your GnuPG key ID [ -z "$GPGKEYID" ] && echo export GPGKEYID=37EC5C1D @@ -169,7 +173,8 @@ function pwupdate () { function pwedit () { pwupdate - cp -vp $DB $DB.$(date +'%s').snap && \ + test ! -d $SNAPSHOTDIR && mkdir -p $SNAPSHOTDIR && chmod 0700 $SNAPSHOTDIR + cp -vp $DB $SNAPSHOTDIR/$DB.$(date +'%s').snap && \ gpg --decrypt $DB > .database && \ vim --cmd 'set noswapfile' --cmd 'set nobackup' \ --cmd 'set nowritebackup' .database && \ -- cgit v1.2.3