summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 && \