Skip to content
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

Add option for automatic installation. #297

Closed
TyOverby opened this issue Apr 12, 2016 · 6 comments · Fixed by #325
Closed

Add option for automatic installation. #297

TyOverby opened this issue Apr 12, 2016 · 6 comments · Fixed by #325

Comments

@TyOverby
Copy link

I'd like to be able to use multirust-rs on travis, but I can't because I need to answer "(Y/n)" to a question about if the install should proceed.

I can't even pipe the "yes" command into this because it reads directly from tty instead of stdin.

@brson
Copy link
Contributor

brson commented Apr 13, 2016

The next build will have a -y option that can be passed to both rustup-setup and rustup-setup.sh.

@TyOverby
Copy link
Author

Sounds good! So I'll be able to do something like this:

install:
    - curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh > ./multirust.sh
    - chmod +x ./multirust.sh
    - ./multirust.sh --yes

but using rustup instead of multirust?

@theronic
Copy link

theronic commented Dec 6, 2018

To install Rustup unattended:

curl https://sh.rustup.rs -sSf | sh -s -- -y

If you are SSH'd into a box, put nohup in front (for no hang-up).

aalemayhu added a commit to aalemayhu/dotfiles that referenced this issue Nov 28, 2019
Fixes the following build error

```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
2781info: downloading installer
2782rustup: Unable to run interactively. Run with -y to accept defaults, --help for additional options
2783Makefile:12: recipe for target 'install_rust' failed
```

Reference: rust-lang/rustup#297

Signed-off-by: Alexander Alemayhu <[email protected]>
@iranvir
Copy link

iranvir commented Feb 22, 2020

To install Rustup unattended:

curl https://sh.rustup.rs -sSf | sh -s -- -y

@theronic Can you please explain what sh -s -- -y does here? I tried to Google it but the individual description of sh -s , -- and -y doesn't seem to fit together to a coherent explanation.

@rbtcollins
Copy link
Contributor

sh -s Runs the stdin of sh as the script.

      -s stdin         Read commands from standard input (set automatically if no file arguments are present).  This option has no effect when set after the shell has already started running (i.e. with set).

-- is used to tell the shell that further arguments are not options:

     set [{ -options | +options | -- }] arg ...
            The set command performs three different functions.

            With no arguments, it lists the values of all shell variables.

            If options are given, it sets the specified option flags, or clears them as described in the section called Argument List Processing.  As a special case, if the option is -o or +o and no argument is supplied, the shell prints the settings of all its options.  If the option
            is -o, the settings are printed in a human-readable format; if the option is +o, the settings are printed in a format suitable for reinput to the shell to affect the same option settings.

            The third use of the set command is to set the values of the shell's positional parameters to the specified args.  To change the positional parameters without changing any options, use “--” as the first argument to set.  If no args are present, the set command will clear
            all the positional parameters (equivalent to executing “shift $#”.)

Thus the -y becomes passed to sh.rustup.rs as its first argument.

@iranvir
Copy link

iranvir commented Feb 22, 2020

Ah, so sh.rustup.rs takes arguments as well! That explain it.
Thank you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants