diff options
| author | Johannes Hoff <johshoff@gmail.com> | 2014-11-22 15:49:38 -0800 |
|---|---|---|
| committer | Johannes Hoff <johshoff@gmail.com> | 2014-11-22 15:49:38 -0800 |
| commit | cb501535b38ac40fc3d93aaee13d76eecd4fa6c9 (patch) | |
| tree | 010e11c050a9ac7f05cea384ebf01ac9e200a66e /src | |
| parent | 0d0a29061443852cae070b27d51de7cc69bbf293 (diff) | |
| download | rust-cb501535b38ac40fc3d93aaee13d76eecd4fa6c9.tar.gz rust-cb501535b38ac40fc3d93aaee13d76eecd4fa6c9.zip | |
Use mktemp for temporary download directory
Using the current directory may not always be appropriate, for example in the case where it will unnecessarily trigger a backup to be made. The only risk with this change is that systems might not have a mktemp. I am not aware of such a system, but have not tested on Windows. It is working on a basic Ubuntu and OS X installation.
Diffstat (limited to 'src')
| -rw-r--r-- | src/etc/rustup.sh | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/etc/rustup.sh b/src/etc/rustup.sh index 4829e15fb0f..7b72fe625c4 100644 --- a/src/etc/rustup.sh +++ b/src/etc/rustup.sh @@ -392,7 +392,7 @@ PACKAGE_NAME=rust-nightly PACKAGE_NAME_AND_TRIPLE="${PACKAGE_NAME}-${HOST_TRIPLE}" TARBALL_NAME="${PACKAGE_NAME_AND_TRIPLE}.tar.gz" REMOTE_TARBALL="https://static.rust-lang.org/dist/${TARBALL_NAME}" -TMP_DIR="./rustup-tmp-install" +TMP_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'` LOCAL_TARBALL="${TMP_DIR}/${TARBALL_NAME}" LOCAL_INSTALL_DIR="${TMP_DIR}/${PACKAGE_NAME_AND_TRIPLE}" LOCAL_INSTALL_SCRIPT="${LOCAL_INSTALL_DIR}/install.sh" @@ -405,12 +405,6 @@ CARGO_LOCAL_TARBALL="${TMP_DIR}/${CARGO_TARBALL_NAME}" CARGO_LOCAL_INSTALL_DIR="${TMP_DIR}/${CARGO_PACKAGE_NAME_AND_TRIPLE}" CARGO_LOCAL_INSTALL_SCRIPT="${CARGO_LOCAL_INSTALL_DIR}/install.sh" -rm -Rf "${TMP_DIR}" -need_ok "failed to remove temporary installation directory" - -mkdir -p "${TMP_DIR}" -need_ok "failed to create create temporary installation directory" - msg "downloading rust installer" "${CFG_CURL}" "${REMOTE_TARBALL}" > "${LOCAL_TARBALL}" if [ $? -ne 0 ] |
