summaryrefslogtreecommitdiff
path: root/bin/sync_mail.sh
blob: 2bf04c5ef81052081f02958c297f0ba9a8bb7448 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
MBSYNC=`which mbsync`
NOTMUCH=`which notmuch`

MUTT_DIR=/home/cem/.mutt
MAIL_DIR=/home/cem/Mail

sync_toxic() {
	local TOXIC_MAIL=$MAIL_DIR/toxiclabs
	local MBSYNC_CONFIG=$TOXIC_MAIL/mbsyncrc
	local NOTMUCH_TAGS=$TOXIC_MAIL/toxic_nmtag.conf
	local TOXIC_MUTTRC=$MUTT_DIR/muttrc-toxiclabs
	local TOXIC_NM_CONFIG=$TOXIC_MAIL/notmuch-config
	local TOXIC_NM_TAGS=$TOXIC_MAIL/toxic_nmtag.conf

	mbsync --config=$MBSYNC_CONFIG -a -q

	notmuch --config=$KORG_NM_CONFIG new
	notmuch --config=$KORG_NM_CONFIG tag --input=$KORG_NM_TAGS
}
sync_redhat() {
	local RH_MAIL=$MAIL_DIR/redhat
	local MBSYNC_CONFIG=$RH_MAIL/mbsyncrc
	local KORG_MUTTRC=$MUTT_DIR/muttrc-redhat

	mbsync --config=$MBSYNC_CONFIG -a -q
}

sync_korg() {
	local KORG_MAIL=$MAIL_DIR/Kernel
	local MBSYNC_CONFIG=$KORG_MAIL/mbsyncrc
	local NOTMUCH_TAGS=$KORG_MAIL/kernel_nmtag.conf
	local KORG_MUTTRC=$MUTT_DIR/muttrc-kernel
	local KORG_NM_CONFIG=$KORG_MAIL/notmuch-config
	local KORG_NM_TAGS=$KORG_MAIL/kernel_nmtag.conf

	mbsync --config=$MBSYNC_CONFIG -a -q

	notmuch --config=$KORG_NM_CONFIG new
	notmuch --config=$KORG_NM_CONFIG tag --input=$KORG_NM_TAGS
}

sync_redhat
sync_korg
sync_toxic