diff options
author | Luke Smith <luke@lukesmith.xyz> | 2018-03-13 08:18:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-13 08:18:43 -0700 |
commit | 56cb13e822eefafa9e140e11776d8d994cba42c6 (patch) | |
tree | bd7ec7749ee4b92459afb826e651618edd013dd1 /mutt-wizard.sh | |
parent | a4e016a8f33c76c963df256d47d8b78cb1a80d74 (diff) | |
parent | 4537d35666b9c23f82e9c5f2c0e838c09959906a (diff) |
Merge pull request #35 from meain/macos
MacOS compatibility
Diffstat (limited to 'mutt-wizard.sh')
-rwxr-xr-x | mutt-wizard.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mutt-wizard.sh b/mutt-wizard.sh index 18ee806..7256f16 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/" chooseSync() { (crontab -l && testSync) || dialog --msgbox "No cronjob manager detected. Please install one and return to enable automatic mailsyncing" 10 60 ;} @@ -173,8 +180,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. @@ -183,7 +190,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 || \ |