blob: 2402aaf6237f8b9fab5f2d5ad14930afc35c5972 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/bin/sh
#
#
# Copyright 2016 Luca Capello <luca.capello@infomaniak.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA
#
#
# This is an example script that can be hooked into reprepro
# to send an email after a .changes file is processed.
#
# All you have to do is to:
# - copy it into you conf/ directory,
# - add the following to any distribution in conf/distributions
# you want to have emails sent for:
#Log:
# --changes mail-changes.example
# (note the space at the beginning of the second line).
#
# DEPENDENCIES: mailx
set -e
if test "x${REPREPRO_OUT_DIR:+set}" = xset ; then
# Note: due to cd, REPREPRO_*_DIR will no longer
# be usable. And only things relative to outdir will work...
cd "${REPREPRO_OUT_DIR}" || exit 1
else
# this will also trigger if reprepro < 3.5.1 is used,
# in that case replace this with a manual cd to the
# correct directory...
cat "mail-accepted.example needs to be run by reprepro!" >&2
exit 1
fi
MAIL_TO="$USER"
ACTION="$1"
CODENAME="$2"
PACKAGENAME="$3"
PACKAGEVERSION="$4"
CHANGESFILE="$5"
if [ "x$ACTION" = "xaccepted" ]; then
MAIL_FROM="$(grep Changed-By $CHANGESFILE | \
sed -e 's/Changed-By/From/')"
ARCHITECTURE="$(grep Architecture $CHANGESFILE | \
sed -e 's/Architecture: //')"
MAIL_SUBJECT="Accepted $PACKAGENAME $PACKAGEVERSION ($ARCHITECTURE) into $CODENAME"
cat "$CHANGESFILE" | \
mail -a "$MAIL_FROM" -s "$MAIL_SUBJECT" "$MAIL_TO"
fi
exit 0
|