wasmer/scripts/binary-name.sh

47 lines
1.1 KiB
Bash
Raw Normal View History

2018-11-13 18:28:50 +00:00
#!/bin/sh
initArch() {
ARCH=$(uname -m)
if [ -n "$WASMER_ARCH" ]; then
ARCH="$WASMER_ARCH"
fi
# If you modify this list, please also modify install.sh
2018-11-13 18:28:50 +00:00
case $ARCH in
amd64) ARCH="amd64";;
x86_64) ARCH="amd64";;
aarch64) ARCH="arm64";;
2018-11-13 18:28:50 +00:00
i386) ARCH="386";;
*) echo "Architecture ${ARCH} is not supported by this installation script"; exit 1;;
esac
}
initOS() {
OS=$(uname | tr '[:upper:]' '[:lower:]')
if [ -n "$WASMER_OS" ]; then
echo "Using WASMER_OS"
OS="$WASMER_OS"
fi
case "$OS" in
darwin) OS='darwin';;
linux) OS='linux';;
freebsd) OS='freebsd';;
2019-04-11 22:00:02 +00:00
# mingw*) OS='windows';;
# msys*) OS='windows';;
2018-11-13 18:28:50 +00:00
*) echo "OS ${OS} is not supported by this installation script"; exit 1;;
esac
}
# identify platform based on uname output
initArch
initOS
# determine install directory if required
2019-04-11 22:00:02 +00:00
BINARY="wasmer-${OS}-${ARCH}.tar.gz"
2018-11-13 18:28:50 +00:00
# add .exe if on windows
2019-04-11 22:00:02 +00:00
# if [ "$OS" = "windows" ]; then
# BINARY="$BINARY.exe"
# fi
2018-11-13 18:28:50 +00:00
echo "${BINARY}"