summaryrefslogtreecommitdiff
path: root/mutt-wizard.sh
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-03-16 12:14:51 -0700
committerLuke Smith <luke@lukesmith.xyz>2018-03-16 12:14:51 -0700
commit17b880131630de5686e126d528b80832843b7edc (patch)
treeeaf5fa48068e61c9892713e5ff30922de493b8b4 /mutt-wizard.sh
parent4abc05bfb55b012e5d4082423b0565b59f85a05c (diff)
parente9d16d64562c97914e91e4870a848874cfc28cb6 (diff)
Merge branch 'master' of github.com:LukeSmithxyz/mutt-wizard
Diffstat (limited to 'mutt-wizard.sh')
-rwxr-xr-xmutt-wizard.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/mutt-wizard.sh b/mutt-wizard.sh
index 8bad868..7d8325a 100755
--- a/mutt-wizard.sh
+++ b/mutt-wizard.sh
@@ -1,5 +1,12 @@
#!/bin/bash
+if [[ "$(uname)" == "Darwin" ]]
+then
+ os=".macos"
+else
+ os=""
+fi
+
muttdir="$HOME/.config/mutt/"
createMailboxes() { rm -f "$muttdir"autoconf/log
@@ -179,8 +186,8 @@ addAccount() {
mkdir -p "$muttdir"accounts/$title/cache/bodies
# Creating the offlineimaprc if it doesn't exist already.
- if [ ! -f ~/.offlineimaprc ]; then cp "$muttdir"autoconf/offlineimap_header ~/.offlineimaprc; fi
- cat "$muttdir"autoconf/offlineimap_profile | sed -e "$replacement" >> ~/.offlineimaprc
+ if [ ! -f ~/.offlineimaprc ]; then cp "$muttdir"autoconf/offlineimap_header"$os" ~/.offlineimaprc; fi
+ cat "$muttdir"autoconf/offlineimap_profile"$os" | sed -e "$replacement" >> ~/.offlineimaprc
mkdir -p ~/.mail/$title
# Add the mutt profile.
@@ -189,7 +196,7 @@ addAccount() {
echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source "$muttdir"accounts/$title.muttrc<enter><change-folder>!<enter>'" >> "$muttdir"personal.muttrc
# Add to offlineimaprc sync list.
- sed -i "s/^accounts =.*[a-zA-Z]$/&, $title/g;s/^accounts =\s*$/accounts = $title/g" ~/.offlineimaprc
+ sed -i.bu "s/^accounts =.*[a-zA-Z]$/&, $title/g;s/^accounts =\s*$/accounts = $title/g" ~/.offlineimaprc && rm ~/.offlineimaprc.bu
# Makes account default if there is no default account.
grep "$muttdir"personal.muttrc -e "^source .*accounts.*" >/dev/null && echo there || \