summaryrefslogtreecommitdiff
path: root/bin/interpret-mail
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-09-05 11:05:52 +0200
committerErich Eckner <git@eckner.net>2017-09-05 11:05:52 +0200
commit273f4458866271eb7746377a10dd4d8ebdb98614 (patch)
tree6c75694b2d8ab1f7ebba112aa8db183d94850807 /bin/interpret-mail
parent5867cb10d272910c48457b5339ad4adbe746e987 (diff)
downloadbuilder-273f4458866271eb7746377a10dd4d8ebdb98614.tar.xz
bin/block-package new, bin/interprete-mail can now also block/unblock packages
Diffstat (limited to 'bin/interpret-mail')
-rwxr-xr-xbin/interpret-mail64
1 files changed, 45 insertions, 19 deletions
diff --git a/bin/interpret-mail b/bin/interpret-mail
index 6e2d365..908afa0 100755
--- a/bin/interpret-mail
+++ b/bin/interpret-mail
@@ -32,17 +32,25 @@ if ! sed -n '
exit
fi
-if [ -z "$(
- (
- grep '^\[GNUPG:] VALIDSIG ' "${tmp_dir}/gpg-status" | \
- cut -d' ' -f3 | \
- sort -u
- printf '%s\n' "${admin_gpg_keys}" | \
- sort -u
- ) | \
- sort | \
- uniq -d
- )" ]; then
+grep '^\[GNUPG:] VALIDSIG ' "${tmp_dir}/gpg-status" | \
+ cut -d' ' -f3 | \
+ sort -u > \
+ "${tmp_dir}/found-keys"
+
+printf '%s\n' "${admin_gpg_keys}" | \
+ sort -k1,1 -u > \
+ "${tmp_dir}/admin-gpg-keys"
+
+join -j 1 -o 2.2 \
+ "${tmp_dir}/found-keys" \
+ "${tmp_dir}/admin-gpg-keys" | \
+ tr ',' '\n' | \
+ sed 's|^ALL$|'"${possible_email_actions}"'|' | \
+ tr ' ,' '\n' | \
+ sort -u > \
+ "${tmp_dir}/allowed-actions"
+
+if [ ! -s "${tmp_dir}/allowed-actions" ]; then
>&2 echo 'No valid signature found.'
grep '^\[GNUPG:] VALIDSIG ' "${tmp_dir}/gpg-status" | \
cut -d' ' -f3 | \
@@ -63,14 +71,32 @@ sed -n '
' "${tmp_dir}/plain-content" > \
"${tmp_dir}/raw-content"
-sed -n '
- /^stabilize:/{
- s/^stabilize:\s*//
- /\.pkg\.tar\.xz$/!s/$/.pkg.tar.xz/
- w '"${tmp_dir}/stabilize"'
- }
-' "${tmp_dir}/raw-content"
+sed -n "$(
+ while read -r action; do
+ if [ -z "${action}" ]; then
+ continue
+ fi
+ printf \
+ '/^%s:/{ s/^%s:\s*//; w %s/%s\n }\n' \
+ "${action}" \
+ "${action}" \
+ "${tmp_dir}" \
+ "${action}"
+ done < \
+ "${tmp_dir}/allowed-actions"
+)" "${tmp_dir}/raw-content"
+
+if [ -s "${tmp_dir}/block" ]; then
+ chronic "${base_dir}/bin/block-package" "${tmp_dir}/block"
+fi
if [ -s "${tmp_dir}/stabilize" ]; then
- chronic "${base_dir}/bin/db-update" -b -f "${tmp_dir}/stabilize"
+ sed -i '
+ /\.pkg\.tar\.xz$/!s/$/.pkg.tar.xz/
+ ' "${tmp_dir}/stabilize"
+# chronic "${base_dir}/bin/db-update" -b -f "${tmp_dir}/stabilize"
+fi
+
+if [ -s "${tmp_dir}/unblock" ]; then
+ chronic "${base_dir}/bin/block-package" -u "${tmp_dir}/unblock"
fi