2024-07-15 16:15:47 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ "${NGX_MAIL}" = 1 ] ; then
|
2024-07-23 21:59:49 +03:00
|
|
|
unset mail_modules mail_confload
|
2024-07-15 16:15:47 +03:00
|
|
|
mail_modules=
|
2024-07-23 21:59:49 +03:00
|
|
|
mail_confload="${NGX_MAIL_CONFLOAD:-}"
|
2024-07-15 16:15:47 +03:00
|
|
|
|
|
|
|
## filter out builtin mail modules
|
|
|
|
unset i
|
|
|
|
for i in ${NGX_MAIL_MODULES:-} ; do
|
|
|
|
[ -n "$i" ] || continue
|
|
|
|
|
2024-07-24 22:47:53 +03:00
|
|
|
case "$i" in
|
|
|
|
*/* | *\** | *\?* )
|
|
|
|
log_always "module '$i' is not legal, skipping"
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2024-07-15 16:15:47 +03:00
|
|
|
if is_builtin_module mail "$i" ; then
|
2024-07-24 22:47:53 +03:00
|
|
|
log "$i is builtin module, moving to NGX_MAIL_CONFLOAD"
|
2024-07-26 01:18:59 +03:00
|
|
|
mail_confload=$(append_list "${mail_confload}" "$i")
|
2024-07-15 16:15:47 +03:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
## naive deduplication
|
2024-07-26 01:18:59 +03:00
|
|
|
if list_have_item "${mail_modules}" "$i" ; then
|
2024-07-15 16:15:47 +03:00
|
|
|
log "$i is already specified"
|
|
|
|
continue
|
2024-07-26 01:18:59 +03:00
|
|
|
fi
|
2024-07-15 16:15:47 +03:00
|
|
|
|
2024-07-26 01:18:59 +03:00
|
|
|
mail_modules=$(append_list "${mail_modules}" "$i")
|
2024-07-15 16:15:47 +03:00
|
|
|
done
|
|
|
|
unset i
|
|
|
|
|
|
|
|
set -a
|
|
|
|
NGX_MAIL_MODULES="${mail_modules}"
|
2024-07-23 21:59:49 +03:00
|
|
|
NGX_MAIL_CONFLOAD=$(sort_dedup_list "${mail_confload}")
|
2024-07-15 16:15:47 +03:00
|
|
|
set +a
|
|
|
|
|
2024-07-23 21:59:49 +03:00
|
|
|
unset mail_modules mail_confload
|
2024-07-15 16:15:47 +03:00
|
|
|
fi
|