[git] gnupg-doc - branch, master, updated. 0862f792100b1e7d73466592b6922e12aba0cb28

by Werner Koch cvs at cvs.gnupg.org
Mon Oct 13 19:30:10 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GnuPG website and other docs".

The branch, master has been updated
       via  0862f792100b1e7d73466592b6922e12aba0cb28 (commit)
      from  1e43180ee23ec011709494f906b19125cc39538f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0862f792100b1e7d73466592b6922e12aba0cb28
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Oct 13 19:30:18 2014 +0200

    tools: Send a thank you mail for payproc received donations.

diff --git a/tools/append-to-donors.sh b/tools/append-to-donors.sh
index 86697ad..f1156c5 100755
--- a/tools/append-to-donors.sh
+++ b/tools/append-to-donors.sh
@@ -1,11 +1,17 @@
 #!/bin/sh
 # append-to-donors.sh
-# Append new names from the payproc journal tothe donros file.
+# Append new names from the payproc journal to the donors file
+# and send a Thank You mail.
 
 pgm="append-to-donors.sh"
 set -e
 
 PATH=/usr/local/bin:$PATH
+SENDMAIL="/usr/sbin/sendmail"
+LC_ALL=C
+LC_CTYPE=C
+RFCDATE="$(date -R)"
+SIGDELIM="-- "
 
 htdocs="/var/www/www/www.gnupg.org/htdocs"
 
@@ -25,6 +31,76 @@ fi
 trap "rm -f $LOCKFILE" 0
 
 
+# Send a thank you mail
+# Uses these variables:
+#  amount   - The amount of the donation
+#  currency - The currency for the amount
+#  euro     - The amount cinvertet to Euro
+#  xmail    - The mailbox
+#  name     - The name or empty for an anonymous donation
+#  message  - The message to us or empty
+# Used scratch variables:
+#  upcurrency
+#  ineuro
+#
+# FIXME: Clean message and name and use an appropriate encoding.
+#        The second mail should actually be encrypted.  In fact
+#        we would better try to encrypt also the first mail.  Add a
+#        pubkey field to the donation page?
+#
+send_thanks () {
+    upcurrency=$(echo $currency | tr [a-z] [A-Z])
+    if [ "$upcurrency" = EUR ]; then
+        ineuro=
+    else
+        ineuro=" (about $euro EUR)"
+    fi
+    ( cat <<EOF
+From: donations at gnupg.org
+To: $xmail
+Subject: Thank you for supporting GnuPG
+Date: $RFCDATE
+Mime-Version: 1.0
+Content-Type: text/plain
+X-Loop: gnupg-donations-thanks.gnupg.org
+
+Dear ${name:-Anonymous},
+
+we received $amount $upcurrency$ineuro as a donation for the GnuPG project.
+Your donation helps us to develop and maintain GnuPG and related software.
+
+Thank you.
+
+  Werner
+
+
+$SIGDELIM
+GnuPG - helping to keep private data private
+EOF
+    ) | $SENDMAIL -oi donations at gnupg.org "$xmail"
+
+
+if [ -n "$message" ]; then
+    ( cat <<EOF
+From: donations at gnupg.org
+To: donations at gnupg.org
+Reply-To: $xmail
+Subject: Message from GnuPG donor
+Date: $RFCDATE
+Mime-Version: 1.0
+Content-Type: text/plain
+X-Loop: gnupg-donations-thanks.gnupg.org
+
+Name ..: ${name:-Anonymous}
+Amount : $amount $upcurrency $ineuro
+Message: $message
+EOF
+    ) | $SENDMAIL -oi donations at gnupg.org
+fi
+
+}
+
+
 # Find the last entry in donors which we have put in.
 tmp=$(awk -F: <$donors '
     /^(#.*)?$/ {next}
@@ -46,13 +122,20 @@ find $journal_dir -type f -name 'journal-????????.log' -print \
     jyear=$(echo $jdate |sed 's/\(....\).*/\1/')
     if [ "$jdate" -ge "$lastdate" ]; then
         [ "$jdate" -gt "$lastdate" ] && lastline=0
-        payproc-jrnl -F_lnr -Fdate -F'[name]' \
+        payproc-jrnl -F_lnr -Fdate -F'[name]' -F'[message]' \
+                     -Fmail -Famount -Fcurrency -Feuro\
            -S "_lnr > $lastline" -Stype=C -Saccount==1 \
            --html --print "$journal_dir/journal-$jdate.log" \
-         | while IFS=: read lnr datestr name rest; do
+         | while IFS=: read lnr datestr name message \
+                            xmail amount currency euro rest; do
+            name=$(echo "$name" | tr \`\$: ...)
+            message=$(echo "$message" | tr \`\$ ..)
+            xmail=$(echo "$xmail" | tr \`\$ ..)
             if [ -n "$name" ]; then
+               # Note that we removed colons from $name
                echo "$jyear:$datestr:$name::$lnr:" >> "$donors.tmp"
             fi
+            send_thanks
          done
     fi
 done

-----------------------------------------------------------------------

Summary of changes:
 tools/append-to-donors.sh |   89 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 86 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
The GnuPG website and other docs
http://git.gnupg.org




More information about the Gnupg-commits mailing list