]> git.street.me.uk Git - andy/dehydrated.git/commitdiff
use awk instead of grep for reading trailing line after match (fixes #255)
authorLukas Schauer <lukas@schauer.so>
Sun, 29 Jan 2017 23:12:01 +0000 (00:12 +0100)
committerLukas Schauer <lukas@schauer.so>
Sun, 29 Jan 2017 23:12:01 +0000 (00:12 +0100)
dehydrated

index a5789556014bddc514a64162f5089e66054fdb18..e592206e5e0edead2a3899b32ac64394656d217c 100755 (executable)
@@ -446,7 +446,7 @@ extract_altnames() {
   reqtext="$( <<<"${csr}" openssl req -noout -text )"
   if <<<"${reqtext}" grep -q '^[[:space:]]*X509v3 Subject Alternative Name:[[:space:]]*$'; then
     # SANs used, extract these
-    altnames="$( <<<"${reqtext}" grep -A1 '^[[:space:]]*X509v3 Subject Alternative Name:[[:space:]]*$' | tail -n1 )"
+    altnames="$( <<<"${reqtext}" awk '/^[[:space:]]*X509v3 Subject Alternative Name:[[:space:]]*$/{print;getline;print;}' | tail -n1 )"
     # split to one per line:
     # shellcheck disable=SC1003
     altnames="$( <<<"${altnames}" _sed -e 's/^[[:space:]]*//; s/, /\'$'\n''/g' )"