Gentoo Archives: gentoo-commits

From: "Jorge Manuel B. S. Vicetto" <jmbsvicetto@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/elections:master commit in: mail-scripts/
Date: Sun, 27 Aug 2017 16:35:30
Message-Id: 1503851708.c3e62801d978b906e1879ebcb9e43d99c00c77e6.jmbsvicetto@gentoo
1 commit: c3e62801d978b906e1879ebcb9e43d99c00c77e6
2 Author: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo <DOT> org>
3 AuthorDate: Sun Aug 27 16:34:34 2017 +0000
4 Commit: Jorge Manuel B. S. Vicetto <jmbsvicetto <AT> gentoo <DOT> org>
5 CommitDate: Sun Aug 27 16:35:08 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/elections.git/commit/?id=c3e62801
7
8 Add scripts for sending the confirmation emails for elections.
9
10 Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo.org>
11
12 mail-scripts/email | 6 ++++++
13 mail-scripts/mail-table | 1 +
14 mail-scripts/mail-voters | 17 +++++++++++++++++
15 3 files changed, 24 insertions(+)
16
17 diff --git a/mail-scripts/email b/mail-scripts/email
18 new file mode 100644
19 index 0000000..df5701f
20 --- /dev/null
21 +++ b/mail-scripts/email
22 @@ -0,0 +1,6 @@
23 +Hello.
24 +
25 +INSERT
26 +For the election officials for the <election-name> election,
27 +
28 +<signature>
29
30 diff --git a/mail-scripts/mail-table b/mail-scripts/mail-table
31 new file mode 100644
32 index 0000000..24d72bf
33 --- /dev/null
34 +++ b/mail-scripts/mail-table
35 @@ -0,0 +1 @@
36 +<nick> <email>
37
38 diff --git a/mail-scripts/mail-voters b/mail-scripts/mail-voters
39 new file mode 100644
40 index 0000000..c38f895
41 --- /dev/null
42 +++ b/mail-scripts/mail-voters
43 @@ -0,0 +1,17 @@
44 +election=<election-name>
45 +while read num user;
46 +do grep -q "confirmation $num" master-${election} || continue;
47 + email=$(grep "$user" mail-table);
48 + if [[ ! -z $email ]]; then
49 + to="${email#$user }"
50 + else
51 + to="$user@g.o"
52 + fi
53 + ( echo "To: $to";
54 + echo "From: elections@g.o"
55 + echo "Date: $(date -R)";
56 + echo "Subject: Your ${election} confirmation id";
57 + echo "";
58 + sed -e "s/^INSERT.*/Your confirmation number is $num./" email -e "s/ELECTION/$election/"; ) \
59 + | /usr/lib/sendmail -oi $to;
60 +done < confs-${election}