aboutsummaryrefslogtreecommitdiff
path: root/hooks/sendemail-validate-attestation-hook
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-11-23 15:33:24 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-11-23 15:33:24 -0500
commit816375b5a8fb342324d3fd1cc6630f2fde7483da (patch)
tree328fbd6a1b11f89124dc770ddf6ba7aa82f5f188 /hooks/sendemail-validate-attestation-hook
parent1413539c899bd2ecbc208f3ef70f99d2ecbb3352 (diff)
downloadb4-816375b5a8fb342324d3fd1cc6630f2fde7483da.tar.gz
Add sendemail-validate hook and attestation docs
This adds a symlinkable hook that can perform inline attstation straight from the b4 checkout dir, plus documentation that explains some of the core concepts behind in-header attestation. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'hooks/sendemail-validate-attestation-hook')
-rwxr-xr-xhooks/sendemail-validate-attestation-hook11
1 files changed, 11 insertions, 0 deletions
diff --git a/hooks/sendemail-validate-attestation-hook b/hooks/sendemail-validate-attestation-hook
new file mode 100755
index 0000000..2f740d7
--- /dev/null
+++ b/hooks/sendemail-validate-attestation-hook
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+if which b4>/dev/null 2>&1; then
+ # We have it in path, so just execute it
+ b4 attest "${1}"
+else
+ # Assume we're symlinked into a b4 checkout
+ REAL_SCRIPT=$(realpath -e ${BASH_SOURCE[0]})
+ SCRIPT_TOP="${SCRIPT_TOP:-$(dirname ${REAL_SCRIPT})}"
+ B4_TOP=$(realpath -e ${SCRIPT_TOP}/..)
+ exec env PYTHONPATH="${B4_TOP}" python3 "${B4_TOP}/b4/command.py" attest "${1}"
+fi