]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
moved _openssl helper a bit up to be near the other helper methods
authorLukas Schauer <lukas@schauer.so>
Fri, 8 Jan 2016 18:30:56 +0000 (19:30 +0100)
committerLukas Schauer <lukas@schauer.so>
Fri, 8 Jan 2016 19:00:29 +0000 (20:00 +0100)
letsencrypt.sh

index cc5c8b00d9b1e64161a99ac837fe76d05ac4ba3d..7fd89a981bbd8807f7da7df09c2afc26013370f3 100755 (executable)
@@ -152,6 +152,22 @@ get_json_array() {
   grep -Eo '"'"${1}"'":[^\[]*\[[^]]*]'
 }
 
+# OpenSSL writes to stderr/stdout even when there are no errors. So just
+# display the output if the exit code was != 0 to simplify debugging.
+_openssl() {
+  set +e
+  out="$(openssl "${@}" 2>&1)"
+  res=$?
+  set -e
+  if [[ $res -ne 0 ]]; then
+    echo "  + ERROR: failed to run $* (Exitcode: $res)" >&2
+    echo >&2
+    echo "Details:" >&2
+    echo "$out" >&2
+    exit $res
+  fi
+}
+
 http_request() {
   tempcont="$(mktemp)"
 
@@ -187,22 +203,6 @@ http_request() {
   rm -f "${tempcont}"
 }
 
-# OpenSSL writes to stderr/stdout even when there are no errors. So just
-# display the output if the exit code was != 0 to simplify debugging.
-_openssl() {
-  set +e
-  out="$(openssl "${@}" 2>&1)"
-  res=$?
-  set -e
-  if [[ $res -ne 0 ]]; then
-    echo "  + ERROR: failed to run $* (Exitcode: $res)" >&2
-    echo >&2
-    echo "Details:" >&2
-    echo "$out" >&2
-    exit $res
-  fi
-}
-
 signed_request() {
   # Encode payload as urlbase64
   payload64="$(printf '%s' "${2}" | urlbase64)"