mail_to_listadmins.sh: some minor fixes.

This commit is contained in:
Christoph 2018-05-30 01:13:25 +02:00
parent 58189563e6
commit f09424768b

View File

@ -642,20 +642,6 @@ echo_log "----------"
echo_log "Main part of script: inform list admins" echo_log "Main part of script: inform list admins"
echo_log "----------" echo_log "----------"
# - Export key of $sender_address into temporary directory ($LOCK_DIR)
# -
#echononl " Export public key '${sender_address}'.."
#gpg -a --export $sender_address > ${LOCK_DIR}/${sender_address}.asc 2> "$err_msg"
#if [[ $? -ne 0 ]]; then
# echo_log_failed "Export public key '${sender_address}'"
# echo_log "$(cat "$err_msg")"
# echo_failed
# error "$(cat "$err_msg")"
#else
# echo_done
# echo_log_done "Export public key '${sender_address}'"
#fi
for _val in "${schleuder_lists_arr[@]}" ; do for _val in "${schleuder_lists_arr[@]}" ; do
_missing_key=false _missing_key=false
@ -689,12 +675,15 @@ for _val in "${schleuder_lists_arr[@]}" ; do
continue continue
fi fi
_list_dir="${schleuder_lists_dir}/${_domain}/${_list}"
echononl " Add List Key to keyring of 'root'" echononl " Add List Key to keyring of 'root'"
if ! gpg -k "${_list}@$_domain" > /dev/null 2>&1 ; then if ! gpg -k "${_list}@$_domain" > /dev/null 2>&1 ; then
gpg --batch --yes --home "$_list_dir" -a --export ${_list}@$_domain | gpg --import gpg --batch --yes --home "$_list_dir" -a --export ${_list}@$_domain 2> /dev/null | gpg --import > "$err_msg" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_log_failed "Add List Key to keyring of 'root'" echo_log_failed "Add List Key to keyring of 'root'"
echo_log "$(cat "$err_msg")"
echo_failed echo_failed
error "$(cat "$err_msg")"
lists_failed+=("${_list}@$_domain") lists_failed+=("${_list}@$_domain")
continue continue
else else
@ -708,10 +697,8 @@ for _val in "${schleuder_lists_arr[@]}" ; do
# - Check if gpg key of $sender_address is part of the keyring. Add key if missing # - Check if gpg key of $sender_address is part of the keyring. Add key if missing
# - # -
_list_dir="${schleuder_lists_dir}/${_domain}/${_list}"
echononl " Adding key '$sender_address' to keyring.." echononl " Adding key '$sender_address' to keyring.."
if ! gpg --home "$_list_dir" -k "$sender_address" > /dev/null 2>&1 ; then if ! gpg --home "$_list_dir" -k "$sender_address" > /dev/null 2>&1 ; then
#gpg --batch --yes --home "$_list_dir" --import /home/ckubu/support.so36.net.asc > "$err_msg" 2>&1
gpg --batch --yes -a --export "$sender_address" | gpg --home "$_list_dir" --import > "$err_msg" 2>&1 gpg --batch --yes -a --export "$sender_address" | gpg --home "$_list_dir" --import > "$err_msg" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_log_failed "Adding key '$sender_address' to keyring" echo_log_failed "Adding key '$sender_address' to keyring"
@ -772,7 +759,7 @@ for _val in "${schleuder_lists_arr[@]}" ; do
cat <<EOF > "${LOCK_DIR}/e-mail-${_list}-${_domain}.txt" cat <<EOF > "${LOCK_DIR}/e-mail-${_list}-${_domain}.txt"
Content-Type: multipart/mixed; boundary="$boundery_1"; Content-Type: multipart/mixed; boundary="$boundery_1";
protected-headers="v1" protected-headers="v1"
From: so36.NET <support@so36.net> From: "so36.NET" <support@so36.net>
To: ${_list}-owner@$_domain To: ${_list}-owner@$_domain
Date: $(date +"%a, %d %b %Y %H:%M:%S %z") Date: $(date +"%a, %d %b %Y %H:%M:%S %z")
Message-ID: <$message_id> Message-ID: <$message_id>
@ -798,10 +785,13 @@ EOF
EOF EOF
echononl " Send info e-mail to list owner .." echononl " Send info e-mail to list owner .."
cat "${LOCK_DIR}/e-mail-${_list}-${_domain}.txt" | su schleuder -c"/usr/local/bin/schleuder work ${_list}-owner@$_domain" -s /bin/bash cat "${LOCK_DIR}/e-mail-${_list}-${_domain}.txt" | su schleuder -c"/usr/bin/schleuder work ${_list}-owner@$_domain" -s /bin/bash > "$err_msg" 2>&1
#cat "${LOCK_DIR}/e-mail-${_list}-${_domain}.txt" | /usr/sbin/sendmail -F "so35.NET" -f support@so36.net ${_list}-owner@$_domain > "$err_msg" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_log_failed "Send info e-mail to list owner" echo_log_failed "Send info e-mail to list owner"
echo_log "$(cat "$err_msg")"
echo_failed echo_failed
error "$(cat "$err_msg")"
lists_failed+=("${_list}@$_domain") lists_failed+=("${_list}@$_domain")
else else
echo_log_done "Send info e-mail to list owner" echo_log_done "Send info e-mail to list owner"