Skip to content

Commit 759adaf

Browse files
committed
ci: Fix cases where unset variables cause errors
(backport <#4108>) (cherry picked from commit f3bb382)
1 parent 18181ec commit 759adaf

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

ci/install-rust.sh

+9-12
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44
set -eux
55

66
echo "Setup toolchain"
7-
toolchain=
8-
if [ -n "$TOOLCHAIN" ]; then
9-
toolchain=$TOOLCHAIN
10-
else
11-
toolchain=nightly
12-
fi
137

14-
if [ "$OS" = "windows" ]; then
8+
toolchain="${TOOLCHAIN:-nightly}"
9+
os="${OS:-}"
10+
11+
if [ "$os" = "windows" ]; then
1512
: "${TARGET?The TARGET environment variable must be set.}"
1613
rustup set profile minimal
1714
rustup update --force "$toolchain-$TARGET"
@@ -22,18 +19,18 @@ else
2219
rustup default "$toolchain"
2320
fi
2421

25-
if [ -n "$TARGET" ]; then
22+
if [ -n "${TARGET:-}" ]; then
2623
echo "Install target"
2724
rustup target add "$TARGET"
2825
fi
2926

30-
if [ -n "$INSTALL_RUST_SRC" ]; then
27+
if [ -n "${INSTALL_RUST_SRC:-}" ]; then
3128
echo "Install rust-src"
3229
rustup component add rust-src
3330
fi
3431

35-
if [ "$OS" = "windows" ]; then
36-
if [ "$ARCH_BITS" = "i686" ]; then
32+
if [ "$os" = "windows" ]; then
33+
if [ "${ARCH_BITS:-}" = "i686" ]; then
3734
echo "Install MinGW32"
3835
choco install mingw --x86 --force
3936
fi
@@ -44,7 +41,7 @@ if [ "$OS" = "windows" ]; then
4441
/usr/bin/find "C:\ProgramData\Chocolatey" -name "dllcrt2*"
4542
/usr/bin/find "C:\ProgramData\Chocolatey" -name "libmsvcrt*"
4643

47-
if [ -n "$ARCH_BITS" ]; then
44+
if [ -n "${ARCH_BITS:-}" ]; then
4845
echo "Fix MinGW"
4946
for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do
5047
cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS/$ARCH-w64-mingw32/lib/$i" "$(rustc --print sysroot)/lib/rustlib/$TARGET/lib"

ci/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ target="$1"
1515
#
1616
# It's assume that all images, when run with two disks, will run the `run.sh`
1717
# script from the second which we place inside.
18-
if [ "$QEMU" != "" ]; then
18+
if [ -n "${QEMU:-}" ]; then
1919
tmpdir=/tmp/qemu-img-creation
2020
mkdir -p "${tmpdir}"
2121

0 commit comments

Comments
 (0)