Add a bootstrap-haskell script, fixes #36
Merge request reports
Activity
@m-renaud please try the latest version
@hasufell tried it out just now, works great other than the "wait for input not working".
I downloaded the script to a local file and ran
cat bootstrap-haskell | sh
and it printed the prompt to press enter to continue, but continued along with actually waiting for input.If I change the script to be executable (
chmod +x bootstrap-haskell
) and then./bootstrap-haskell
it works as expected. It looks likeread
has different behaviour if its piped intosh
instead of being run as a script as part of a pipeline (see this SO answer).So, it looks like our options are either:
- Use the workaround provided there (3 commands, messier, -1 from me)
- Don't prompt, just install.
My vote would be for (2), if they're on the ghcup site they already know what it does. At the bottom we could give instructions for how to uninstall ghcup (namely,
rm -rf ~/.ghcup
), or we could also provide aghcup uninstall
command which does the right thing. I think for an initial version just providing instructions would be sufficient.Also, I noticed that the script runs
_edo ghcup set
which just prints the usage of the command at the bottom:Done installing, run "ghci-8.4.4" or set up your current GHC via: ghcup set 8.4.4 ghcup set ghcup-set Set the currently active GHC to the specified version USAGE: ghcup set [FLAGS] <VERSION> FLAGS: -h, --help Prints help information ARGS: <VERSION> E.g. "8.4.3" or "8.6.1" DISCUSSION: Sets the the current GHC version by creating non-versioned symlinks for all ghc binaries of the specified version in "~/.ghcup/bin/<binary>".
Was that intentional?
Also, I noticed that the script runs
_edo ghcup set
which just prints the usage of the command at the bottom:That's because you are upgrading to an older version while the script is running. See what the travis.sh does.
I noticed you commented out some of the llvm deps in the travis config, what's the rationale behind that? It looks like it may be the cause of the issue.
Why do you think that? It's gold linker messup afais and GHC just picks up whatever it wants.
Also, I just realized that by running just
ghcup set
returns a status code of1
meaning thatcabal-install
is never installed.See above, you're upgrading to an older version while running the script. Set
BOOTSTRAP_HASKELL_NO_UPGRADE=1
.If I change the script to be executable (
chmod +x bootstrap-haskell
) and then./bootstrap-haskell
it works as expected. It looks likeread
has different behaviour if its piped intosh
instead of being run as a script as part of a pipeline (see this SO answer).Will look into it.
Sorry, I don't think I was very clear in my previous comment, either that or I didn't follow your response.
When I pipe the
bootstrap-haskell
script thoughsh
it doesn't complete successfully. It installs ghc but then fails at the next step:... Done installing, run "ghci-8.4.4" or set up your current GHC via: ghcup set 8.4.4 ghcup set ghcup-set Set the currently active GHC to the specified version USAGE: ghcup set [FLAGS] <VERSION> FLAGS: -h, --help Prints help information ARGS: <VERSION> E.g. "8.4.3" or "8.6.1" DISCUSSION: Sets the the current GHC version by creating non-versioned symlinks for all ghc binaries of the specified version in "~/.ghcup/bin/<binary>". $ echo $? 2
The bootstrap-haskell script has the line
_edo ghcup set
which is incorrect usage, causing the script to exit early and never run_edo ghcup install-cabal
or any of the other commands below it.Shouldn't it be
_edo ghcup set 8.4.4
?The bootstrap-haskell script has the line
_edo ghcup set
which is incorrect usage, causing the script to exit early and never run_edo ghcup install-cabal
or any of the other commands below it.Shouldn't it be
_edo ghcup set 8.4.4
?No, the line is correct, I already explained it: You're upgrading to an older version while running the script. Set BOOTSTRAP_HASKELL_NO_UPGRADE=1 (after you've copied the script from this PR). Also see the commits of this PR.
No, the line is correct...
Ah, yes you're right. I see where my confusion came from: I hadn't realized that there was a required change to
ghcup
in this PR to makeghcup set
auto-discover the version to use if no arguments are passed. I had just pulled down a copy of the bootstrap script, not the updatedghcup
so theghcup
that was being downloaded and used obviously didn't have this change so was erroring out. Sorry about the noise.