aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2023-11-15 10:44:06 -0500
committerNick Mathewson <nickm@torproject.org>2023-11-15 10:44:06 -0500
commita0d3004859f918d9d542a0526aa76252e1648c66 (patch)
tree84f954c77d9c95c7600ce36293a4d9231bc00479 /bin
parent08f943c32dbb8b35f57f1b11d5ae2b8004627ae5 (diff)
downloadtorspec-a0d3004859f918d9d542a0526aa76252e1648c66.tar.gz
torspec-a0d3004859f918d9d542a0526aa76252e1648c66.zip
Fix several shellcheck warnings
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build_html6
-rwxr-xr-xbin/check_links1
-rwxr-xr-xbin/mermaid-cli-in-ci6
-rwxr-xr-xbin/mermaid_cvt_svg13
4 files changed, 14 insertions, 12 deletions
diff --git a/bin/build_html b/bin/build_html
index 069901e..b6ee26d 100755
--- a/bin/build_html
+++ b/bin/build_html
@@ -2,9 +2,9 @@
set -e -u -o pipefail -x
-: ${MDBOOK:=mdbook}
+: "${MDBOOK:=mdbook}"
-TOPLEVEL=$(realpath $(dirname "$0"))/..
+TOPLEVEL=$(realpath "$(dirname "$0")")/..
cd "${TOPLEVEL}"
./bin/reindex
@@ -72,7 +72,7 @@ fi
# mdbook-linkcheck is a non-obvious dependency, and the mdbook output when it's
# not found doesn't spell out how to install it.
if ! command -v mdbook-linkcheck; then
- echo 'ERROR: mdbook-linkcheck not found. You should probably install it with `cargo install mdbook-linkcheck`'
+ echo 'ERROR: mdbook-linkcheck not found. You should probably install it with "cargo install mdbook-linkcheck"'
exit 1
fi
diff --git a/bin/check_links b/bin/check_links
index 9be7953..a079976 100755
--- a/bin/check_links
+++ b/bin/check_links
@@ -19,6 +19,7 @@ cp -al html $chk_dir
# Fix up https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=425632
+# shellcheck disable=SC2016
find $chk_dir -name \*.html -print0 |
xargs -0r -- perl -i~ -pe '
s{\bid=("[^"]+")[^<>]*\>}{$&<a name=$1>}g;
diff --git a/bin/mermaid-cli-in-ci b/bin/mermaid-cli-in-ci
index 5d6d041..07700fa 100755
--- a/bin/mermaid-cli-in-ci
+++ b/bin/mermaid-cli-in-ci
@@ -8,7 +8,7 @@ set -x
# Actually, it just causes us to ignore previous cached results.
cache_clear_token=2023-11-09c
-cache_dir=cache/"$CI_JOB_IMAGE","$cache_clear_token","puppeteer"
+cache_dir="cache/$CI_JOB_IMAGE,$cache_clear_token,puppeteer"
local_dir="$HOME/.cache/puppeteer"
if test -d "$cache_dir"; then
@@ -21,8 +21,8 @@ fi
(
cd "$local_dir"
- find -printf '%y %p %l\n' | sort
- find -type f | sort | xargs sha256sum --
+ find . -printf '%y %p %l\n' | sort
+ find . -type f | sort | xargs sha256sum --
) >puppeteer-cache-got-listings
# Empirically, the mermaid-cli locked install produced a very old
diff --git a/bin/mermaid_cvt_svg b/bin/mermaid_cvt_svg
index 3198a00..a48bbee 100755
--- a/bin/mermaid_cvt_svg
+++ b/bin/mermaid_cvt_svg
@@ -2,9 +2,9 @@
set -e -u -o pipefail -x
-TOPLEVEL=$(realpath $(dirname "$0"))/..
+TOPLEVEL=$(realpath "$(dirname "$0")")/..
TMPDIR="$1"
-: ${MMDC:=mmdc}
+: "${MMDC:=mmdc}"
cd "$TOPLEVEL"
@@ -13,11 +13,12 @@ cp -rl spec proposals mdbook "$TMPDIR"
# We use mermaid-cli to extract the mermaid from any file containing it,
# and generate a new version that uses svg instead.
-for fname in $(find "$TMPDIR" -name "*.md") ; do
- if grep '^```mermaid' $fname; then
+shopt -s globstar nullglob
+for fname in "$TMPDIR"/**/*.md; do
+ if grep '^```mermaid' "$fname"; then
ORIG="${fname%.md}.__orig.md"
- mv $fname $ORIG
- $MMDC -i $ORIG -o $fname
+ mv "$fname" "$ORIG"
+ $MMDC -i "$ORIG" -o "$fname"
fi
done