summaryrefslogtreecommitdiff
path: root/bin/mw
diff options
context:
space:
mode:
authorStanko K.R <me@stanko.io>2019-05-04 22:47:01 +0200
committerStanko K.R <me@stanko.io>2019-05-04 22:47:01 +0200
commit2b2f17f3109923ab5179e613f3cd74254b9d0e80 (patch)
treeacc41c610827c277fdbd72a017846fda7a19ba43 /bin/mw
parentc991d448786d9f3fbea142d55473608797e95cdd (diff)
Prefix binary path correctly on MacOS
Diffstat (limited to 'bin/mw')
-rwxr-xr-xbin/mw10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/mw b/bin/mw
index 7e09e9a..0010a67 100755
--- a/bin/mw
+++ b/bin/mw
@@ -2,12 +2,18 @@
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 <yourgpgemail>\`.\\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
+ prefix="/usr/local"
+else
+ prefix="/usr"
+fi
muttdir="$HOME/.config/mutt" # Main mutt config location
accdir="$muttdir/accounts" # Directory for account settings
maildir="$HOME/.local/share/mail" # Location of mail storage
namere="^[a-z_][a-z0-9_-]*$" # Regex to ensure viable username
emailre=".\+@.\+\\..\+" # Regex to confirm valid email address
-muttshare="/usr/share/mutt-wizard"
+muttshare="$prefix/share/mutt-wizard"
mbsyncrc="$HOME/.mbsyncrc"
mwconfig="$muttshare/mutt-wizard.muttrc"
cachedir="$HOME/.cache/mutt-wizard"
@@ -89,7 +95,7 @@ mutt_profile="# vim: filetype=neomuttrc
# muttrc file for account $title
set realname = \"$realname\"
set from = \"$fulladdr\"
-set sendmail = \"/usr/bin/msmtp -a $title\"
+set sendmail = \"$prefix/bin/msmtp -a $title\"
alias me $realname <$fulladdr>
set folder = \"imaps://$fulladdr@$imap:$iport\"
set imap_user = \"$login\"