aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlearn-ham9
-rwxr-xr-xlearn-spam9
2 files changed, 14 insertions, 4 deletions
diff --git a/learn-ham b/learn-ham
index 6532dd7..cbc035d 100755
--- a/learn-ham
+++ b/learn-ham
@@ -1,6 +1,11 @@
#!/usr/bin/env bash
-sb_mboxtrain.py -d "$MAIL"/spambayes.db -g "$MAIL"/learn-ham -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 -g "$MAILDIR"/learn-ham -r
+rsync "$MAILDIR"/spambayes.db \
kyrias@theos.kyriasis.com:Mail/spambayes.db \
--update --checksum --human-readable --progress
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