Approved

Check version of Firefox installed vs latest available

  REVIEWED by Sophos 

A quick and dirty query leveraging curl to get the latest version of Firefox from Mozilla.org and compare to the installed version.

Uses curl a bit too much, but I'm having trouble using "with" clauses and parsing that result, hopefully stay tuned for a slightly more efficient version!


SQL published at https://gist.github.com/andrewmundellsophos/37d5c1626704591c6d8f81969845be4e and below:

 

--Tested and working as of 2020-07-14
select
  version as Current,
  (
    select
      substr(
        result,(
          (
            select
              instr(result, 'data-latest-firefox=')
            from
              curl
            where
              url = 'https:' || '/' || '/' || 'www.mozilla.org/en-US/firefox/new/'
          ) + 21
        ),
        6
      ) as Latest
    from
      curl
    where
      url = 'https:' || '/' || '/' || 'www.mozilla.org/en-US/firefox/new/'
  ) as Latest
from
  programs
where
  name like '%firefox%'
  and version < (
    select
      substr(
        result,(
          (
            select
              instr(result, 'data-latest-firefox=')
            from
              curl
            where
              url = 'https:' || '/' || '/' || 'www.mozilla.org/en-US/firefox/new/'
          ) + 21
        ),
        6
      ) as Latest
    from
      curl
    where
      url = 'https:' || '/' || '/' || 'www.mozilla.org/en-US/firefox/new/'
  )