From 49d2e12125f7881e43ebc57895c8eb8a13a8706c Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Wed, 15 May 2019 20:19:55 +0200 Subject: check if .gpg-id is in the pass store on startup The current test did not terminate the script in cases when the user already has a private GPG key, but they'd not initialized the password store. This leads to an infinite loop in the `getpass()` function. The commit fixes https://github.com/LukeSmithxyz/mutt-wizard/issues/204 --- bin/mw | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 636a837..a415f0e 100755 --- a/bin/mw +++ b/bin/mw @@ -1,6 +1,10 @@ #!/bin/sh command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" -! "$GPG" --list-secret-keys $(cat "$HOME/.password-store/.gpg-id") >/dev/null 2>&1 && printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init \`.\\nIf you don't have a GPG public private key pair, run \`$GPG --full-gen-key\` first.\\n" && exit +[ -r "$HOME/.password-store/.gpg-id" ] && + "$GPG" --list-secret-keys $(cat "$HOME/.password-store/.gpg-id") >/dev/null 2>&1 || { + printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init \`.\\nIf you don't have a GPG public private key pair, run \`$GPG --full-gen-key\` first.\\n" + exit + } ! command -v mbsync >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit if [[ "$OSTYPE" == "darwin"* ]]; then -- cgit v1.2.3 From 46c796ef641ae286894dfd22cef62c62a425a204 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 16 May 2019 13:59:09 -0400 Subject: fatal breakage fixed --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index a415f0e..7eefed9 100755 --- a/bin/mw +++ b/bin/mw @@ -7,7 +7,7 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" } ! command -v mbsync >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit -if [[ "$OSTYPE" == "darwin"* ]]; then +if [ "$OSTYPE" = "darwin" ]; then prefix="/usr/local" else prefix="/usr" -- cgit v1.2.3 From a6c81625c8ed887b7ddbfed005d2a2ffdf27a503 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 20 May 2019 13:09:11 -0400 Subject: posix and mac fix --- bin/mw | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 7eefed9..1cae8fc 100755 --- a/bin/mw +++ b/bin/mw @@ -7,11 +7,11 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" } ! command -v mbsync >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit -if [ "$OSTYPE" = "darwin" ]; then - prefix="/usr/local" -else - prefix="/usr" -fi +case "$(uname)" in + Linux) prefix="/usr" ;; + *) prefix="/usr/local" ;; +esac + muttdir="$HOME/.config/mutt" # Main mutt config location accdir="$muttdir/accounts" # Directory for account settings maildir="$HOME/.local/share/mail" # Location of mail storage -- cgit v1.2.3 From e4794af679e0d79b222930d034e98ca7116c8ccd Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 20 May 2019 13:44:51 -0400 Subject: escape spaces in mailboxes --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 1cae8fc..b693299 100755 --- a/bin/mw +++ b/bin/mw @@ -216,7 +216,7 @@ tryconnect() { mkdir -p "$maildir/$title" fi ;} finalize() { \ - boxes="$(find "$maildir/$title/" -mindepth 1 -maxdepth 1 | sed "s/^.*\//=/")" + boxes="$(find "$maildir/$title/" -mindepth 1 -maxdepth 1 | sed "s/\ /\\\ /g;s/^.*\//=/")" [ -z "$boxes" ] && printf "\033[31mNo local mailboxes have been detected for %s.\033[0m\\nThis means that mbsync has not been successfully run.\\nRun mbsync, and if it has an error, be sure to check your password and server settings manually if needbe.\\n" "$title" && return printf "Setting default mailboxes for your Inbox, Sent, Drafts and Trash in mutt...\\n" spoolfile=$(echo "$boxes" | grep -i -m 1 inbox | sed 's/=/+/g') -- cgit v1.2.3 From e4813ae21568132e2dd04f0d69e87c4dfd98c3c6 Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Tue, 28 May 2019 01:09:25 +0200 Subject: restore default text color on 'Ctrl-C' exit The terminal text color wasn't reset when the user aborted the wizard while being prompted for input. This resolves https://github.com/LukeSmithxyz/mutt-wizard/issues/224 --- bin/mw | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index b693299..f8c4f24 100755 --- a/bin/mw +++ b/bin/mw @@ -313,6 +313,8 @@ synchronize_flags=true gpg_path=$GPG" echo "$nmbasic" > "$NOTMUCH_CONFIG" ;} +trap 'echo -e "\033[0m\n"' INT + case "$1" in ls) list ;; add) asktype && askinfo && tryconnect && finalize || delete ;; -- cgit v1.2.3