Commit dc8636da authored by Vincent Pelletier's avatar Vincent Pelletier

shell/caucase.sh: Tolerate openssl not emitting a "keyid:" prefix.

This whole business of parsing openssl command output is so brittle...
parent ff8eafca
...@@ -358,8 +358,9 @@ storeByAuthorityKeyIdentifier () { ...@@ -358,8 +358,9 @@ storeByAuthorityKeyIdentifier () {
data="$(cat)" data="$(cat)"
keyid="$(printf '%s\n' "$data" \ keyid="$(printf '%s\n' "$data" \
| openssl "$1" -text -noout \ | openssl "$1" -text -noout \
| grep -A4 '^\s*X509v3 Authority Key Identifier:\s*$' | grep '^\s*keyid:' \ | grep -A1 '^\s*X509v3 Authority Key Identifier:\s*$' \
| head -n1 | sed -e 's/^\s*keyid://' -e 's/://g')" | grep -v '^\s*X509v3 Authority Key Identifier:\s*$' \
| head -n1 | sed -e 's/^\s*\(keyid:\)\?//' -e 's/://g')"
test $? -ne 0 && return 1 test $? -ne 0 && return 1
printf '%s\n' "$data" > "$(printf '%s/%s%s' "$2" "$keyid" "$3")" printf '%s\n' "$data" > "$(printf '%s/%s%s' "$2" "$keyid" "$3")"
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment