auto merge of : johshoff/rust/master, r=brson

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.
This commit is contained in:
bors 2014-12-29 05:22:26 +00:00
commit 03a1188cf3

@ -229,6 +229,18 @@ validate_opt() {
done
}
create_tmp_dir() {
local TMP_DIR=./rustup-tmp-install
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"
echo $TMP_DIR
}
probe_need CFG_CURL curl
probe_need CFG_TAR tar
probe_need CFG_FILE file
@ -401,7 +413,9 @@ then
CFG_INSTALL_FLAGS="${CFG_INSTALL_FLAGS} --prefix=${CFG_PREFIX}"
fi
CFG_TMP_DIR="./rustup-tmp-install"
CFG_TMP_DIR=$(mktemp -d 2>/dev/null \
|| mktemp -d -t 'rustup-tmp-install' 2>/dev/null \
|| create_tmp_dir)
RUST_URL="https://static.rust-lang.org/dist"
RUST_PACKAGE_NAME=rust-nightly
@ -424,9 +438,6 @@ download_package() {
msg "Downloading ${remote_tarball} to ${local_tarball}"
mkdir -p "${CFG_TMP_DIR}"
need_ok "failed to create create download directory"
"${CFG_CURL}" -f -o "${local_tarball}" "${remote_tarball}"
if [ $? -ne 0 ]
then