summaryrefslogtreecommitdiff
path: root/src/password-store.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/password-store.sh')
-rwxr-xr-xsrc/password-store.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index f466a8f..65283b8 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -163,10 +163,13 @@ clip() {
echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
}
tmpdir() {
+ local warn=1
+ [[ $1 == "nowarn" ]] && warn=0
+ local template="$PROGRAM.XXXXXXXXXXXXX"
if [[ -d /dev/shm && -w /dev/shm && -x /dev/shm ]]; then
SECURE_TMPDIR="$(TMPDIR=/dev/shm mktemp -d -t "$template")"
else
- yesno "$(cat <<-_EOF
+ [[ $warn -eq 1 ]] && yesno "$(cat <<-_EOF
Your system does not have /dev/shm, which means that it may
be difficult to entirely erase the temporary non-encrypted
password file after editing.
@@ -554,16 +557,20 @@ cmd_copy_move() {
}
cmd_git() {
+ tmpdir nowarn #Defines $SECURE_TMPDIR. We don't warn, because at most, this only copies encrypted files.
+ trap "rm -rf '$SECURE_TMPDIR'" INT TERM EXIT
+ export TMPDIR="$SECURE_TMPDIR"
+
if [[ $1 == "init" ]]; then
git "$@" || exit 1
git_add_file "$PREFIX" "Add current contents of password store."
echo '*.gpg diff=gpg' > "$PREFIX/.gitattributes"
- git_add_file .gitattributes "Assigning diff attribute for gpg files"
+ git_add_file .gitattributes "Configure git repository for gpg file diff."
git config --local diff.gpg.binary true
- git config --local diff.gpg.textconv "$GPG ${GPG_OPTS[*]} --decrypt"
+ git config --local diff.gpg.textconv "$GPG -d ${GPG_OPTS[*]}"
elif [[ -d $GIT_DIR ]]; then
- exec git "$@"
+ git "$@"
else
die "Error: the password store is not a git repository. Try \"$PROGRAM git init\"."
fi
/span>FixesRené 'Necoro' Neumann1-8/+5 2017-03-04Fix Peewee Model.get() (cf. PR #1202)René 'Necoro' Neumann1-1/+25 2017-03-04Remove "builtin" and "pseudo" columns; use "virtual" insteadRené 'Necoro' Neumann3-10/+4 2017-02-27Inserting DocumentsRené 'Necoro' Neumann4-16/+91 2017-02-26Refined the EnumFieldRené 'Necoro' Neumann2-24/+34 2017-02-26Introduce enum fieldsRené 'Necoro' Neumann1-2/+31 2017-02-26Introduce the closureRené 'Necoro' Neumann2-3/+102 2017-02-26Some repr and str improvements on the modelRené 'Necoro' Neumann1-3/+25 2017-02-26Move logging to extra functionRené 'Necoro' Neumann1-5/+7 2017-02-26Include sqllite closure extension in build processRené 'Necoro' Neumann4-2/+1001 2017-02-26More tag handlingRené 'Necoro' Neumann2-3/+82 2017-02-25More prefix workRené 'Necoro' Neumann3-9/+96 2017-02-25Use Peewee instead of SQLAlchemyRené 'Necoro' Neumann5-121/+96 2016-08-16FixRené 'Necoro' Neumann1-1/+1 2016-08-16Use current setuputils flowRené 'Necoro' Neumann2-0/+17 2016-08-16Basic CLIRené 'Necoro' Neumann3-0/+33 2016-08-15Initial model and sqlalchemy setupRené 'Necoro' Neumann3-0/+104