Skip to content

Commit

Permalink
Fall back to hard coded download directory
Browse files Browse the repository at this point in the history
If mktemp fails, fall back to a hard coded directory, per @nodakai's feedback.
  • Loading branch information
johshoff committed Nov 27, 2014
1 parent cb50153 commit 8f827d3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/etc/rustup.sh
Expand Up @@ -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

CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
Expand Down Expand Up @@ -392,7 +404,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=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'`
TMP_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir' 2>/dev/null` || TMP_DIR=$(create_tmp_dir)
LOCAL_TARBALL="${TMP_DIR}/${TARBALL_NAME}"
LOCAL_INSTALL_DIR="${TMP_DIR}/${PACKAGE_NAME_AND_TRIPLE}"
LOCAL_INSTALL_SCRIPT="${LOCAL_INSTALL_DIR}/install.sh"
Expand Down

0 comments on commit 8f827d3

Please sign in to comment.