Skip to content

Commit

Permalink
Manually apply third batch of shellcheck fixes.
Browse files Browse the repository at this point in the history
Signed-off-by: Ambre Austen Suhamy <[email protected]>
  • Loading branch information
ElectreAAS committed Jan 11, 2024
1 parent f3bfaaa commit 395322d
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/depexts/generate-actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ make
EOF

test_depext () {
for pkg in $@ ; do
for pkg in "$@" ; do
echo "./opam install $pkg || true" >> "$dir"/entrypoint.sh
done
}
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/main/legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -xue
. .github/scripts/main/preamble.sh

eval $(opam env)
OPAMCONFIRMLEVEL= OPAMCLI=2.0 opam upgrade --unlock-base --yes
OPAMCONFIRMLEVEL='' OPAMCLI=2.0 opam upgrade --unlock-base --yes

for package in core format installer ; do
opam pin add --yes --no-action opam-$package .
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/main/ocaml-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ cd ..
rm -rf "ocaml-$OCAML_VERSION"

if [[ $PLATFORM != 'Windows' ]]; then
echo > "$OCAML_LOCAL/bin/ocamldoc" <<"EOF"
cat > "$OCAML_LOCAL/bin/ocamldoc" <<"EOF"
#!/bin/sh
echo 'ocamldoc is not supposed to be called'>&2
Expand Down
8 changes: 4 additions & 4 deletions .github/scripts/scripts/hygiene.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ if [[ $GITHUB_EVENT_NAME = 'pull_request' ]]; then
echo "OPAM_BIN_URL_BASE = $OPAM_BIN_URL_BASE"
echo "VERSION = $VERSION; DEV_VERSION = $DEV_VERSION"
DEV_VERSION=${DEV_VERSION//\~/-}
if [[ $DEV_VERSION != $VERSION ]]; then
if [[ $DEV_VERSION != "$VERSION" ]]; then
ARCHES=2
else
ARCHES=1
fi
current_tag=''

while read -r line tag platform sha ; do
if [[ $tag != $current_tag ]]; then
if [[ $tag != "$current_tag" ]]; then
current_tag="$tag"
if [[ $tag = $VERSION || $tag = $DEV_VERSION ]]; then
if [[ $tag = "$VERSION" || $tag = "$DEV_VERSION" ]]; then
((ARCHES--))
fi
echo "🐪 Checking binaries for opam ${tag//-/\~}"
fi
URL="$OPAM_BIN_URL_BASE$tag/opam-$tag-$platform"
echo "Downloading $URL"
check=$(curl -Ls "$URL" | sha512sum | cut -d' ' -f1)
if [[ $check = $sha ]] ; then
if [[ $check = "$sha" ]] ; then
echo " as expected ($sha)"
else
echo "::error file=shell/install.sh,line=$line::Incorrect checksum; got $check"
Expand Down
2 changes: 1 addition & 1 deletion release/sign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ cd "$DIR"
OUTDIR="out/$TAG"
cd "${OUTDIR}"

for f in opam-$TAG-*; do
for f in opam-"$TAG"-*; do
sign "$f"
done
4 changes: 2 additions & 2 deletions shell/bootstrap-ocaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ cd "${V}"
PATH_PREPEND=
LIB_PREPEND=
INC_PREPEND=
if [ -n "$1" -a -n "${COMSPEC}" -a -x "${COMSPEC}" ] ; then
if [ -n "$1" ] && [ -n "${COMSPEC}" ] && [ -x "${COMSPEC}" ] ; then
case "$(uname -m)" in
'i686')
BUILD=i686-pc-cygwin
Expand Down Expand Up @@ -87,7 +87,7 @@ if [ -n "$1" -a -n "${COMSPEC}" -a -x "${COMSPEC}" ] ; then
if [ "$1" != "auto" ] ; then
echo "Compiler architecture $1 not recognised -- mingw64, mingw, msvc64, msvc (or auto)"
fi
if [ -n "${PROCESSOR_ARCHITEW6432}" -o "${PROCESSOR_ARCHITECTURE}" = "AMD64" ] ; then
if [ -n "${PROCESSOR_ARCHITEW6432}" ] || [ "${PROCESSOR_ARCHITECTURE}" = "AMD64" ] ; then
TRY64=1
else
TRY64=0
Expand Down
8 changes: 4 additions & 4 deletions shell/bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ while [ $# -gt 0 ]; do
MAKESELF=1;;
-o)
if [ $# -lt 2 ]; then echo "Missing argument to $1" >&2; exit 2; fi
TARGET="$(cd $(dirname "$1"); pwd)/$(basename "$1")";;
TARGET="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")";;
-*)
echo "Unrecognised option $1" >&2
help; exit 2;;
Expand Down Expand Up @@ -221,10 +221,10 @@ opam install --yes --destdir "\$DESTDIR" ${INSTALL_PACKAGES[@]}
EOF

chmod a+x bootstrap.sh configure.sh compile.sh
cd $(dirname "$CONTENT")
cd "$(dirname "$CONTENT")"
if [ -n "$MAKESELF" ]; then
makeself $(basename "$CONTENT") "$TARGET" "$(basename "${TARGET%%.*}")" ./compile.sh
makeself "$(basename "$CONTENT")" "$TARGET" "$(basename "${TARGET%%.*}")" ./compile.sh
else
tar cz $(basename "$CONTENT") -f "$TARGET"
tar cz "$(basename "$CONTENT")" -f "$TARGET"
fi
echo "Bundle has been generated as $TARGET"
4 changes: 2 additions & 2 deletions shell/check_linker
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ FAULT=0
PREPEND=
while IFS= read -r line; do
OUTPUT=$("$line" --version 2>/dev/null | head -1 | grep -F "Microsoft (R) Incremental Linker")
if [ "x$OUTPUT" = "x" -a $FIRST -eq 1 ] ; then
if [ -z "$OUTPUT" ] && [ $FIRST -eq 1 ] ; then
FAULT=1
elif [ $FAULT -eq 1 ] ; then
PREPEND=$(dirname "$line"):
FAULT=0
fi
done < <(which --all link)

echo $PATH_PREPEND$PREPEND
echo "$PATH_PREPEND$PREPEND"
24 changes: 12 additions & 12 deletions shell/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ xsudo() {
local DSTDIR=$(dirname "$DST")
if [ ! -w "$DSTDIR" ]; then
echo "Write access to $DSTDIR required, using 'sudo'."
echo "Command: $CMD $@"
echo "Command: $CMD $*"
if [ "$CMD" = "install" ]; then
sudo "$CMD" -g 0 -o root "$@"
else
Expand All @@ -400,8 +400,8 @@ if [ -n "$RESTORE" ]; then
exit 1
fi
if [ "$NOBACKUP" = 1 ]; then
printf "## This will clear $OPAM and $OPAMROOT. Continue ? [Y/n] "
read R
printf "## This will clear %s and %s. Continue ? [Y/n] " "$OPAM" "$OPAMROOT"
read -r R
case "$R" in
""|"y"|"Y"|"yes")
xsudo rm -f "$OPAM"
Expand All @@ -414,7 +414,7 @@ if [ -n "$RESTORE" ]; then
fi
xsudo mv "$OPAM_BAK" "$OPAM"
mv "$OPAMROOT_BAK" "$OPAMROOT"
printf "## Opam $RESTORE and its root were restored."
printf "## Opam %s and its root were restored." "$RESTORE"
if [ "$NOBACKUP" = 1 ]; then echo
else echo " Opam $OPAMV was backed up."
fi
Expand All @@ -432,16 +432,16 @@ if [ -n "$EXISTING_OPAM" ]; then
fi

while true; do
printf "## Where should it be installed ? [$DEFAULT_BINDIR] "
read BINDIR
printf "## Where should it be installed ? [%s] " "$DEFAULT_BINDIR"
read -r BINDIR
if [ -z "$BINDIR" ]; then BINDIR="$DEFAULT_BINDIR"; fi

if [ -d "$BINDIR" ]; then break
else
if [ "${BINDIR#\~/}" != "$BINDIR" ] ; then
RES_BINDIR="$HOME/${BINDIR#\~/}"
printf "## '$BINDIR' resolves to '$RES_BINDIR', do you confirm [Y/n] "
read R
printf "## '%s' resolves to '%s', do you confirm [Y/n] " "$BINDIR" "$RES_BINDIR"
read -r R
case "$R" in
""|"y"|"Y"|"yes")
BINDIR="$RES_BINDIR"
Expand All @@ -451,8 +451,8 @@ while true; do
;;
esac
fi
printf "## $BINDIR does not exist. Create ? [Y/n] "
read R
printf "## %s does not exist. Create ? [Y/n] " "$BINDIR"
read -r R
case "$R" in
""|"y"|"Y"|"yes")
xsudo mkdir -p "$BINDIR"
Expand All @@ -473,8 +473,8 @@ fi
if [ -d "$OPAMROOT" ]; then
if [ "$FRESH" = 1 ]; then
if [ "$NOBACKUP" = 1 ]; then
printf "## This will clear $OPAMROOT. Continue ? [Y/n] "
read R
printf "## This will clear %s. Continue ? [Y/n] " "$OPAMROOT"
read -r R
case "$R" in
""|"y"|"Y"|"yes")
rm -rf "$OPAMROOT";;
Expand Down
Loading

0 comments on commit 395322d

Please sign in to comment.