From 005639c032d8fbe06d77364fcccd1114d077b590 Mon Sep 17 00:00:00 2001 From: Gus Kenion Date: Mon, 22 Apr 2024 13:57:44 +0200 Subject: [PATCH] Move header extraction to python script and improve compatibility. --- git_multisig.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) mode change 100644 => 100755 git_multisig.sh diff --git a/git_multisig.sh b/git_multisig.sh old mode 100644 new mode 100755 index 65f422e..3279c5b --- a/git_multisig.sh +++ b/git_multisig.sh @@ -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=$?