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
nix/install: Rewrite to not rely on bashisms. #16
Conversation
Gets rid of [[ ... ]] and provides a fallback to "which" if the "type" builtin is not available. Also, this now longer relies on "set -e", because we're checking the errors carefully by ourselves and properly clean up whenever there was an error. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Older versions of tar didn't detect the compression type and thus tried to extract an uncompressed archive and even older versions of tar didn't even have the -j argument at all, so let's download, decompress and unpack in one go. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
3ec81f2
to
f84c795
Compare
Of course, the install script from Nix itself will use bash, but that's an entirely different case. The problem with the install instructions itself is that it even relied on bash for its "<()" syntax. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Is it actually a problem to rely on bashisms? The supported platforms (Linux, Darwin) generally have bash. BTW, the `wrap()' thingy is necessary to prevent execution of a partially downloaded script. |
Also, |
Indeed, And yes, on these platforms it's usually not a problem to rely on bashisms, but it shortens the installation command line by two characters and doesn't hurt if we one day should support platforms without bash :-) |
As @edolstra pointed out, this is to prevent execution of a partially downloaded script. So let's reintroduce the wrapper with a comment to make sure it won't be removed again. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Applied, thanks! |
Gets rid of
[[ ... ]]
and provides a fallback towhich
if thetype
builtin is not available.This now longer relies on "set -e", because we're checking the errors carefully by ourselves and properly clean up whenever there was an error.
Also, we no longer download into a temporary file but download, decompress and extract on the fly. The main reason for this is because older tar versions don't either detect the compression type or even do not have
-j
at all.