Commit | Line | Data |
---|---|---|
89e5ff8d | 1 | #!/bin/sh |
14c34385 P |
2 | recipients="root+git" # adresse pour l'envoi du courriel |
3 | ||
4 | PATH=/usr/sbin:/usr/bin:/sbin:/bin | |
5 | export PATH | |
6 | ||
7 | . /etc/auf-git-etc/config | |
8 | ||
8b3c87f0 | 9 | # On modifie un peu la sortie de git show : |
8cac288c P |
10 | # - on remplace le nom de l'expéditeur dans l'enveloppe par "root+git" |
11 | # - on insère "git hostname - " devant le nom en From: | |
12 | # - on remplace "[PATCH]" par "git-commit:" dans le champ Subject: | |
13 | # - on ajoute un champ To: | |
14 | # - on ajoute des champs MIME (version, type & encodage) | |
8b3c87f0 | 15 | # et on envoie le tout via sendmail |
8cac288c P |
16 | git show --pretty=email | awk '\ |
17 | BEGIN { v=0 ; t=0 ; e=0 } | |
18 | /^From / { sub(/ [^ ]+ /," root+git ") } | |
14c34385 | 19 | /^From: / { sub(/:/,": auf-git-etc '"`hostname --fqdn`"' -") } |
8cac288c P |
20 | /^Subject: / { sub(/\[PATCH\]/,"git-commit:") } |
21 | /^MIME-Version: / { v=1 } | |
22 | /^Content-Type: / { t=1 } | |
23 | /^Content-Transfer-Encoding: / { e=1 } | |
24 | /^$/ { | |
25 | print "To: '"${recipients}"'" | |
26 | if (!v) { print "MIME-Version: 1.0" } | |
27 | if (!t) { print "Content-Type: text/plain; charset=utf-8" } | |
28 | if (!e) { print "Content-Transfer-Encoding: 8bits" } | |
fb5bd3d5 | 29 | print ; while(getline) { print } ; exit |
8cac288c P |
30 | } |
31 | { print } | |
14c34385 P |
32 | ' | ( |
33 | head -c 16k | |
34 | cat << __EOF__ | |
35 | ||
36 | -- | |
37 | http://wiki.auf.org/wikiteki/Git/SuiviDeConfiguration | |
38 | __EOF__ | |
39 | ) | /usr/sbin/sendmail ${recipients} | |
8b3c87f0 | 40 | exit 0 |