#!/bin/sh # makit installer — https://makit.sh # # curl -fsSL https://makit.sh/install.sh | sh the latest release # curl -fsSL https://makit.sh/install.sh | sh -s -- v0.5.0 a given version # curl -fsSL https://makit.sh/v0.5.0/install.sh | sh the same, version in the URL # # This file only finds the version to install and hands over to that release's own install.sh on GitHub # (github.com/material-atomic/makit), which checks the downloaded source and the makit-core binary against the # release's SHA256SUMS before installing anything. # Read it first: curl -fsSL https://makit.sh/install.sh | less set -eu repo=material-atomic/makit version=${1:-${MAKIT_VERSION:-}} if [ "$(id -u)" -ne 0 ]; then echo "makit: run as root (sudo -i, then the same command)" >&2 exit 1 fi command -v curl >/dev/null 2>&1 || { echo "makit: curl is required (apt-get install -y curl)" >&2; exit 1; } command -v bash >/dev/null 2>&1 || { echo "makit: bash is required" >&2; exit 1; } if [ -z "$version" ] || [ "$version" = latest ]; then # github.com//releases/latest redirects to …/releases/tag/ (no API rate limit). latest=$(curl -fsSLI -o /dev/null -w '%{url_effective}' "https://github.com/$repo/releases/latest" || true) version=${latest##*/} fi case $version in v[0-9]*) ;; [0-9]*) version="v$version" ;; *) echo "makit: could not find the version to install — pass one: … | sh -s -- v0.5.0" >&2; exit 1 ;; esac case $version in *[!0-9A-Za-z.-]*) echo "makit: '$version' is not a version" >&2; exit 1 ;; esac # The tag must exist: a typo should fail here, not halfway through the install. if ! curl -fsSLI -o /dev/null "https://github.com/$repo/releases/tag/$version"; then echo "makit: there is no release $version — see https://github.com/$repo/releases" >&2 exit 1 fi echo "makit: installing $version from https://github.com/$repo" curl -fsSL "https://raw.githubusercontent.com/$repo/$version/install.sh" | MAKIT_VERSION="$version" bash