diff options
author | Johannes Climacus <johannesclimacus@tuta.io> | 2019-05-25T09·06-0400 |
---|---|---|
committer | Johannes Climacus <johannesclimacus@tuta.io> | 2019-05-29T14·08-0400 |
commit | a8251ba2ed9e833ef3e8b20d233064aba74446db (patch) | |
tree | 9df141e570b1e6b7c6b2876923fdf3251aa6cacb /scripts | |
parent | 17ef3e6f411b2cf1fa87593ad84bc2a94a1edd93 (diff) |
Replace `type` with `command -v` in install script
In POSIX sh, `type` is undefined. cf. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html#tag_20_22_04
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/install.in | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/install.in b/scripts/install.in index 7bff7b216d9e..4857638c0265 100644 --- a/scripts/install.in +++ b/scripts/install.in @@ -18,7 +18,7 @@ cleanup() { trap cleanup EXIT INT QUIT TERM require_util() { - type "$1" > /dev/null 2>&1 || command -v "$1" > /dev/null 2>&1 || + command -v "$1" > /dev/null 2>&1 || oops "you do not have '$1' installed, which I need to $2" } @@ -41,11 +41,11 @@ require_util tar "unpack the binary tarball" echo "downloading Nix @nixVersion@ binary tarball for $system from '$url' to '$tmpDir'..." curl -L "$url" -o "$tarball" || oops "failed to download '$url'" -if type sha256sum > /dev/null 2>&1; then +if command -v sha256sum > /dev/null 2>&1; then hash2="$(sha256sum -b "$tarball" | cut -c1-64)" -elif type shasum > /dev/null 2>&1; then +elif command -v shasum > /dev/null 2>&1; then hash2="$(shasum -a 256 -b "$tarball" | cut -c1-64)" -elif type openssl > /dev/null 2>&1; then +elif command -v openssl > /dev/null 2>&1; then hash2="$(openssl dgst -r -sha256 "$tarball" | cut -c1-64)" else oops "cannot verify the SHA-256 hash of '$url'; you need one of 'shasum', 'sha256sum', or 'openssl'" |