site  contact  subhomenews

Strategy to find the latest AppImage file

March 29, 2023 — BarryK

I posted about the problem in the previous post, and showed how the 'lastversion' utility can find the latest version -- except when it can't:

https://bkhome.org/news/202303/bug-fixes-for-appimage-installer.html

There is another utility, 'ghrel', that works where 'lastversion' has failed:

https://github.com/jreisinger/ghrel

...but that is an example of why I stay away from anything written in Go; the binary executable, stripped, is 4.7MB. Which, for a utility app, is ridiculous.

I am unable to provide automatic updating for some AppImages, even though the latest can be seen in the web browser. For example:

img1

...there it is, right in front of the eyes, yet reading it programmatically can be difficult. Notice the URL ".../tag/stable"; with many github projects, that has the version number, say "../tag/v1.2.3", but that is a convention, not required; it can be anything. Well, we can see the version number in the .AppImage name, except that can be very difficult to programmatically read -- besides, the naming of the .AppImage file is entirely up to the developer -- it could be "zoom-X86_64.AppImage" for example, without any version number.

With all of this variability, can may be very difficult to even determine if there is a later version than the one you already have installed.

However, as I stated above, the information we want is right there in front of the eyes. We need a method to lift that information off the webpage. Incidentally, if you were to save the webpage, and open in a text editor, the .AppImage filename is no longer there -- that is due to the dynamic manner in which the page is rendered.

So, I figured out a solution, using good old 'xdotool'. Wrote a little script:

#!/bin/sh
WID="$(xdotool search --onlyvisible --title "probonopd/Zoom.AppImage")"
xdotool windowfocus $WID
sleep 1
xdotool key --window $WID ctrl+a ctrl+c
xclip -selection clipboard -o > out.txt

From the man page, xdotool has the "--sync" option, that would be useful, but my version doesn't support it, hence the "sleep 1".

And here is part of 'out.txt' file:

Assets 3
Zoom-5.14.0.1720.glibc2.17-x86_64.AppImage
227 MB
3 days ago

That's great, we now have the latest .AppImage file. And the size.

For updating, determining if it is a later version that is already installed can be tricky. If the version isn't in the URL, see if it is in the .AppImage filename, failing that, fall back to the date -- "3 days ago" -- which will need some processing to calculate the actual date.

The intention is to incorporate this into AppImage Installer ("Appi").

Note: xdotool does not work with wayland. There is another utility, 'dotool', that does work with wayland, but I know nothing about its capabilities. Just info for readers of this blog -- I have no intention of migrating to wayland.      

Tags: easy