Skip to content

Instantly share code, notes, and snippets.

@rafaelmartins
Last active April 15, 2018 15:11
Show Gist options
  • Save rafaelmartins/857aa806d90759deb5555e754fe2ddb7 to your computer and use it in GitHub Desktop.
Save rafaelmartins/857aa806d90759deb5555e754fe2ddb7 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Add this to your .travis.yml:
#
# script: curl -sSf https://yatr.rgm.io/run.sh | bash
#
set -e
I() {
if [[ "x${TRAVIS}" != "xtrue" ]]; then
echo "Not running on Travis-CI"
exit 1
fi
# travis only supports amd64
local arch="amd64"
local os="$(uname -s | tr '[:upper:]' '[:lower:]')"
local index="$(curl --silent https://distfiles.rgm.io/yatr/LATEST/)"
local archive="$(echo "${index}" | sed -n "s/.*\(yatr-${os}-${arch}-.*\)\.sha512.*/\1/p")"
local folder="$(echo "${index}" | sed -n "s/.*\(yatr-${os}-${arch}-.*\)\.tar.*\.sha512.*/\1/p")"
local p="$(echo "${folder}" | sed "s/yatr-${os}-${arch}-\(.*\)/yatr-\1/")"
curl --fail --silent --output "${archive}" "https://distfiles.rgm.io/yatr/${p}/${archive}"
curl --fail --silent --output "${archive}.sha512" "https://distfiles.rgm.io/yatr/${p}/${archive}.sha512"
sha512sum --check --status "${archive}.sha512"
tar --extract --file="${archive}"
exec "${folder}/yatr"
}
I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment