Skip to content

Commit

Permalink
ci: Fix cases where unset variables cause errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Nov 18, 2024
1 parent 59a18de commit f3bb382
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
21 changes: 9 additions & 12 deletions ci/install-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
set -eux

echo "Setup toolchain"
toolchain=
if [ -n "$TOOLCHAIN" ]; then
toolchain=$TOOLCHAIN
else
toolchain=nightly
fi

if [ "$OS" = "windows" ]; then
toolchain="${TOOLCHAIN:-nightly}"
os="${OS:-}"

if [ "$os" = "windows" ]; then
: "${TARGET?The TARGET environment variable must be set.}"
rustup set profile minimal
rustup update --force "$toolchain-$TARGET"
Expand All @@ -22,18 +19,18 @@ else
rustup default "$toolchain"
fi

if [ -n "$TARGET" ]; then
if [ -n "${TARGET:-}" ]; then
echo "Install target"
rustup target add "$TARGET"
fi

if [ -n "$INSTALL_RUST_SRC" ]; then
if [ -n "${INSTALL_RUST_SRC:-}" ]; then
echo "Install rust-src"
rustup component add rust-src
fi

if [ "$OS" = "windows" ]; then
if [ "$ARCH_BITS" = "i686" ]; then
if [ "$os" = "windows" ]; then
if [ "${ARCH_BITS:-}" = "i686" ]; then
echo "Install MinGW32"
choco install mingw --x86 --force
fi
Expand All @@ -44,7 +41,7 @@ if [ "$OS" = "windows" ]; then
/usr/bin/find "C:\ProgramData\Chocolatey" -name "dllcrt2*"
/usr/bin/find "C:\ProgramData\Chocolatey" -name "libmsvcrt*"

if [ -n "$ARCH_BITS" ]; then
if [ -n "${ARCH_BITS:-}" ]; then
echo "Fix MinGW"
for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do
cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS/$ARCH-w64-mingw32/lib/$i" "$(rustc --print sysroot)/lib/rustlib/$TARGET/lib"
Expand Down
2 changes: 1 addition & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ target="$1"
#
# It's assume that all images, when run with two disks, will run the `run.sh`
# script from the second which we place inside.
if [ "$QEMU" != "" ]; then
if [ -n "${QEMU:-}" ]; then
tmpdir=/tmp/qemu-img-creation
mkdir -p "${tmpdir}"

Expand Down

0 comments on commit f3bb382

Please sign in to comment.