@@ -69,6 +69,9 @@ echo "==================================================="
6969echo
7070
7171INSTALLED_RUST=" "
72+ CARGO_DIR=" ${CARGO_HOME:- $HOME / .cargo} "
73+ CARGO_INSTALL_DIR=" ${CARGO_INSTALL_ROOT:- $CARGO_DIR } "
74+ CARGO_INSTALL_BIN_DIR=" $CARGO_INSTALL_DIR /bin"
7275
7376_send_telemetry () {
7477 if [[ " $TELEMETRY " = " 1" ]]; then
@@ -106,7 +109,7 @@ _exit_success() {
106109 if [[ " $INSTALLED_RUST " = " yes" ]]; then
107110 echo
108111 [[ " $SUPPORTS_COLOR " = " 1" ]] && echo -en " \e[33m" # yellow
109- echo " Remember to 'source \" $HOME /.cargo /env\" ' or restart your shell to run cargo and shuttle commands!"
112+ echo " Remember to 'source \" $CARGO_DIR /env\" ' or restart your shell to run cargo and shuttle commands!"
110113 [[ " $SUPPORTS_COLOR " = " 1" ]] && echo -en " \e[0m"
111114 fi
112115 exit 0
@@ -269,13 +272,14 @@ _install_binary() {
269272 _exit_failure " tar-not-found"
270273 fi
271274 tar -xzf " cargo-shuttle-$LATEST_VERSION -$target .tar.gz" || _exit_failure " tar-extract-binary"
272- echo " Installing to $HOME /.cargo/bin/cargo-shuttle"
273- mv " cargo-shuttle-$target -$LATEST_VERSION /cargo-shuttle" " $HOME /.cargo/bin/" || _exit_failure " move-binary"
274- echo " Installing to $HOME /.cargo/bin/shuttle"
275- mv " cargo-shuttle-$target -$LATEST_VERSION /shuttle" " $HOME /.cargo/bin/" || _exit_failure " move-binary"
275+ mkdir -p " $CARGO_INSTALL_BIN_DIR "
276+ echo " Installing to $CARGO_INSTALL_BIN_DIR /cargo-shuttle"
277+ mv " cargo-shuttle-$target -$LATEST_VERSION /cargo-shuttle" " $CARGO_INSTALL_BIN_DIR /" || _exit_failure " move-binary"
278+ echo " Installing to $CARGO_INSTALL_BIN_DIR /shuttle"
279+ mv " cargo-shuttle-$target -$LATEST_VERSION /shuttle" " $CARGO_INSTALL_BIN_DIR /" || _exit_failure " move-binary"
276280 popd > /dev/null || _exit_failure " popd"
277- if [[ " :$PATH :" != * " :$HOME /.cargo/bin :" * ]]; then
278- echo " Add $HOME /.cargo/bin to PATH to access the 'shuttle' command"
281+ if [[ " :$PATH :" != * " :$CARGO_INSTALL_BIN_DIR :" * ]]; then
282+ echo " Add $CARGO_INSTALL_BIN_DIR to PATH to access the 'shuttle' command"
279283 fi
280284}
281285
@@ -286,7 +290,9 @@ _install_rust_and_cargo() {
286290 case $yn in
287291 [Yy]* |" " )
288292 curl --proto ' =https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y || _exit_failure " install-rust"
289- source " $HOME /.cargo/env" # (this only affects this script's env, user has to source or restart shell to apply to their shell)
293+ # this only affects this script's env,
294+ # user has to source or restart shell to apply to their shell
295+ source " $CARGO_DIR /env"
290296 break
291297 ;;
292298 [Nn]* )
0 commit comments