From a92d67f31b2f8359baf97eabb0833e17c59ba92f Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Mon, 21 Oct 2019 22:47:21 -0400 Subject: [PATCH] minor improvements --- go | 67 +++++++++++++++++++++++++++++++------------------------ pithosfly | 12 +++++++--- 2 files changed, 47 insertions(+), 32 deletions(-) diff --git a/go b/go index 9175d0c..eb86add 100755 --- a/go +++ b/go @@ -13,39 +13,48 @@ m() { printf "$pre %s\n" "$*"; "$@"; } e() { printf "$pre %s\n" "$*"; } err() { echo "[$(date +'%Y-%m-%d %H:%M:%S%z')]: $0: $*" >&2; } + m cd /a/opt/go.git -m git fetch -vers=($(git tag | sort -Vr | grep -E '^go[0-9.]+$' | head)) - -ver=${vers[0]} -dl() { - arch=$(dpkg --print-architecture) - f=${ver}.linux-${arch}.tar.gz - - if [[ -e $f ]]; then - timestamp=$(stat -c %Y $f) - else - timestamp=0 - fi - m wget -N https://dl.google.com/go/$f || ret=$? -} -dl -# 8 is return code for 404. for a new release, they might not have a binary out yet -if [[ $ret == 8 ]]; then - ver=${vers[1]} +# don't check for updates on go more than once a day +yesterday=$(( $(date +%s) - 60*60*24 )) +if (( $(stat -c %Y FETCH_HEAD) < yesterday )); then + m git fetch + touch ~/.local/gofetch + + vers=($(git tag | sort -Vr | grep -E '^go[0-9.]+$' | head)) + + ver=${vers[0]} + dl() { + arch=$(dpkg --print-architecture) + f=${ver}.linux-${arch}.tar.gz + + if [[ -e $f ]]; then + timestamp=$(stat -c %Y $f) + else + timestamp=0 + fi + m wget -N https://dl.google.com/go/$f || ret=$? + } dl -fi + # 8 is return code for 404. for a new release, they might not have a binary out yet + if [[ $ret == 8 ]]; then + ver=${vers[1]} + dl + fi + + new_timestamp=$(stat -c %Y $f) + if [[ $timestamp != $new_timestamp || ! -e /usr/local/go/bin/go ]]; then + m sudo rm -rf /usr/local/go + m sudo tar -C /usr/local -xzf $f + fi + + shopt -s nullglob + for x in go*.tar.gz; do + if [[ $x == $f ]]; then continue; fi + rm -fv $x + done -new_timestamp=$(stat -c %Y $f) -if [[ $timestamp != $new_timestamp || ! -e /usr/local/go/bin/go ]]; then - m sudo rm -rf /usr/local/go - m sudo tar -C /usr/local -xzf $f fi -shopt -s nullglob -for x in go*.tar.gz; do - if [[ $x == $f ]]; then continue; fi - rm -fv $x -done go get -u mvdan.cc/fdroidcl diff --git a/pithosfly b/pithosfly index 0856663..b28f6f6 100755 --- a/pithosfly +++ b/pithosfly @@ -6,15 +6,21 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR # pithosfly environment var is set in environment.sh +if type -t pithos &>/dev/null; then + exit 0 +fi + +# this doesn't update automatically, so + p -y build-dep pithos # other than pithos, based on failures pi pithos gstreamer1.0-plugins-ugly intltool python3-mutagen # from https://github.com/pithos/pithos/wiki/Installing-from-Source pi meson python3-gi python3-gi-cairo \ - gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \ - gir1.2-secret-1 libgdk-pixbuf2.0-dev libglib2.0-dev gnome-keyring appstream-util libappstream-glib-dev \ - python3-pylast gir1.2-appindicator3-0.1 gir1.2-keybinder-3.0 gnome-icon-theme-symbolic libxml2-utils gvfs + gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \ + gir1.2-secret-1 libgdk-pixbuf2.0-dev libglib2.0-dev gnome-keyring appstream-util libappstream-glib-dev \ + python3-pylast gir1.2-appindicator3-0.1 gir1.2-keybinder-3.0 gnome-icon-theme-symbolic libxml2-utils gvfs cd /a/opt/Pithosfly ./autogen.sh -- 2.30.2