1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-26 16:57:07 +00:00
termux-packages/packages/pass/src-password-store.sh.patch

59 lines
2.0 KiB
Diff

diff -uNr password-store-1.7.4/src/password-store.sh password-store-1.7.4.mod/src/password-store.sh
--- password-store-1.7.4/src/password-store.sh 2021-06-11 19:49:06.000000000 +0300
+++ password-store-1.7.4.mod/src/password-store.sh 2022-12-29 12:52:53.004171610 +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,15 +227,19 @@
}
trap remove_tmpfile EXIT
else
- [[ $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.
-
- Are you sure you would like to continue?
- _EOF
- )"
- SECURE_TMPDIR="$(mktemp -d "${TMPDIR:-/tmp}/$template")"
+ if [ "$(uname -o)" != "Android" ] && [ -z "$TERMUX_VERSION" ]; then
+ if [[ $warn -eq 1 ]]; then
+ 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.
+
+ Are you sure you would like to continue?
+ _EOF
+ )"
+ fi
+ fi
+ SECURE_TMPDIR="$(mktemp -d "${TMPDIR:-@TERMUX_PREFIX@/tmp}/$template")"
shred_tmpfile() {
find "$SECURE_TMPDIR" -type f -exec $SHRED {} +
rm -rf "$SECURE_TMPDIR"