Move header extraction to python script and improve compatibility.

This commit is contained in:
Gus Kenion 2024-04-22 13:57:44 +02:00
parent 69e206f575
commit 005639c032

9
git_multisig.sh Normal file → Executable file
View File

@ -1,6 +1,11 @@
#!/bin/bash
run_id=`date -u '+%Y%m%d%H%M%S'`
script_dir=`dirname "$0"`
if [ -n "$script_dir" ]
then
script_dir="${script_dir}/"
fi
add_sig ()
{
@ -13,7 +18,7 @@ add_sig ()
# Output dearmored keys to files because bash variables don't play nicely with binary blobs
prev_sig_filename="prev.sig.${run_id}.tmp.gpg"
git cat-file -p ${git_hash} | sed -n '/-----BEGIN PGP/,/-----END PGP/p' | sed 's/gpgsig //g' | gpg --dearmor > ${prev_sig_filename}
git cat-file -p ${git_hash} | python3 ${script_dir}headerextract.py | gpg --dearmor > ${prev_sig_filename}
new_sig_filename="new.sig.${run_id}.tmp.gpg"
echo -e "${message}" | gpg -u ${key_id} -o ${new_sig_filename} --detach-sig
@ -53,7 +58,7 @@ verify_sig ()
git cat-file -p ${git_hash} | sed -n '/-----BEGIN PGP/,/-----END PGP/b;p' > ${message_filename}
local sig_filename=verify.sig.${run_id}.tmp.asc
git cat-file -p ${git_hash} | sed -n '/-----BEGIN PGP/,/-----END PGP/p' | sed 's/gpgsig //g' > ${sig_filename}
git cat-file -p ${git_hash} | python3 ${script_dir}headerextract.py | gpg --dearmor > ${sig_filename}
gpgv2 --keyring ${keyring_path} ${sig_filename} ${message_filename}
local res=$?