termux-packages/packages/pass/src-password-store.sh.patch

47 lines
1.6 KiB
Diff

--- password-store-1.7.4/src/password-store.sh 2021-06-11 18:49:06.000000000 +0200
+++ password-store-1.7.4.mod/src/password-store.sh 2021-07-26 10:10:09.076790995 +0200
@@ -155,7 +155,7 @@
#
clip() {
- if [[ -n $WAYLAND_DISPLAY ]]; then
+ if [[ -n $WAYLAND_DISPLAY ]] && hash wl-copy 2>/dev/null && hash wl-paste 2>/dev/null; then
local copy_cmd=( wl-copy )
local paste_cmd=( wl-paste -n )
if [[ $X_SELECTION == primary ]]; then
@@ -163,12 +163,14 @@
paste_cmd+=( --primary )
fi
local display_name="$WAYLAND_DISPLAY"
- elif [[ -n $DISPLAY ]]; then
+ elif [[ -n $DISPLAY ]] && hash xclip 2>/dev/null; then
local copy_cmd=( xclip -selection "$X_SELECTION" )
local paste_cmd=( xclip -o -selection "$X_SELECTION" )
local display_name="$DISPLAY"
else
- die "Error: No X11 or Wayland display detected"
+ local copy_cmd=( termux-clipboard-set )
+ local paste_cmd=( termux-clipboard-get )
+ local display_name="termux"
fi
local sleep_argv0="password store sleep on display $display_name"
@@ -225,7 +227,7 @@
}
trap remove_tmpfile EXIT
else
- [[ $warn -eq 1 ]] && yesno "$(cat <<-_EOF
+ [[ $(uname -o) == "Android" ]] || [[ $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.
@@ -233,7 +235,7 @@
Are you sure you would like to continue?
_EOF
)"
- SECURE_TMPDIR="$(mktemp -d "${TMPDIR:-/tmp}/$template")"
+ SECURE_TMPDIR="$(mktemp -d "${TMPDIR:-@TERMUX_PREFIX@/tmp}/$template")"
shred_tmpfile() {
find "$SECURE_TMPDIR" -type f -exec $SHRED {} +
rm -rf "$SECURE_TMPDIR"