summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Mattern <rephorm@rephorm.com>2012-09-12 22:24:11 -0700
committerJason A. Donenfeld <Jason@zx2c4.com>2012-09-13 07:50:20 +0200
commit9fe3cb21e1193ede695bc790a5c476b009aef895 (patch)
tree378623d2d1af2d1ab32398384564124b654ad1fe /src
parent5ebe3f0a8949f4cafa2f2015fee96a6ed4bc1dce (diff)
downloadpass-9fe3cb21e1193ede695bc790a5c476b009aef895.tar.gz
pass-9fe3cb21e1193ede695bc790a5c476b009aef895.tar.bz2
pass-9fe3cb21e1193ede695bc790a5c476b009aef895.zip
Confirm before overwriting an entry
This asks before inserting a password when one already exists at that location (instead of just overwriting it).
Diffstat (limited to 'src')
-rwxr-xr-xsrc/password-store.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 402563c..c8a0a9f 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -184,9 +184,16 @@ case "$command" in
exit 1
fi
path="$1"
+ passfile="$PREFIX/$path.gpg"
+
+ if [[ -e $passfile ]]; then
+ prompt="An entry already exists for $path. Overwrite it [y/N]? "
+ read -p "$prompt" yesno
+ [[ $yesno == "y" || $yesno == "Y" ]] || exit 1
+ fi
+
mkdir -p -v "$PREFIX/$(dirname "$path")"
- passfile="$PREFIX/$path.gpg"
if [[ $ml -eq 1 ]]; then
echo "Enter contents of $path and press Ctrl+D when finished:"
echo
ions'>+1 2007-08-05some translation fixes :)necoro7-358/+357 2007-08-05pocompile testnecoro1-2/+2 2007-08-05pocompile testnecoro1-2/+3 2007-08-05pocompile testnecoro1-1/+6 2007-08-05i18n support and german translationsnecoro3-3/+11 2007-08-05i18n support and german translationsnecoro19-87/+1391 2007-08-04added an uncaught exception dialognecoro2-2/+1 2007-08-04added an uncaught exception dialognecoro4-3/+93 2007-08-04bugfixesnecoro3-5/+20 2007-08-01Removed "(GTK)" from desktop filenecoro1-1/+1 2007-07-30updatesnecoro1-1/+1 2007-07-30updatesnecoro2-21/+64 2007-07-28some more pause emerge itemsnecoro5-276/+423 2007-07-27changed design / added linknecoro3-66/+154 2007-07-26changed design / added linknecoro2-34/+27 2007-07-25changed design / added linknecoro5-86/+188 2007-07-24made the resume_loop-plugin change titles toonecoro5-7/+22 2007-07-21added logviewersnecoro7-215/+429 2007-07-21updated howtonecoro1-14/+24 2007-07-20new Plugin Schemenecoro1-5/+4 2007-07-20new Plugin Schemenecoro1-1/+1 2007-07-20new Plugin Schemenecoro9-162/+214 2007-07-13fixesnecoro4-27/+37 2007-07-13new fancier log outputnecoro14-127/+116 2007-07-11added SIGSTOP/SIGCONT support; SIGTERM now works ;)necoro8-208/+275 2007-07-09bug in shutdown pluginnecoro2-5/+12 2007-07-09added resume_loop pluginnecoro1-1/+1 2007-07-09added resume_loop pluginnecoro10-22/+162 2007-07-07some more documentationnecoro6-4/+108 2007-07-07Some documentation worknecoro7-18/+129