[PATCH aiaiai 5/9] aiaiai-email-lda: move reap options to cfgfile
Jacob Keller
jacob.e.keller at intel.com
Wed Apr 9 15:26:09 PDT 2014
This patch moves the last few options of the LDA email program into the
configuration file, so that all email scripts don't require options for
configuration.
Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
---
doc/email/example-aiaiai.cfg | 8 ++++++++
email/aiaiai-email-lda | 20 +++-----------------
email/aiaiai-email-sh-functions | 6 ++++++
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/doc/email/example-aiaiai.cfg b/doc/email/example-aiaiai.cfg
index 1a2a48935fda..43d9a47bf310 100644
--- a/doc/email/example-aiaiai.cfg
+++ b/doc/email/example-aiaiai.cfg
@@ -44,6 +44,14 @@
# aiaiai will insert it for you.
built_preamble = I have tested your changes
+# These options control the LDA email program
+[lda]
+ # Reap all archived mail older than number of minutes specified.
+ reap_archive =
+
+ # Reap all incomplete series older than number of minutes specified.
+ reap_incomplete = 1440
+
[hooks]
# A hook called by aiaiai-email-test-patchset, which should output a
# zero exit status as well as the supported custom headers. If the hook
diff --git a/email/aiaiai-email-lda b/email/aiaiai-email-lda
index 8005e2e893d7..365d7cfc60d2 100755
--- a/email/aiaiai-email-lda
+++ b/email/aiaiai-email-lda
@@ -47,10 +47,6 @@ e-mail address, etc).
<config.ini> - the configuration file
Options:
- --reap-archive=MIN remove all files created earlier than MIN
- minutes ago from the mail archive directory;
- --reap-incomplete=MIN remove all incomplete patch series older than
- current time minus MIN minutes;
-v, --verbose be verbose;
-h, --help show this text and exit.
EOF
@@ -459,20 +455,10 @@ TEMP=`getopt -n $PROG -o v,h --long reap-archive:,reap-incomplete:,verbose,help
fail_usage ""
eval set -- "$TEMP"
-archive_min=
-incomplete_min=
verbose=
while true; do
case "$1" in
- --reap-archive)
- archive_min="$(opt_check_number "$1" "$2")"
- shift
- ;;
- --reap-incomplete)
- incomplete_min="$(opt_check_number "$1" "$2")"
- shift
- ;;
-v|--verbose) verbose=-v
;;
-h|--help)
@@ -563,8 +549,8 @@ process_mbox "$mbox"
process_all_series "$mbox"
-[ -z "$incomplete_min" ] || reap_old "$lda_tmp" "$incomplete_min"
-[ -z "$archive_min" ] || reap_old "$mail" "$archive_min"
-[ -z "$archive_min" ] || reap_old "$queue_saved" "$archive_min"
+[ -z "$cfg_lda_reap_incomplete" ] || reap_old "$lda_tmp" "$cfg_lda_reap_incomplete"
+[ -z "$cfg_lda_reap_archive" ] || reap_old "$mail" "$cfg_lda_reap_archive"
+[ -z "$cfg_lda_reap_archive" ] || reap_old "$queue_saved" "$cfg_lda_reap_archive"
rm $verbose -f -- "$lda_tmp_lock" >&2
diff --git a/email/aiaiai-email-sh-functions b/email/aiaiai-email-sh-functions
index eb3ebcd1e93c..cf1a1117b912 100644
--- a/email/aiaiai-email-sh-functions
+++ b/email/aiaiai-email-sh-functions
@@ -226,6 +226,12 @@ parse_config()
ini_config_get_or_die cfg_signature "$cfgfile" "global" "signature"
ini_config_get_or_die cfg_built_preamble "$cfgfile" "global" "built_preamble"
+ # Get Email LDA settings
+ cfg_lda_reap_archive="$(ini_config_get "$cfgfile" "lda" "reap_archive")"
+ cfg_lda_reap_archive="$(config_check_number "reap_archive" "$cfg_lda_reap_archive")"
+ cfg_lda_reap_incomplete="$(ini_config_get "$cfgfile" "lda" "reap_incomplete")"
+ cfg_lda_reap_incomplete="$(config_check_number "reap_incomplete" "$cfg_lda_reap_incomplete")"
+
# Get the location of email hook(s)
cfg_email_hook="$(ini_config_get "$cfgfile" "hooks" "email")"
cfg_email_hook="$(config_check_exec "email" "$cfg_email_hook")"
--
1.8.3.1
More information about the aiaiai
mailing list