minor improvements
authorIan Kelling <iank@fsf.org>
Tue, 22 Oct 2019 02:47:21 +0000 (22:47 -0400)
committerIan Kelling <iank@fsf.org>
Tue, 22 Oct 2019 02:47:21 +0000 (22:47 -0400)
go
pithosfly

diff --git a/go b/go
index 9175d0cd00c5496e9cad49abb2fcfdf11efab699..eb86add76d56653f26c924a8a23490657add80fa 100755 (executable)
--- 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
index 085666325e829b3fb06817441905ec325d88baa6..b28f6f61043aaf91e9ab23afe3a455dec0abc857 100755 (executable)
--- 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