Skip to content

Commit

Permalink
fix: install script gets the latest release
Browse files Browse the repository at this point in the history
  • Loading branch information
adikari committed Oct 4, 2022
1 parent d89a687 commit 1ca79d1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
# option. This file may not be copied, modified, or distributed
# except according to those terms.

# Example to bypass binary overwrite [y/N] prompt
# curl -sSL https://raw.githubusercontent.com/adikari/safebox/main/scripts/install.sh | sh

set -u

BINARY_DOWNLOAD_PREFIX="https://github.com/adikari/safebox/releases/download"
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/'
}

PACKAGE_VERSION="1.0.1"
BINARY_DOWNLOAD_PREFIX="https://github.com/adikari/safebox/releases/download"
PACKAGE_VERSION=$(get_latest_release adikari/safebox)

download_binary_and_run_installer() {
downloader --check
Expand All @@ -39,8 +43,8 @@ download_binary_and_run_installer() {
esac

local _current_dir=$(pwd)
local _tardir="safebox_$PACKAGE_VERSION"_"${_arch}"
local _url="$BINARY_DOWNLOAD_PREFIX/v$PACKAGE_VERSION/${_tardir}.tar.gz"
local _tardir="safebox_${PACKAGE_VERSION:1}"_"${_arch}"
local _url="$BINARY_DOWNLOAD_PREFIX/$PACKAGE_VERSION/${_tardir}.tar.gz"
local _dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t test)"
local _file="$_dir/input.tar.gz"
local _safebox="$_dir/safebox$_ext"
Expand Down

0 comments on commit 1ca79d1

Please sign in to comment.