Skip to content

Commit d76aa65

Browse files
committed
ci: Fix cases where unset variables cause errors
1 parent 59a18de commit d76aa65

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

ci/install-rust.sh

Lines changed: 7 additions & 10 deletions
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,17 +19,17 @@ 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
32+
if [ "$os" = "windows" ]; then
3633
if [ "$ARCH_BITS" = "i686" ]; then
3734
echo "Install MinGW32"
3835
choco install mingw --x86 --force

0 commit comments

Comments
 (0)