From 610db184b851c21f69db412ce6d1870e0b438789 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 19 Aug 2017 09:06:42 -0300 Subject: Give delay on xdotool at sclip --- lib/keyringer/actions/sclip | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/keyringer/actions/sclip b/lib/keyringer/actions/sclip index 156762a..de9c3b5 100755 --- a/lib/keyringer/actions/sclip +++ b/lib/keyringer/actions/sclip @@ -13,12 +13,14 @@ keyringer $KEYRING xclip $* # Se window switch combo if [ -z "$XDOTOOL_NEXT_WINDOW" ]; then - XDOTOOL_NEXT_WINDOW="alt+Tab" + XDOTOOL_NEXT_WINDOW="Alt_L+Tab" fi # Move to the next window if which xdotool &> /dev/null; then - xdotool key $XDOTOOL_NEXT_WINDOW + # Use a smaller delay otherwise the window + # manager might ignore the key combo + xdotool key --delay 2 $XDOTOOL_NEXT_WINDOW fi # Sleep -- cgit v1.2.3 From 7f134279b78d6fa66e6ca271f95ba3633163edf8 Mon Sep 17 00:00:00 2001 From: rysiek Date: Fri, 3 Nov 2017 10:26:44 -0200 Subject: functions: handling vi better (no spurious error output --- lib/keyringer/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/keyringer/functions b/lib/keyringer/functions index 0d96288..e3f89d9 100755 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -293,7 +293,7 @@ function keyringer_set_env { fi # Avoid viminfo, see https://keyringer.pw/trac/ticket/50 - if $EDITOR --help | grep -q -e "^VIM"; then + if $EDITOR --help 2>&1 | grep -q -e "^VIM"; then if ! echo $EDITOR | grep -q -- "-i NONE"; then EDITOR="$EDITOR -S $SHARE/editors/vim" fi -- cgit v1.2.3 From 171a0799e7d57bc121b0efe766a2e215c7afccba Mon Sep 17 00:00:00 2001 From: rysiek Date: Fri, 3 Nov 2017 10:29:40 -0200 Subject: pwgen action now uses encrypt-batch, informs user of success --- lib/keyringer/actions/pwgen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/keyringer/actions/pwgen b/lib/keyringer/actions/pwgen index 1ca3829..3c03681 100755 --- a/lib/keyringer/actions/pwgen +++ b/lib/keyringer/actions/pwgen @@ -32,4 +32,4 @@ elif [ ! -z "$SIZE" ] && ! echo $SIZE | egrep -q '^[0-9]+$'; then fi # Encrypt and store a randomly-generated secret -keyringer_pwgen $SIZE | keyringer_exec encrypt "$BASEDIR" "$FILE" +keyringer_pwgen $SIZE | keyringer_exec encrypt-batch "$BASEDIR" "$FILE" && echo "Secret generated and stored." -- cgit v1.2.3 From 4a0d2bdc2ba611dd177454b73ebb480e15be300d Mon Sep 17 00:00:00 2001 From: rysiek Date: Fri, 3 Nov 2017 10:36:14 -0200 Subject: recrypt's use of find fixed on FreeBSD --- lib/keyringer/actions/recrypt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/keyringer/actions/recrypt b/lib/keyringer/actions/recrypt index d88a749..0e2f6a0 100755 --- a/lib/keyringer/actions/recrypt +++ b/lib/keyringer/actions/recrypt @@ -9,6 +9,7 @@ source "$LIB" readwrite $* || exit 1 # Recrypt a single secret function keyringer_recrypt { + # Get file keyringer_get_file "$1" @@ -39,7 +40,7 @@ function keyringer_recrypt { if [ ! -z "$2" ]; then keyringer_recrypt $2 else - cd $KEYDIR && find | while read file; do + cd $KEYDIR && find ./ | while read file; do if [ ! -d "$KEYDIR/$file" ]; then keyringer_recrypt "$file" fi -- cgit v1.2.3 From 497a6302db1000b6b00ef708043c3f86feb14b11 Mon Sep 17 00:00:00 2001 From: rysiek Date: Fri, 3 Nov 2017 10:36:42 -0200 Subject: keyringer_tree fixed on FreeBSD; also, prettier everywhere else --- lib/keyringer/actions/tree | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/keyringer/actions/tree b/lib/keyringer/actions/tree index 7bf173d..a877548 100755 --- a/lib/keyringer/actions/tree +++ b/lib/keyringer/actions/tree @@ -5,7 +5,7 @@ # Thanks http://www.centerkey.com/tree/ function keyringer_tree { - ls -R $* | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' + find $* | sed -e 's/[^-][^\/]*\//| /g' | sed -r -e 's/\| ([^|])/|- \1/' } # Load functions @@ -19,6 +19,11 @@ CWD="`pwd`" shift ARGS="`echo "$*" | sed -e "s|^/*||"`" +# on *BSD, find expects at least one argument with the path +if [ "$ARGS" == "" ]; then + ARGS="./" +fi + # Check implementation if which tree &> /dev/null; then TREE="tree" -- cgit v1.2.3 From 1895a47f2bdf4064787b57b5a68d6b3656a620d0 Mon Sep 17 00:00:00 2001 From: rysiek Date: Fri, 3 Nov 2017 10:37:41 -0200 Subject: another find usage fixed on *BSD --- lib/keyringer/actions/find | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/keyringer/actions/find b/lib/keyringer/actions/find index 043e80d..45b4f11 100755 --- a/lib/keyringer/actions/find +++ b/lib/keyringer/actions/find @@ -15,5 +15,5 @@ shift ARGS="`echo "$*" | sed -e "s|^/*||"`" # Run find command -cd "$KEYDIR/$RELATIVE_PATH" && find | grep -i "$ARGS" | sed -e 's|^./||g' +cd "$KEYDIR/$RELATIVE_PATH" && find ./ | grep -i "$ARGS" | sed -e 's|^./||g' cd "$CWD" -- cgit v1.2.3 From 9363e1fa91b23297f13d51139203baf5a0090fc0 Mon Sep 17 00:00:00 2001 From: rysiek Date: Fri, 3 Nov 2017 10:38:46 -0200 Subject: \t is a GNU extension in sed regexes; fixed / use --color only when ls supports it --- lib/keyringer/actions/recipients | 4 +++- lib/keyringer/functions | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/keyringer/actions/recipients b/lib/keyringer/actions/recipients index 3c18516..889f73e 100755 --- a/lib/keyringer/actions/recipients +++ b/lib/keyringer/actions/recipients @@ -38,7 +38,9 @@ elif [ "$COMMAND" == "edit" ]; then keyringer_exec git "$BASEDIR" add "$RECIPIENTS_FILE_BASE" else echo "Please specify one recipient to edit among the available:" - ls $RECIPIENTS | sed -e 's/^/\t/' + # \t is a GNU extension + # https://stackoverflow.com/questions/8400602/sed-replace-literal-tab + ls $RECIPIENTS | sed -e "`printf 's/^/\t/'`" exit 1 fi else diff --git a/lib/keyringer/functions b/lib/keyringer/functions index e3f89d9..b1e2e08 100755 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -537,7 +537,12 @@ function keyringer_show_actions { # Usage function keyringer_usage { - local keyrings="$(ls --color=never `dirname $CONFIG` | sed -e 's/config//' | xargs)" + # are we're using an `ls` that supports `--color`? + if ls --version 2>/dev/null; then + local keyrings="$(ls --color=never `dirname $CONFIG` | sed -e 's/config//' | xargs)" + else + local keyrings="$(ls `dirname $CONFIG` | sed -e 's/config//' | xargs)" + fi printf "Keyringer $KEYRINGER_VERSION\n" printf "Usage: keyringer [arguments]\n\n" @@ -552,7 +557,9 @@ function keyringer_usage { if [ ! -z "$keyrings" ] && [ -z "$1" ]; then printf "\tinit [remote]\n" $BASENAME fi - keyringer_show_actions | sed -e 's/^/\t/' + # \t is a GNU extension + # https://stackoverflow.com/questions/8400602/sed-replace-literal-tab + keyringer_show_actions | sed -e "`printf 's/^/\t/'`" printf "\n" } -- cgit v1.2.3 From 89dd8486d3c525dfaf5239938fc4358915e3c2e6 Mon Sep 17 00:00:00 2001 From: rysiek Date: Fri, 3 Nov 2017 10:39:55 -0200 Subject: teardown: more unambiguous info on confirmation; added information when teardown cancelled --- lib/keyringer/actions/teardown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/keyringer/actions/teardown b/lib/keyringer/actions/teardown index 2e8725b..55de3d6 100755 --- a/lib/keyringer/actions/teardown +++ b/lib/keyringer/actions/teardown @@ -16,8 +16,9 @@ if [ -z "$CONFIRM" ] || [ "$CONFIRM" != "-y" ]; then echo "WARNING: This will irrevocably destroy $KEYDIR" echo "WARNING: the action cannot be undone!" - read -rep "Are you sure to WIPE keyring $KEYRING (type YES to confirm)? " key + read -rep "Are you sure to WIPE keyring $KEYRING (type uppercase YES to confirm)? " key if [ "$key" != "YES" ]; then + echo "CANCELLED!" exit 1 fi fi -- cgit v1.2.3 From f534b40b7eb598cffcc9378c4520d5210552e0d5 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 3 Nov 2017 10:42:01 -0200 Subject: Removes incorrect exit command (#79) --- lib/keyringer/actions/append | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/keyringer/actions/append b/lib/keyringer/actions/append index 905867a..ccb25fb 100755 --- a/lib/keyringer/actions/append +++ b/lib/keyringer/actions/append @@ -6,7 +6,6 @@ # Load functions LIB="`dirname $0`/../functions" source "$LIB" readwrite $* || exit 1 -exit # Get file keyringer_get_file "$2" -- cgit v1.2.3 From dbc0b92c6e32a0b9ca41e57aa58f76e61c71a9cd Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 3 Nov 2017 10:44:03 -0200 Subject: Fix failure to properly decrypt the file in actions/decrypt (#80) --- lib/keyringer/actions/decrypt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/keyringer/actions/decrypt b/lib/keyringer/actions/decrypt index e17f0e0..7442b29 100755 --- a/lib/keyringer/actions/decrypt +++ b/lib/keyringer/actions/decrypt @@ -11,7 +11,7 @@ source "$LIB" read $* || exit 1 keyringer_get_file "$2" # Decrypt -$GPG --use-agent -d "$KEYDIR/$FILE" +cat "$KEYDIR/$FILE" | $GPG --use-agent -d - # Exit exit "$?" -- cgit v1.2.3 From 20d8b1f626207d9731586ff11975a142befb399c Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 3 Nov 2017 10:53:11 -0200 Subject: Redirect both outputs when checking 'ls' version --- lib/keyringer/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/keyringer/functions b/lib/keyringer/functions index b1e2e08..6f9a5e3 100755 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -538,7 +538,7 @@ function keyringer_show_actions { # Usage function keyringer_usage { # are we're using an `ls` that supports `--color`? - if ls --version 2>/dev/null; then + if ls --version > /dev/null 2>&1; then local keyrings="$(ls --color=never `dirname $CONFIG` | sed -e 's/config//' | xargs)" else local keyrings="$(ls `dirname $CONFIG` | sed -e 's/config//' | xargs)" -- cgit v1.2.3