enhances simple download and install for gopass

This commit is contained in:
vv01f 2019-08-11 11:36:53 +02:00
commit 3f86e60bbe
Signed by untrusted user who does not match committer: vv01f
GPG Key ID: 02625A16AC1D1FF6
1 changed files with 20 additions and 0 deletions

20
get.sh Executable file
View File

@ -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
}