aboutsummaryrefslogtreecommitdiffstats
path: root/learn-spam
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-05-16 01:53:51 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2015-05-16 01:53:51 +0200
commitaa08f42e93b4d06fdbbb3127e1add385dc317a3b (patch)
treee818228a3d014ae16b66072b76d19497472f395a /learn-spam
parent00762ea36cb55b633cdc732d472a466e320d73e6 (diff)
downloadbin-aa08f42e93b4d06fdbbb3127e1add385dc317a3b.tar.xz
learn-*: Use MAILDIR and fall back to ~/mail
Diffstat (limited to 'learn-spam')
-rwxr-xr-xlearn-spam9
1 files changed, 7 insertions, 2 deletions
diff --git a/learn-spam b/learn-spam
index 6afbb55..1d19055 100755
--- a/learn-spam
+++ b/learn-spam
@@ -1,6 +1,11 @@
#!/usr/bin/env bash
-sb_mboxtrain.py -d "$MAIL"/spambayes.db -s "$MAIL"/learn-spam -r
-rsync "$MAIL"/spambayes.db \
+if ! [[ -n "$MAILDIR" ]]; then
+ printf '%s\n' 'warning: $MAILDIR not set, falling back to $HOME/mail'
+ MAILDIR="$HOME"/mail
+fi
+
+sb_mboxtrain.py -d "$MAILDIR"/spambayes.db -s "$MAILDIR"/learn-spam -r
+rsync "$MAILDIR"/spambayes.db \
kyrias@theos.kyriasis.com:Mail/spambayes.db \
--update --checksum --human-readable --progress