works for now
This commit is contained in:
parent
140f74c408
commit
756a8210d2
|
@ -0,0 +1,5 @@
|
||||||
|
*SHA256SUMS
|
||||||
|
*.gz
|
||||||
|
*.deb
|
||||||
|
*.rpm
|
||||||
|
*.sig
|
42
get.sh
42
get.sh
|
@ -1,31 +1,53 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
#~ if ! "$1" = "run"; then
|
||||||
|
#~ printf "stilly buggy!\n" ; exit 0;
|
||||||
|
#~ fi
|
||||||
|
|
||||||
|
#~ wget -q -O- https://api.bintray.com/orgs/gopasspw/keys/gpg/public.key | sudo apt-key add -
|
||||||
|
#~ echo "deb https://dl.bintray.com/gopasspw/gopass buster main" | sudo tee /etc/apt/sources.list.d/gopass.list
|
||||||
|
|
||||||
|
echo "collecting system information"
|
||||||
|
arch=$(uname --machine)
|
||||||
|
if test "${arch}" = "x86_64"; then
|
||||||
|
arch="amd64"
|
||||||
|
fi
|
||||||
# get recent release version
|
# get recent release version
|
||||||
uname=$(uname -a)
|
uname=$(uname -a)
|
||||||
echo $uname|grep -i "debian" && { fn_suffix="linux-amd64.deb"; }
|
echo $uname|grep -i "debian" >/dev/null && { fn_suffix="linux_${arch}.deb"; }
|
||||||
echo $uname|grep -i "openbsd" && { fn_suffix="openbsd-amd64.tar.gz"; }
|
echo $uname|grep -i "openbsd" >/dev/null && { fn_suffix="openbsd_${arch}.tar.gz"; }
|
||||||
echo $uname|grep -i "freebsd" && { fn_suffix="freebsd-amd64.tar.gz"; }
|
echo $uname|grep -i "freebsd" >/dev/null && { fn_suffix="freebsd_${arch}.tar.gz"; }
|
||||||
test -z $fn_suffix && { echo "operating system not supported."; exit 1; }
|
test -z $fn_suffix && { echo "operating system not supported."; exit 1; }
|
||||||
|
echo "fn_suffix: "${fn_suffix}
|
||||||
|
|
||||||
|
echo "check online resources"
|
||||||
url_effective=$(curl -sLI -o /dev/null -w %{url_effective} https://github.com/gopasspw/gopass/releases/latest)
|
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\//')"/"
|
url=$(echo ${url_effective} | sed 's/\/tag\//\/download\//')"/"
|
||||||
ver=$(echo -n $url | cut -d'/' -f8 | cut -d"v" -f2)
|
ver=$(echo -n $url | cut -d'/' -f8 | cut -d"v" -f2)
|
||||||
|
|
||||||
|
# https://github.com/gopasspw/gopass/releases/download/v1.14.9/gopass_1.14.9_linux_amd64.deb
|
||||||
fn1="gopass"
|
fn1="gopass"
|
||||||
fn_package=${fn1}"-"${ver}"-"${fn_suffix}
|
fn_package=${fn1}"_"${ver}"_"${fn_suffix}
|
||||||
fn_SHA256=${fn1}"_"${ver}"_SHA256SUMS"
|
fn_SHA256=${fn1}"_"${ver}"_SHA256SUMS"
|
||||||
|
|
||||||
# download files: deb and checksums
|
# download files: deb and checksums
|
||||||
curl -L $url$fn_package -o $fn_package || { echo "download failed"; exit 1; }
|
echo "downloading files"
|
||||||
curl -L $url$fn_SHA256 -o $fn_SHA256 || { echo "download failed"; exit 1; }
|
curl -s --progress-bar -L $url$fn_package -o $fn_package || { echo "download failed"; exit 1; }
|
||||||
|
curl -s --progress-bar -L $url$fn_SHA256 -o $fn_SHA256 || { echo "download failed"; exit 1; }
|
||||||
|
curl -s --progress-bar -L $url$fn_SHA256".sig" -o $fn_SHA256".sig" || { echo "download failed"; exit 1; }
|
||||||
|
|
||||||
|
test $(du $fn_package|cut -f1) -gt 1024 || { echo "manually check small file before installation."; exit 1; }
|
||||||
|
|
||||||
|
|
||||||
# test checksums
|
# test checksums
|
||||||
$(cat ${fn_SHA256} |grep $$(sha256sum $fn_package)) && {
|
shahash="$(sha256sum $fn_package)"
|
||||||
|
cat "${fn_SHA256}" |grep "${shahash}" >/dev/null && {
|
||||||
# test filesize, didnt see any near 10 MB
|
# test filesize, didnt see any near 10 MB
|
||||||
test $(du $fn_SHA256) -lt 10240 || { echo "manually check exceptionally large file before installation."; exit 1; }
|
test $(du $fn_SHA256|cut -f1) -lt 10240 || { echo "manually check exceptionally large file before installation."; exit 1; }
|
||||||
# maybe install
|
# maybe install
|
||||||
case $(echo $fn_suffix|cut -d"-" -f1) in
|
case $(echo $fn_suffix|cut -d"_" -f1) in
|
||||||
linux)
|
linux)
|
||||||
sudo dpkg -i ${fn_package}
|
echo "installing with dpkg"
|
||||||
|
sudo dpkg -i "${fn_package}"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
Loading…
Reference in New Issue