diff --git a/README.md b/README.md index d60673ff..76ac55da 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,13 @@ You can download the latest release of `gale` from the [releases page](https://g or you can install `gale` using: ```bash! -curl https://raw.githubusercontent.com/aweris/gale/main/hack/install_gale.sh | sh +curl -sfLo install.sh https://raw.githubusercontent.com/aweris/gale/main/hack/install.sh; sh ./install.sh ``` The following command will install latest version of `gale` to your current directory. You can also specify following environment variables, -- `VERSION` to specify the version of `gale` to install, e.g. `VERSION=v0.0.1` default is `latest` -- `INSTALL_DIR` to specify the directory to install `gale` to, e.g. `INSTALL_DIR=/usr/local/bin` default is current directory +- `GALE_VERSION` to specify the version of `gale` to install, e.g. `GALE_VERSION=v0.0.1` default is `latest` +- `BIN_DIR` to specify the directory to install `gale` to, e.g. `BIN_DIR=/usr/local/bin` default is current directory ```bash! curl https://raw.githubusercontent.com/aweris/gale/main/hack/install_gale.sh | sudo VERSION=v0.0.1 INSTALL_DIR=/usr/local/bin sh diff --git a/hack/install_gale.sh b/hack/install.sh similarity index 69% rename from hack/install_gale.sh rename to hack/install.sh index 0d4db4d1..af107545 100755 --- a/hack/install_gale.sh +++ b/hack/install.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash RELEASE=$(curl -s "https://api.github.com/repos/aweris/gale/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') -VERSION="${VERSION:-${RELEASE}}" -INSTALL_DIR="${INSTALL_DIR:-.}" +GALE_VERSION="${GALE_VERSION:-${RELEASE}}" +BIN_DIR="${BIN_DIR:-.}" function install_gale() { local version=$1 @@ -13,11 +13,11 @@ function install_gale() { echo "Downloading ${download_url}" - curl -sL "${download_url}" | tar xz -C "${INSTALL_DIR}" + curl -sL "${download_url}" | tar xz -C "${BIN_DIR}" - echo "Installed gale ${version} to ${INSTALL_DIR}" + echo "Installed gale ${version} to ${BIN_DIR}" - "${INSTALL_DIR}/gale" version + "${BIN_DIR}/gale" version echo "Done." } @@ -29,12 +29,12 @@ function main() { local arch arch=$(uname -m | tr '[:upper:]' '[:lower:]') - if [[ -z "${VERSION}" ]]; then + if [[ -z "${GALE_VERSION}" ]]; then echo "failed to get latest version from GitHub API" exit 1 fi - install_gale "${VERSION}" "${os}" "${arch}" + install_gale "${GALE_VERSION}" "${os}" "${arch}" } main "$@" \ No newline at end of file