chiark / gitweb /
debianutils: Update from 4.8.3 to 4.8.4
[termux-packages] / packages / pass / src-password-store.sh.patch
1 diff --git a/src/password-store.sh b/src/password-store.sh
2 index 1ab6fb5..912b8b1 100755
3 --- a/src/password-store.sh
4 +++ b/src/password-store.sh
5 @@ -11,7 +11,7 @@ GPG="gpg"
6  export GPG_TTY="${GPG_TTY:-$(tty 2>/dev/null)}"
7  which gpg2 &>/dev/null && GPG="gpg2"
8  [[ -n $GPG_AGENT_INFO || $GPG == "gpg2" ]] && GPG_OPTS+=( "--batch" "--use-agent" )
9 -
10 +TMPDIR=$PREFIX/tmp
11  PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
12  EXTENSIONS="${PASSWORD_STORE_EXTENSIONS_DIR:-$PREFIX/.extensions}"
13  X_SELECTION="${PASSWORD_STORE_X_SELECTION:-clipboard}"
14 @@ -156,12 +156,13 @@ clip() {
15         # trailing new lines.
16         local sleep_argv0="password store sleep on display $DISPLAY"
17         pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
18 -       local before="$(xclip -o -selection "$X_SELECTION" 2>/dev/null | base64)"
19 -       echo -n "$1" | xclip -selection "$X_SELECTION" || die "Error: Could not copy data to the clipboard"
20 +       local before="$(termux-clipboard-get 2>/dev/null | base64)"
21 +       echo -n "$1" | termux-clipboard-set || die "Error: Could not copy data to the clipboard"
22         (
23                 ( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" )
24 -               local now="$(xclip -o -selection "$X_SELECTION" | base64)"
25 -               [[ $now != $(echo -n "$1" | base64) ]] && before="$now"
26 +               local now="$(termux-clipboard-get | base64)"
27 +        #removing -n here, because termux-clipboard-get always returns a newline while xclip does not
28 +               [[ $now != $(echo "$1" | base64) ]] && before="$now"
29  
30                 # It might be nice to programatically check to see if klipper exists,
31                 # as well as checking for other common clipboard managers. But for now,
32 @@ -172,7 +173,7 @@ clip() {
33                 # so we axe it here:
34                 qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null
35  
36 -               echo "$before" | base64 -d | xclip -selection "$X_SELECTION"
37 +               echo "$before" | base64 -d | termux-clipboard-set
38         ) 2>/dev/null & disown
39         echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
40  }