diff options
-rwxr-xr-x | credentials/getmuttpass | 2 | ||||
-rwxr-xr-x | mutt-wizard.sh | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/credentials/getmuttpass b/credentials/getmuttpass index 926a342..ee25584 100755 --- a/credentials/getmuttpass +++ b/credentials/getmuttpass @@ -1,5 +1,5 @@ #!/bin/bash pass=$(gpg2 --decrypt --quiet ~/.config/mutt/credentials/$1.gpg) -pass=$(printf "%q" $pass) +pass=$(printf '%q' $pass) echo set smtp_pass=\"$pass\" echo set imap_pass=\"$pass\" diff --git a/mutt-wizard.sh b/mutt-wizard.sh index ed487c9..7be5ce0 100755 --- a/mutt-wizard.sh +++ b/mutt-wizard.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [[ "$(uname)" == "Darwin" ]] then @@ -9,13 +9,14 @@ fi muttdir="$HOME/.config/mutt/" -createMailboxes() { rm -f /tmp/log /tmp/lognew - offlineimap --info -a $1 2&> /tmp/log - sed -n '/^Folderlist/,/^Folderlist/p' /tmp/log | - grep "^ " | sed -e "s/\//./g;s/(.*//g;s/^ //g" > /tmp/lognew - while read box; do mkdir -p "$HOME/.mail/$1/$box"; done </tmp/lognew ;} +createMailboxes() { \ + tmpdir=$(mktemp -d) + offlineimap --info -a $1 2&> "$tmpdir"/log + sed -n '/^Folderlist/,/^Folderlist/p' "$tmpdir"/log | + grep "^ " | sed -e "s/\//./g;s/(.*//g;s/^ //g" > "$tmpdir"/lognew + while read box; do mkdir -p "$HOME/.mail/$1/$box"; done <"$tmpdir"/lognew ;} -chooseSync() { (crontab -l && testSync) || dialog --msgbox "No cronjob manager detected. Please install one and return to enable automatic mailsyncing" 10 60 ;} +chooseSync() { (cat /var/run/crond.pid && testSync) || dialog --msgbox "No cronjob manager detected. Please install one and return to enable automatic mailsyncing" 10 60 ;} testSync() { (crontab -l | grep .config/mutt/etc/mailsync && removeSync) || addSync ;} addSync() { min=$(dialog --inputbox "How many minutes should be between mail syncs?" 8 60 3>&1 1>&2 2>&3 3>&-) @@ -256,5 +257,6 @@ $(grep ~/.offlineimaprc -e "^accounts =" | sed 's/accounts =//g') 5) inventory && for i in $userchoices; do removeAccount $i ; done;; 6) (dialog --defaultno --title "Wipe all custom neomutt/offlineIMAP settings?" --yesno "Would you like to wipe all of the mutt/offlineIMAP settings generated by the system?" 6 60 && wipe) ;; 7) clear && break ;; +*) echo "Unable to read response from dialog. Exiting." >&2; exit 2 esac done |