summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow (mars.fritz.box) <paul@buetow.org>2013-12-21 12:00:03 +0100
committerPaul Buetow (mars.fritz.box) <paul@buetow.org>2013-12-21 12:00:03 +0100
commit5e0351c7ade458c9da8ff9e13cdfa72b975f052d (patch)
tree2e6dea50d49e8b9fbcbc4819e7f142096fb785bf
parent74ade29d117e57504e74868ad9408c923ed79ac1 (diff)
add snapshotdir0.9.0
-rwxr-xr-xbin/pwgrep.sh9
1 files 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 && \