Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use UniFi's API to grab latest version #151

Open
shaneallgeier opened this issue Jun 27, 2019 · 4 comments
Open

Use UniFi's API to grab latest version #151

shaneallgeier opened this issue Jun 27, 2019 · 4 comments

Comments

@shaneallgeier
Copy link
Contributor

Hey guys, I recently discovered this API that the UniFi controller reaches out to check for updates. After some research & guessing, I ended up with this URL we can use to figure out the download link to the latest controller version:
https://fw-update.ubnt.com/api/firmware?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release&sort=-version&limit=1

Unfortunately, I don't have the knowledge to actually implement this into the script. I leave it to one of the many capable members of this repo. (Perhaps @joshyrobot since he has a related PR?)

@myfirstnameispaul
Copy link

Perhaps mention this over in the active pull request (#141) for this feature?

@DelphiGuy1
Copy link

Think this should work. Just update install script

UNIFI_SOFTWARE_URL=$(curl -s 'https://fw-update.ubnt.com/api/firmware?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release&sort=-version&limit=1' | jq '._embedded.firmware[0]._links.data.href' )
echo "Installing version - $UNIFI_SOFTWARE_URL";

Requirements are jq and curl.

Will post this over in request 141.

@mattiaskagstrom
Copy link

Isn't this just the firmware? it currently serves version 5.11.50 while the latest is 5.12.22

@the-wondersmith
Copy link

Adding an extra jq operation will get just the version number.

I'll open a PR in a bit to update the "official" installation script to be able to pull either a "known good", specific, or latest version from the Ubiquiti servers.

UNIFI_SOFTWARE_URL=$(curl -s 'https://fw-update.ubnt.com/api/firmware?filter=eq~~product~~unifi-controller&filter=eq~~platform~~unix&filter=eq~~channel~~release&sort=-version&limit=1' | jq '._embedded.firmware[0]._links.data.href' | jq -r 'match("(([\\d]+[.]){2}[\\d]+)").string');

echo "Installing version - ${UNIFI_SOFTWARE_URL}";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants