#!/usr/bin/env bash apt install -y golang-go cd /var/tmp || exit USER="k3d-io" PROJECT="k3d" PRERELEASE="false" DOWNLOAD_DIR=/tmp ## FIXME # The api.github.com json has alpha releases at the top so here we are trying to exclude names containing the word alpha #RELEASE=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq '[ .[] | select(.name|test("alpha.") | not) ] | .[0] | .name') # Select name directly [v followed by dots and digits only], rather than by 'not alpha': RELEASE=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq '[ .[] | select(.name|test("v[[:digit:].]+$"))]|.[0] | .name') RSS_FEED="https://github.com/${USER}/${PROJECT}/releases.atom" # xdg-open ${RSS_FEED} echo ${RSS_FEED} # strip speech marks and preceding 'v' VERSION=$(echo ${RELEASE} | tr -d '"' | tr -d "v") echo $VERSION ## FIXME: Maake condition on alpha being in the RELEASE name. #name "v3.0.0-alpha.1" has the preceding 'v' removed and is split on '-' to give: #VERSION=$(echo "${RELEASE}" | cut -c 2- | cut -f1 -d"-") #RELEASE=$(echo "${RELEASE}" | cut -c 2- | cut -f2 -d"-") # Delete these two when you've fixed the jq above #VERSION=1.6.0 DEB_RELEASE=1 # make a containing directory mkdir -p /var/tmp/k3d-"${VERSION}" cd /var/tmp/k3d-"${VERSION}" || exit cat >./description-pak <./checkinstall_it.sh <./install-it.sh <