-
Notifications
You must be signed in to change notification settings - Fork 241
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
Add automatic version checking #141
Conversation
This is more of a base to work off of. Unfortunately adds dependency on `jq` and `curl`. I don't know FreeBSD or pfSense, but I noticed `fetch` was used to download the file. Maybe that could replace `curl`? The version fetching works great on Linux. Some other changes will need to be made, because you can no longer assume the version is valid.
This is great! We use fetch because historically it was included with FreeBSD/pfSense while curl was not. Curl is now included, but jq is not. So for your technique to work, we would need to fetch and install jq. We should also make sure this behaves correctly if and when UBNT changes the pages you’re scraping. I would suggest adding some error handling and or sensible fallback behavior, and a complete solution would also install jq before getting to this step. |
How should |
Automatic installation of dependencies is expected in most installation scripts. Install-time dependencies can be removed after install if they weren't present beforehand. |
Thanks to shaneallgeier for finding/posting the URL. 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' ) Requirements are jq and curl. |
@jmbwell I do not see the prompt as a negative thing, I think it is kind of necessary, however I will say this, that current API still redirects to the newest version under https://www.ui.com/download/unifi/ ... The current coding on this script however is not able to grab the version number automatically. I tried to add this modified script to another branch, and was unsuccessful in being able to get it to grab the version number. I even added JQ to be sure... I will work on this a little bit more, when I have some time. |
This is more of a base to work off of. Unfortunately adds dependency on
jq
andcurl
. I don't know FreeBSD or pfSense, but I noticedfetch
was used to download the file. Maybe that could replacecurl
? Some other changes will need to be made, because you can no longer assume the version is valid.