summaryrefslogtreecommitdiffstats
path: root/.mutt/maildir_watch_setup.sh
blob: 783f7f81651914f8c99122684f3955b60a7c3aa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

# see misc/crontab
# the script suppose ./folders file with one folder per-line,
# prefixed with '=' and ending with '\'
#
# TODO: comparison with https://gitorious.org/chrisirwin-utils/maildir-indicator

: ${BLACKLIST:="__DUMMY__"}

wget https://raw.github.com/erikw/dotfiles/personal/bin/maildir_watch.sh -O- \
  | sed \
    -e "s|\(maildir_path=\"\)[^\"]*\"|\1$(
      grep -E 'set folder\s+=' ../.muttrc | tr -d ' ' | cut -d= -f2 | sed 's|\~|$HOME|'
    )\"|" \
    -e "s|\(mailboxes=(\)[^)]*)|\1$(
      grep -E '=[A-Za-z0-9.-]+\s.*\\' folders | grep -Ev "${BLACKLIST}" \
        | sed 's|^=\([A-Za-z0-9.-]\+\)\s.*$|\1|' | paste -s
      ))|" > maildir_watch.sh
chmod +x maildir_watch.sh