Commit a44aed3d authored by Vincent Pelletier's avatar Vincent Pelletier

shell/caucase.sh,.shellcheckrc: Make shellcheck happy.

Silence the warning about "local" not being POSIX, as many shells implement
it.
Resolve the other watnings, related to now-useless "x" prefixes in [
arguments.
parent dc8636da
enable=avoid-nullary-conditions enable=avoid-nullary-conditions
enable=deprecate-which enable=deprecate-which
disable=SC3043 # In POSIX sh, 'local' is undefined.
...@@ -470,9 +470,9 @@ EOF ...@@ -470,9 +470,9 @@ EOF
"$url/crt/renew/" "$url/crt/renew/"
)"; then )"; then
if [ \ if [ \
"x$(printf '%s\n' "$newcrtdata" | head -n 1)" \ "$(printf '%s\n' "$newcrtdata" | head -n 1)" \
= \ = \
'x-----BEGIN CERTIFICATE-----' \ '-----BEGIN CERTIFICATE-----' \
]; then ]; then
if checkCertificateMatchesKey "$newcrtdata" "$newkeydata"; then if checkCertificateMatchesKey "$newcrtdata" "$newkeydata"; then
writeCertKey "$newcrt" "$newcrtdata" "$newkey" "$newkeydata" writeCertKey "$newcrt" "$newcrtdata" "$newkey" "$newkeydata"
...@@ -875,7 +875,7 @@ EOF ...@@ -875,7 +875,7 @@ EOF
--version) --version)
# shellcheck disable=SC2016 # shellcheck disable=SC2016
version='$Format:%H$' version='$Format:%H$'
if [ "x$(echo "$version" | base64)" = 'xJEZvcm1hdDolSCQK' ]; then if [ "$(echo "$version" | base64)" = 'JEZvcm1hdDolSCQK' ]; then
if command -v git > /dev/null; then if command -v git > /dev/null; then
version="$(git describe --tags --dirty --always --long)" version="$(git describe --tags --dirty --always --long)"
else else
...@@ -1031,7 +1031,7 @@ EOF ...@@ -1031,7 +1031,7 @@ EOF
crt_path="$2" crt_path="$2"
shift 2 shift 2
crt_dir="$(dirname "$crt_path")" crt_dir="$(dirname "$crt_path")"
if [ "x$crt_path" = 'x-' ]; then if [ "$crt_path" = '-' ]; then
# stdin & stdout # stdin & stdout
: :
elif [ -w "$crt_path" ] && [ -r "$crt_path" ]; then elif [ -w "$crt_path" ] && [ -r "$crt_path" ]; then
...@@ -1047,7 +1047,7 @@ EOF ...@@ -1047,7 +1047,7 @@ EOF
fi fi
crt="$(getCertificate "${ca_anon_url}/${mode_path}" "$csr_id")" \ crt="$(getCertificate "${ca_anon_url}/${mode_path}" "$csr_id")" \
|| return || return
if [ "x$crt_path" = 'x-' ]; then if [ "$crt_path" = '-' ]; then
printf '%s\n' "$crt" printf '%s\n' "$crt"
else else
if [ -e "$crt_path" ]; then if [ -e "$crt_path" ]; then
...@@ -1105,7 +1105,7 @@ EOF ...@@ -1105,7 +1105,7 @@ EOF
csr="$( csr="$(
getCertificateSigningRequest "${ca_anon_url}/${mode_path}" "$csr_id" getCertificateSigningRequest "${ca_anon_url}/${mode_path}" "$csr_id"
)" || return )" || return
if [ "x$csr_path" = 'x-' ]; then if [ "$csr_path" = '-' ]; then
printf '%s\n' "$csr" printf '%s\n' "$csr"
else else
printf '%s\n' "$csr" > "$csr_path" printf '%s\n' "$csr" > "$csr_path"
...@@ -1384,7 +1384,7 @@ EOF ...@@ -1384,7 +1384,7 @@ EOF
fi fi
echo 'Success' echo 'Success'
} }
if [ "$#" -gt 0 ] && [ "x$1" = 'x--test' ]; then if [ "$#" -gt 0 ] && [ "$1" = '--test' ]; then
if [ "$#" -le 2 ]; then if [ "$#" -le 2 ]; then
_test "${2:-localhost:8000}" _test "${2:-localhost:8000}"
else else
......
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