latest-gopass/get.sh

21 lines
758 B
Bash
Executable File

#!/usr/bin/env sh
# get recent release version
url_effective=$(curl -sLI -o /dev/null -w %{url_effective} https://github.com/gopasspw/gopass/releases/latest)
url=$(echo ${url_effective} | sed 's/\/tag\//\/download\//')"/"
ver=$(echo -n $url | cut -d'/' -f8 | cut -d"v" -f2)
fn1="gopass"
fn_deb=${fn1}"-"${ver}"-linux-amd64.deb"
fn_SHA256=${fn1}"_"${ver}"_SHA256SUMS"
# download files: deb and checksums
curl -L $url$fn_deb -o $fn_deb || { echo "download failed"; exit 1; }
curl -L $url$fn_SHA256 -o $fn_SHA256 || { echo "download failed"; exit 1; }
# test checksums
test $(cat ${fn_SHA256} |grep ${fn_deb} |cut -d" " -f1) = $(sha256sum gopass-1.8.6-linux-amd64.deb|cut -d" " -f1) && {
# install
sudo dpkg -i $fn
} || {
echo "checksum failed"#; exit 1
}