Skip to content

Commit

Permalink
Make the install script verify the checksum automatically (#104)
Browse files Browse the repository at this point in the history
* Make the install script verify the checksum automatically

* Remove rm -rf in install script
  • Loading branch information
pior committed Jun 5, 2018
1 parent cba23ee commit 166d8d0
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/usr/bin/env bash
set -eu

VERSION="v0.3.0"
VERSION="v0.4.0"
DEST="/usr/local/bin"
SHELL_LINE='eval "$(bud --shell-init --with-completion)"'

YELLOW="\033[1;33m"
BLUE="\033[1;34m"
CYAN="\033[1;36m"
WHITE="\033[1;37m"
CODE="\033[44m\033[1;37m"
LINK="\033[4m\033[1;34m"
Expand Down Expand Up @@ -55,22 +54,20 @@ instructions() {
main() {
banner

TMPDIR=$(mktemp -d)
cd "${TMPDIR}"

header "Downloading binary from Github"
URL="https://github.com/devbuddy/devbuddy/releases/download/${VERSION}/bud-$(make_variant)"
TMPFILE=`mktemp`
curl -L -# --fail "${URL}" -o "${TMPFILE}"
BINARY="bud-$(make_variant)"
URL="https://github.com/devbuddy/devbuddy/releases/download/${VERSION}/${BINARY}"
curl -L -# --fail "${URL}" -o "${BINARY}"
curl -L -# --fail "${URL}.sha256" -o "${BINARY}.sha256"

header "Downloading SHA from Github"
expected_hash=$(curl -LsS --fail "${URL}.sha256")
downloaded_hash=$(shasum -a 256 "${TMPFILE}")
echo "Expected hash : ${expected_hash}"
echo "Downloaded hash : ${downloaded_hash}"
read -p "Correct? [enter]"
header "Verify SHA256 checksum"
shasum -c "${BINARY}.sha256"

header "Installing to ${DEST}"
sudo install "${TMPFILE}" "${DEST}/bud"

[[ -e "${TMPFILE}" ]] && unlink "${TMPFILE}"
sudo install "${BINARY}" "${DEST}/bud"

instructions
}
Expand Down

0 comments on commit 166d8d0

Please sign in to comment.