-
Notifications
You must be signed in to change notification settings - Fork 13.5k
rustup: Add option to skip download #21138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pcwalton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see CONTRIBUTING.md for more information. |
download_package \ | ||
"${RUST_URL}/${RUST_TARBALL_NAME}" \ | ||
"${RUST_LOCAL_TARBALL}" | ||
if [ "${CFG_SKIP_DOWNLOAD}" != 1 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you change this to:
if [ -z "${CFG_SKIP_DOWNLOAD}" ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
@mkpankov thanks a lot for your patch. is rustup actually re-downloading things even when the tarball is present? The |
@flaper87 the actual problem is verify_hash. Should I check if |
Should be fine now. I now check if I tested it in offline mode, specifying both |
local_file="$2" | ||
local_sha_file="${local_file}.sha256" | ||
|
||
if [ -n "${CFG_SAVE}" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since download_hash
already checks on "${CFG_SAVE}"
I believe this could become:
if [ -f "${local_sha_file}" ]; then
....
else
download_hash
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, currently download_hash
can be called when ${CFG_SAVE}
is both specified or not specified.
In case of specified, if file exists, we use that. If file doesn't exist, we download it to compare with, and save for future use.
In case ${CFG_SAVE}
is specified, we download the file anyway and don't save it since it's not requested.
Simplifying to suggested variant would mean we check existence of saved file when ${CFG_SAVE}
wasn't specified at all. I believe we shouldn't look at local files when saving wasn't requested.
@mkpankov thanks for updating the patch. Would you mind squashing these commits into 1? |
This way installer can work fully in offline mode. Put pre-downloaded files (rust-nightly-x86_64-unknown-linux-gnu.tar.gz and rust-nightly-x86_64-unknown-linux-gnu.tar.gz.sha256) into the $HOME/.rustup/YYYY-MM-DD directory as it would be done by script itself. Specify --save and --date=YYYY-MM-DD when running. Files will be picked up and used to install in offline mode.
@flaper87 I squashed everything, fixing stuff you pointed out but leaving the two calls to |
@mkpankov awesome, thanks for contributing! |
@bors: rollup |
When combined with '--save' and '--date', it uses previously saved tarball, making possible to re-install in offline mode. r?
When combined with '--save' and '--date', it uses previously saved
tarball, making possible to re-install in offline mode.
r?