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