Commit | Line | Data |
---|---|---|
afd500a7 FF |
1 | --- ../password-store-master/src/password-store.sh 2016-02-07 12:05:52.000000000 +0100 |
2 | +++ ./src/password-store.sh 2016-03-07 21:29:27.667761280 +0100 | |
3 | @@ -1,4 +1,4 @@ | |
4 | -#!/usr/bin/env bash | |
5 | +#!/data/data/com.termux/files/usr/bin/env bash | |
6 | ||
7 | # Copyright (C) 2012 - 2014 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. | |
8 | # This file is licensed under the GPLv2+. Please see COPYING for more information. | |
9 | @@ -12,7 +12,9 @@ | |
10 | which gpg2 &>/dev/null && GPG="gpg2" | |
11 | [[ -n $GPG_AGENT_INFO || $GPG == "gpg2" ]] && GPG_OPTS+=( "--batch" "--use-agent" ) | |
12 | ||
13 | +TERMUXPREFIX=$PREFIX | |
14 | PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}" | |
15 | + | |
16 | X_SELECTION="${PASSWORD_STORE_X_SELECTION:-clipboard}" | |
17 | CLIP_TIME="${PASSWORD_STORE_CLIP_TIME:-45}" | |
18 | GENERATED_LENGTH="${PASSWORD_STORE_GENERATED_LENGTH:-25}" | |
19 | @@ -133,13 +135,13 @@ | |
20 | # variable. Specifically, it cannot store nulls nor (non-trivally) store | |
21 | # trailing new lines. | |
22 | local sleep_argv0="password store sleep on display $DISPLAY" | |
23 | - pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5 | |
24 | - local before="$(xclip -o -selection "$X_SELECTION" 2>/dev/null | base64)" | |
25 | - echo -n "$1" | xclip -selection "$X_SELECTION" || die "Error: Could not copy data to the clipboard" | |
26 | + pgrep -f "^$sleep_argv0" | xargs kill 2>/dev/null && sleep 0.5 | |
27 | + local before="$(termux-clipboard-get 2>/dev/null | base64)" | |
28 | + echo -n "$1" | termux-clipboard-set || die "Error: Could not copy data to the clipboard" | |
29 | ( | |
30 | - ( exec -a "$sleep_argv0" sleep "$CLIP_TIME" ) | |
31 | - local now="$(xclip -o -selection "$X_SELECTION" | base64)" | |
32 | - [[ $now != $(echo -n "$1" | base64) ]] && before="$now" | |
33 | + ( exec -a "$sleep_argv0" coreutils --coreutils-prog=sleep "$CLIP_TIME" ) | |
34 | + local now="$(termux-clipboard-get | base64 )" | |
35 | + [[ $now != $(echo "$1" | base64) ]] && before="$now" | |
36 | ||
37 | # It might be nice to programatically check to see if klipper exists, | |
38 | # as well as checking for other common clipboard managers. But for now, | |
39 | @@ -150,7 +152,7 @@ | |
40 | # so we axe it here: | |
41 | qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null | |
42 | ||
43 | - echo "$before" | base64 -d | xclip -selection "$X_SELECTION" | |
44 | + echo "$before" | base64 -d| termux-clipboard-set | |
45 | ) 2>/dev/null & disown | |
46 | echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds." | |
47 | } | |
48 | @@ -174,7 +176,8 @@ | |
49 | Are you sure you would like to continue? | |
50 | _EOF | |
51 | )" | |
52 | - SECURE_TMPDIR="$(mktemp -d "${TMPDIR:-/tmp}/$template")" | |
53 | + echo "mktemp -d ${TMPDIR:-$TERMUXPREFIX/tmp}/$template" | |
54 | + SECURE_TMPDIR="$(mktemp -d "${TMPDIR:-$TERMUXPREFIX/tmp}/$template")" | |
55 | shred_tmpfile() { | |
56 | find "$SECURE_TMPDIR" -type f -exec $SHRED {} + | |
57 | rm -rf "$SECURE_TMPDIR" |