Download latest version without sepcifying version number

Is there any way to download the latest Arduino IDE without explicitly specifying the version number?

I have a script that does some software installation (Raspberry Pi) and one function is to download Arduino and make some
modifications to the setup. At the moment, I have to specify what version of Arduino I'm downloading so the script can do its thing. It would be nice if I could, for example, just tell my script to get the latest available and use the version info from the download to do its necessary editing.
Just trying ot make my script as fool proof as possible. If users don't have to specify the version, all the better.

Regards
Geoff

The solution I found is to determine the latest version from the Git tags, then use that to build the download URL:

git init Arduino  # create empty local repo
cd Arduino
git remote add origin https://github.com/arduino/Arduino.git
git ls-remote --tags --refs | grep --regexp='refs/tags/[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*.*' | tail -1 | cut -d '/' -f 3 # get the last of a list all lightweight tags in semver format in the remote repo

There is a request for Arduino to provide latest version links:

There is a file that is supposed to contain the latest IDE version:
https://www.arduino.cc/latest.txt
but it doesn't always get updated so I wouldn't count on it.

Thanks for the quick and useful reply.

The issue mentioned (7071) seems to be asking for exactly what I'm after.
Didn't think about git - so used to just downloading the zip file. I'll work on incorporating that in my script.

[The program on the Pi replaces avrdude with a script that preforms an autoreset via the GPIO. Quite a few places in the script that have the version hard-coded and I want to remove that]

Regards
Geoff

EDIT: Runing the comand you provided returns 1.8.9 instead of 1.8.10 so I need to tweak the grep (or sort the output)

Geoff_S:
Is there any way to download the latest Arduino IDE without explicitly specifying the version number?
...
...
Just trying ot make my script as fool proof as possible. If users don't have to specify the version, all the better.

This means that you don't care if there are different versions on those user's computers. I mean (as an example), you installed yesterday for a user and the latest version was 1.8.9 and you install today for another user and the latest version is 1.8.10. So now you have a user base that uses different versions. Not my cup-of-tea :wink:

Personally, I would standardise on a specific version that's known to be OK; remember that newer is not always better. I did use 1.6.6 for a long time and upgraded to 1.8.5 a number of months after it became available and there were no massive issues.

sterretje:
This means that you don't care if there are different versions on those user's computers. I mean (as an example), you installed yesterday for a user and the latest version was 1.8.9 and you install today for another user and the latest version is 1.8.10. So now you have a user base that uses different versions. Not my cup-of-tea :wink:

Personally, I would standardise on a specific version that's known to be OK; remember that newer is not always better. I did use 1.6.6 for a long time and upgraded to 1.8.5 a number of months after it became available and there were no massive issues.

The script I'm writing is only run once during initial set-up of the Pi Any software updates are done separately as required, this includes arduino IDE. Once the system and software is set up, access is via a web browser. [application is laserweb4. The arduino IDE is installed so a new version of grbl an be compiled and loaded onto the attached arduino hardware. This won't be done by the typical user]

Geoff_S:
EDIT: Runing the comand you provided returns 1.8.9 instead of 1.8.10 so I need to tweak the grep (or sort the output)

Thanks for pointing that out. It was sorting 1.8.10 after 1.8.1. I fixed it by adding the --sort=version:refname option.

git ls-remote --quiet --tags --refs --sort=version:refname | grep --regexp='refs/tags/[0-9]\+\.[0-9]\+\.[0-9]\+\(\(-.*$\)\|$\)' | tail -1 | cut -d '/' -f 3 # get the last of a list of all lightweight tags in semver format in the remote repo

Thanks pert
Much better than I had - a sort -k2n,2n -k3n,3n - prior to the head command.

Must leanr more git commands...

Regards
Geoff