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