From 3f86e60bbe1aa16c2a0a755a4a44aea200dde441 Mon Sep 17 00:00:00 2001 From: vv01f Date: Sun, 11 Aug 2019 11:36:53 +0200 Subject: [PATCH] enhances simple download and install for gopass --- get.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 get.sh diff --git a/get.sh b/get.sh new file mode 100755 index 0000000..6edc0e8 --- /dev/null +++ b/get.sh @@ -0,0 +1,20 @@ +#!/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 +}