Mise à jour de 'src/bash/filter.sh'
This commit is contained in:
parent
4c61cf5c81
commit
3ac1bec5d9
@ -73,17 +73,17 @@ ARCHIVE_TITLE="archive_content"
|
||||
ARCHIVE_MIME="text/kaz_email_archive"
|
||||
SKIP_DEST_DOMAIN="/tmp/docker-mailserver/dest-domain-no-depol.txt"
|
||||
KEEP_FAILED=true
|
||||
DEBUG=
|
||||
DEBUG=true
|
||||
|
||||
#################### FONCTIONS ############################################
|
||||
BOLD='[1m'
|
||||
RED='[0;31m'
|
||||
GREEN='[0;32m'
|
||||
YELLOW='[0;33m'
|
||||
BLUE='[0;34m'
|
||||
MAGENTA='[0;35m'
|
||||
CYAN='[0;36m'
|
||||
NC='[0m' # No Color
|
||||
BOLD='[1m'
|
||||
RED='[0;31m'
|
||||
GREEN='[0;32m'
|
||||
YELLOW='[0;33m'
|
||||
BLUE='[0;34m'
|
||||
MAGENTA='[0;35m'
|
||||
CYAN='[0;36m'
|
||||
NC='[0m' # No Color
|
||||
NL='
|
||||
'
|
||||
|
||||
@ -142,16 +142,24 @@ get_domaine() {
|
||||
echo ${1/#*@/}
|
||||
}
|
||||
|
||||
#skip_domain () {
|
||||
# LEFT=":"
|
||||
# for ARG in $@; do
|
||||
#
|
||||
#LOG_FIC "${GREEN}####################in skip domaine#################### ${ARG}"
|
||||
#
|
||||
# [ "${ARG}" = "--" ] && LEFT="" && continue
|
||||
# DOM=$(get_domaine ${ARG})
|
||||
# [ -n "${DOM}" ] || continue
|
||||
# if [ -z "${LEFT}" ]; then
|
||||
# grep -q "^${DOM}$" "${SKIP_DEST_DOMAIN}" 2>/dev/null && echo "yes"
|
||||
# fi
|
||||
# done
|
||||
#}
|
||||
|
||||
skip_domain () {
|
||||
LEFT=":"
|
||||
for ARG in $@; do
|
||||
[ "${ARG}" = "--" ] && LEFT="" && continue
|
||||
DOM=$(get_domaine ${ARG})
|
||||
[ -n "${DOM}" ] || continue
|
||||
if [ -z "${LEFT}" ]; then
|
||||
grep -q "^${DOM}$" "${SKIP_DEST_DOMAIN}" 2>/dev/null && echo "yes"
|
||||
fi
|
||||
done
|
||||
DOM=$(get_domaine ${1})
|
||||
grep -q ${DOM} ${SKIP_DEST_DOMAIN} 2>/dev/null && echo "yes"
|
||||
}
|
||||
|
||||
#################### MAIN #################################################
|
||||
@ -162,6 +170,7 @@ if ! mkdir -p "${MAILS}"; then
|
||||
LOG_FIC "${RED}Can't mkdir ${MAILS} ${NC}"
|
||||
quitFilter "${EX_UNAVAILABLE}"
|
||||
fi
|
||||
MAIL_SOURCE_V0=$(echo $@)
|
||||
MAIL_SOURCE=$(echo $@ | awk 'BEGIN{FS=" "} {print $2}')
|
||||
DATE_TEMPS=$(date "+%Y-%m-%d-%H:%M:%S")
|
||||
REP_PIECE_JOINTE="${MAILS}/${DATE_TEMPS}_${MAIL_SOURCE}_$$"
|
||||
@ -174,11 +183,12 @@ PERIOD=$(curl "${JIRAFEAU_LOCAL}/a.php?p=${MAIL_SOURCE}" 2>/dev/null )
|
||||
[[ "${PERIOD}" =~ ^(minute|hour|day|week|month|quarter)$ ]] || PERIOD="${DEFAULT_PERIOD}"
|
||||
|
||||
LOG_FIC "${NL}" \
|
||||
" MAIL_SOURCE : ${YELLOW}${MAIL_SOURCE}${NC}${NL}" \
|
||||
" DATE_TEMPS : ${YELLOW}${DATE_TEMPS=}${NC}${NL}" \
|
||||
" MODE : ${YELLOW}${MODE}${NC}${NL}" \
|
||||
" TRACK : ${YELLOW}${TRACK}${NC}${NL}" \
|
||||
" PERIOD : ${YELLOW}${PERIOD}${NC}${NL}"
|
||||
" MAIL_SOURCE : ${YELLOW}${MAIL_SOURCE}${NC}${NL}" \
|
||||
" MAIL_SOURCE_V0 : ${YELLOW}${MAIL_SOURCE_V0}${NC}${NL}" \
|
||||
" DATE_TEMPS : ${YELLOW}${DATE_TEMPS=}${NC}${NL}" \
|
||||
" MODE : ${YELLOW}${MODE}${NC}${NL}" \
|
||||
" TRACK : ${YELLOW}${TRACK}${NC}${NL}" \
|
||||
" PERIOD : ${YELLOW}${PERIOD}${NC}${NL}"
|
||||
|
||||
if ! cd "${INSPECT_DIR}"; then
|
||||
echo "${INSPECT_DIR} does not exist"
|
||||
@ -217,7 +227,7 @@ if [ "${MODE}" = "none"]; then
|
||||
quitFilter 0
|
||||
fi
|
||||
|
||||
if [ "$(skip_domain $*)" = "yes"]; then
|
||||
if [ "$(skip_domain ${MAIL_SOURCE})" = "yes" ]; then
|
||||
LOG_FIC " - ${GREEN}send without change (skip domain)${NC}"
|
||||
${SENDMAIL} "$@" < "${INSPECT_DIR}/in.$$"
|
||||
quitFilter 0
|
||||
|
Loading…
Reference in New Issue
Block a user