File tree Expand file tree Collapse file tree 1 file changed +14
-27
lines changed Expand file tree Collapse file tree 1 file changed +14
-27
lines changed Original file line number Diff line number Diff line change @@ -443,6 +443,18 @@ download_and_extract_package() {
443
443
fi
444
444
}
445
445
446
+ # Wrap all the commands needed to install a package.
447
+ install_package () {
448
+ install_script=" $1 "
449
+
450
+ sh " ${install_script} " " ${CFG_INSTALL_FLAGS} "
451
+ if [ $? -ne 0 ]
452
+ then
453
+ rm -Rf " ${CFG_TMP_DIR} "
454
+ err " failed to install Rust"
455
+ fi
456
+ }
457
+
446
458
rm -Rf " ${CFG_TMP_DIR} "
447
459
need_ok " failed to remove temporary installation directory"
448
460
@@ -459,35 +471,10 @@ if [ -z "${CFG_DISABLE_CARGO}" ]; then
459
471
" ${CARGO_TARBALL_NAME} "
460
472
fi
461
473
462
-
463
- (cd " ${CFG_TMP_DIR} " && ${CFG_TAR} xzf " ${RUST_TARBALL_NAME} " )
464
- if [ $? -ne 0 ]
465
- then
466
- rm -Rf " ${CFG_TMP_DIR} "
467
- err " failed to unpack installer"
468
- fi
469
-
470
- sh " ${RUST_LOCAL_INSTALL_SCRIPT} " " ${CFG_INSTALL_FLAGS} "
471
- if [ $? -ne 0 ]
472
- then
473
- rm -Rf " ${CFG_TMP_DIR} "
474
- err " failed to install Rust"
475
- fi
474
+ install_package " ${RUST_LOCAL_INSTALL_SCRIPT} "
476
475
477
476
if [ -z " ${CFG_DISABLE_CARGO} " ]; then
478
- (cd " ${CFG_TMP_DIR} " && ${CFG_TAR} xzf " ${CARGO_TARBALL_NAME} " )
479
- if [ $? -ne 0 ]
480
- then
481
- rm -Rf " ${CFG_TMP_DIR} "
482
- err " failed to unpack cargo installer"
483
- fi
484
-
485
- sh " ${CARGO_LOCAL_INSTALL_SCRIPT} " " ${CFG_INSTALL_FLAGS} "
486
- if [ $? -ne 0 ]
487
- then
488
- rm -Rf " ${CFG_TMP_DIR} "
489
- err " failed to install Cargo"
490
- fi
477
+ install_package " ${CARGO_LOCAL_INSTALL_SCRIPT} "
491
478
fi
492
479
493
480
rm -Rf " ${CFG_TMP_DIR} "
You can’t perform that action at this time.
0 commit comments