Skip to content

Instantly share code, notes, and snippets.

@111a5ab1
Last active February 3, 2018 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 111a5ab1/dae24a83bda3917cf07155a9a433a5d2 to your computer and use it in GitHub Desktop.
Save 111a5ab1/dae24a83bda3917cf07155a9a433a5d2 to your computer and use it in GitHub Desktop.
Query latest Ubiquiti USG firmware from command-line (depends: curl + jq)
#!/bin/bash
# Will output the latest firmware version and download URL for the Ubuqiti USG
# Depends on curl (https://curl.haxx.se/) and jq (https://stedolan.github.io/jq/)
curl -s 'https://www.ubnt.com/download/?group=usg' -H 'x-requested-with: XMLHttpRequest' | ./jq-osx-amd64 -c '[ .downloads[] | select(.category__slug=="firmware")] | max_by(.version) | {Version: .version, File: @text "https://dl.ubnt.com\(.file_path)" }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment