Skip to content

Commit 694500b

Browse files
committed
rustup: extract the tarballs as part of installation
1 parent bd8dac8 commit 694500b

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/etc/rustup.sh

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ CARGO_TARBALL_NAME="${CARGO_PACKAGE_NAME_AND_TRIPLE}.tar.gz"
416416
CARGO_LOCAL_INSTALL_DIR="${CFG_TMP_DIR}/${CARGO_PACKAGE_NAME_AND_TRIPLE}"
417417
CARGO_LOCAL_INSTALL_SCRIPT="${CARGO_LOCAL_INSTALL_DIR}/install.sh"
418418

419-
# Fetch the package and extract it.
420-
download_and_extract_package() {
419+
# Fetch the package.
420+
download_package() {
421421
remote_url="$1"
422422
tarball_name="$2"
423423
remote_tarball="${remote_url}/${tarball_name}"
@@ -434,18 +434,19 @@ download_and_extract_package() {
434434
rm -Rf "${CFG_TMP_DIR}"
435435
err "failed to download installer"
436436
fi
437+
}
438+
439+
# Wrap all the commands needed to install a package.
440+
install_package() {
441+
tarball_name="$1"
442+
install_script="$2"
437443

438444
msg "Extracting ${tarball_name}"
439445
(cd "${CFG_TMP_DIR}" && "${CFG_TAR}" -xvf "${tarball_name}")
440446
if [ $? -ne 0 ]; then
441447
rm -Rf "${CFG_TMP_DIR}"
442448
err "failed to unpack installer"
443449
fi
444-
}
445-
446-
# Wrap all the commands needed to install a package.
447-
install_package() {
448-
install_script="$1"
449450

450451
sh "${install_script}" "${CFG_INSTALL_FLAGS}"
451452
if [ $? -ne 0 ]
@@ -468,20 +469,24 @@ install_packages() {
468469
mkdir -p "${CFG_TMP_DIR}"
469470
need_ok "failed to create create temporary installation directory"
470471

471-
download_and_extract_package \
472+
download_package \
472473
"${RUST_URL}" \
473474
"${RUST_TARBALL_NAME}"
474475

475476
if [ -z "${CFG_DISABLE_CARGO}" ]; then
476-
download_and_extract_package \
477+
download_package \
477478
"${CARGO_URL}" \
478479
"${CARGO_TARBALL_NAME}"
479480
fi
480481

481-
install_package "${RUST_LOCAL_INSTALL_SCRIPT}"
482+
install_package \
483+
"${RUST_TARBALL_NAME}" \
484+
"${RUST_LOCAL_INSTALL_SCRIPT}"
482485

483486
if [ -z "${CFG_DISABLE_CARGO}" ]; then
484-
install_package "${CARGO_LOCAL_INSTALL_SCRIPT}"
487+
install_package \
488+
"${CARGO_TARBALL_NAME}" \
489+
"${CARGO_LOCAL_INSTALL_SCRIPT}"
485490
fi
486491

487492
rm -Rf "${CFG_TMP_DIR}"

0 commit comments

Comments
 (0)