owner-check: make sending of mails optional

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-03-30 12:10:33 +02:00
parent 310b8e6c95
commit a004447ba3

View File

@ -1,7 +1,11 @@
#!/bin/bash #!/bin/bash
set -e set -e
[ -z "$server" -o -z "login" ] && { echo '$server and $login need to be set'; exit 1 } verb="$1"
[ "$verb" = "-s" ] && do_send=1 || do_send=
[ -n "$do_send" ] && [ -z "$server" -o -z "login" ] && { echo '$server and $login need to be set'; exit 1; }
header= header=
from=systemd-maint@fedoraproject.org from=systemd-maint@fedoraproject.org
@ -11,26 +15,39 @@ port=587
for user in "$@"; do for user in "$@"; do
echo "checking $user" echo "checking $user"
t=$(git shortlog --all --author $user --since "@{$time}" | wc -l)
p=$(git log -1 --all --author "$user")
if [ -z "$p" ]; then
echo "No commits from $user, check spelling"
exit 1
fi
t=$(git shortlog --all --author "$user" --since "@{$time}" | wc -l)
if [ $t != 0 ]; then if [ $t != 0 ]; then
echo "$t commits in the last two years, OK" echo "$t commits in the last two years, OK"
echo
continue continue
fi fi
echo "$p" | head -n6
echo ".. adding to list"
if [ -z "$header" ]; then if [ -z "$header" ]; then
echo '$USER$;$EMAIL$' >.mail.list echo '$USER$;$EMAIL$' >.mail.list
header=done header=done
fi fi
echo "$user;$user@fedoraproject.org" >>.mail.list echo "$user;$user@fedoraproject.org" >>.mail.list
echo
done done
[ -z "$header" ] && exit 0 [ -z "$header" ] && exit 0
[ -n "$do_send" ] || exit 0
echo "Sending mails…" echo "Sending mails…"
set -x set -x
massmail -F $from \ massmail -F "$from" \
-C $from \ -C "$from" \
-S 'write access to the fedora systemd package' \ -S 'write access to the fedora systemd package' \
-z $server -u $login -P $port \ -z "$server" -u "$login" -P "$port" \
.mail.list <owner-check.template .mail.list <owner-check.template