On a fresh Ubuntu 18.04 server, the getsubstrate.io installation fails due to a missing cargo command:
$ curl getsubstrate.io -sSf | bash
[...]
Setting up cmake (3.10.2-1ubuntu2) ...
Setting up binutils-x86-64-linux-gnu (2.30-21ubuntu1~18.04) ...
Setting up cpp (4:7.3.0-3ubuntu2.1) ...
Setting up binutils (2.30-21ubuntu1~18.04) ...
Setting up gcc-7 (7.3.0-27ubuntu1~18.04) ...
Setting up gcc (4:7.3.0-3ubuntu2.1) ...
Setting up dpkg-dev (1.19.0.5ubuntu2.1) ...
Setting up pkg-config (0.29.1-0ubuntu2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
sh: 0: Can't open -y
curl: (23) Failed writing body (0 != 9933)
bash: line 58: /root/.cargo/env: No such file or directory
bash: line 62: cargo: command not found
bash: line 63: cargo: command not found
Cloning into '/tmp/tmp.9SJRBJtn6q'...
remote: Enumerating objects: 41, done.
remote: Counting objects: 100% (41/41), done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 41 (delta 20), reused 24 (delta 10), pack-reused 0
Unpacking objects: 100% (41/41), done.
cp: target '/root/.cargo/bin' is not a directory
Run source ~/.cargo/env now to update environment
Installing cargo from the packages works but pulls in a rust compiler of insufficient version:
$ rustc --version
rustc 1.28.0
So Ubuntu users need to find another fancy way to get cargo+rustc
Ahh, looks like the script is supposed to install Rust, but it does not due to
sh: 0: Can't open -y
curl: (23) Failed writing body (0 != 9933)
The relevant code is
if ! which rustup >/dev/null 2>&1; then
curl https://sh.rustup.rs -sSf | sh -- -y
source ~/.cargo/env
else
rustup update
fi
In Ubuntu sh = /bin/sh = dash and it looks like dash does not support the -- notation. It is probably easier to replace sh by bash.
Hmm, this does not work as well :(
$ curl https://sh.rustup.rs -sSf | bash -- -y
bash: -y: No such file or directory
curl: (23) Failed writing body (0 != 9933)
No idea how to fix
Should be: curl https://sh.rustup.rs -sSf | sh -s -- -y
sh -s -- -y works on dash. Is the getsubstrate.io script in some repo to create a PR?
On _Linux Mint_ the Gav's one-liner ignores installation of _Linux_ dependencies because of next _dash_ error:
$ curl getsubstrate.io -sSf | sh
sh: 1: [[: not found
sh: 37: [[: not found
sh: 46: [[: not found
Unknown operating system.
This OS is not supported with this script at present. Sorry.
~...~
$ which sh
/bin/sh
$ ls -la /bin/sh
lrwxrwxrwx 1 root root 4 Apr 3 2018 /bin/sh -> dash
$
Using _bash_ instead of _sh_ produces another error:
$ curl getsubstrate.io -sSf | bash
Ubuntu/Debian Linux detected.
[sudo] password for vit:
stty: 'standard input': Inappropriate ioctl for device
Traceback (most recent call last):
File "/usr/local/bin/apt", line 71, in <module>
rows, columns = os.popen('stty size', 'r').read().split()
ValueError: not enough values to unpack (expected 2, got 0)
~...~
Adding next 2 magical lines on the top of original one-liner script resolves all problems:
#!/bin/bash
set -u
i added them now - a test would be welcome.
fixed, thanks
Most helpful comment
Should be:
curl https://sh.rustup.rs -sSf | sh -s -- -y