EA to determine if user has Firefox vs Firefox ESR installed?

donmontalvo
Esteemed Contributor II

Looking for an EA that can distinguish between Firefox (mainline) and Firefox ESR.

Google Chrome provides a key that tells you if user has Google Chrome installed or Google Chrome For Work installed. Located in /Applications/Google Chrome.app/Contents/Info.plist:

cddb64b693e748829ff847535b187958

We know ESR has its own release cycle, and unique versioning philosophy. But there doesn't seem to be a difference in Info.plist.

I plan to submit a feature request, to ask for a key to be used, similar to what Google is doing.

In the mean time, wondered how folks here telling whether user has Firefox ESR or not?

PS, already have EA to tell if config files are in the Firefox.app bundle, but that won't help us if someone is running mainline release with config files.

Don

--
https://donmontalvo.com
2 ACCEPTED SOLUTIONS

mm2270
Legendary Contributor II

Aha! I found something! This should do it.

#!/bin/sh

## Get release of Firefox (Release or ESR)

if [ -d "/Applications/Firefox.app" ]; then
    Type=$(awk -F'-' '/SourceRepository/{print $NF}' /Applications/Firefox.app/Contents/Resources/application.ini)
else
    Type="N/A"
fi

case "$Type" in
    esr*)
    result="Firefox ESR" ;;
    release)
    result="Firefox Mainline" ;;
    N/A)
    result="Not Installed" ;;
    *)
    result="Unknown" ;;
esac

echo "<result>$result</result>"

So basically, the application.ini file does indicate the app bundle's SourceRepository on one of the lines, which can easily be read in the script. Voila! I'm glad you brought this up again, since I can now incorporate this into one of my own scripts.

edited the script

View solution in original post

sean
Valued Contributor

FWIW, It's also in the Resources/defaults/pref/channel-prefs

Either:

pref("app.update.channel", "esr")
or
pref("app.update.channel", "release")

awk -F """ '/app.update.channel/ {print $(NF-1)}' /Applications/Firefox.app/Contents/Resources/defaults/pref/channel-prefs.js

View solution in original post

12 REPLIES 12

mm2270
Legendary Contributor II

I had looked into this myself once, not because we use Firefox ESR here, but because I was trying to determine the difference for a script I have. Unfortunately, I came up empty at the time. The two applications look exactly the same to a script, and in the Finder, etc. There's really no distinction other than the actual version number, but obviously you can't just go by the version number.

I'll take another peak at this and see if there's something that you can use, but it doesn't look hopeful.

mm2270
Legendary Contributor II

Aha! I found something! This should do it.

#!/bin/sh

## Get release of Firefox (Release or ESR)

if [ -d "/Applications/Firefox.app" ]; then
    Type=$(awk -F'-' '/SourceRepository/{print $NF}' /Applications/Firefox.app/Contents/Resources/application.ini)
else
    Type="N/A"
fi

case "$Type" in
    esr*)
    result="Firefox ESR" ;;
    release)
    result="Firefox Mainline" ;;
    N/A)
    result="Not Installed" ;;
    *)
    result="Unknown" ;;
esac

echo "<result>$result</result>"

So basically, the application.ini file does indicate the app bundle's SourceRepository on one of the lines, which can easily be read in the script. Voila! I'm glad you brought this up again, since I can now incorporate this into one of my own scripts.

edited the script

donmontalvo
Esteemed Contributor II

Awesome, responds with <result>Firefox ESR</result> or <result>Firefox Mainline</result> which is perfect.

This would be a perfect addition to JAMF Nation's EA library. Kudos, and chalk up another beer at the next JNUC. :)

Don

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

@mm2270 looks like your Mozilla counterpart responded with another tip...@cor-el has a $#!+ load of posts over there!

https://support.mozilla.org/en-US/questions/1104249

ce36fcba32b34bcbbaa7133e1b23880e

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

sean
Valued Contributor

FWIW, It's also in the Resources/defaults/pref/channel-prefs

Either:

pref("app.update.channel", "esr")
or
pref("app.update.channel", "release")

awk -F """ '/app.update.channel/ {print $(NF-1)}' /Applications/Firefox.app/Contents/Resources/defaults/pref/channel-prefs.js

donmontalvo
Esteemed Contributor II

@sean wow, good one too...so many choices, thanks!

$ awk -F """ '/app.update.channel/ {print $(NF-1)}' /Applications/Firefox.app/Contents/Resources/defaults/pref/channel-prefs.js
esr
$ awk -F """ '/app.update.channel/ {print $(NF-1)}' ~/Applications/Firefox.app/Contents/Resources/defaults/pref/channel-prefs.js
release

Looks like the """ part of the command breaks when wrapped in "<result></result>" tags.

--
https://donmontalvo.com

sean
Valued Contributor

Just escape the slash that is escaping the quote if you want it as one line:

echo "<result>`awk -F "\"" '/app.update.channel/ {print $(NF-1)}' /Applications/Firefox.app/Contents/Resources/defaults/pref/channel-prefs.js`</result>"

donmontalvo
Esteemed Contributor II

EDIT: I was wrong, didn't see @mm2270 had a wildcard in his logic, we're good!

--
https://donmontalvo.com

mphilly03
New Contributor

I'm a JAMF newbie and need to find which users are using ESR. What are the steps to running this script? I assume I add it to the section in JAMF Settings > Computer Management > Scripts, but then what other configuration do I need to do after that to see the results?

cbrewer
Valued Contributor II

This script is meant to be used as an extension attribute.

https://docs.jamf.com/10.21.0/jamf-pro/administrator-guide/Computer_Extension_Attributes.html

Also, I would recommend the method that pulls the channel info from channel-prefs.js.

#!/bin/bash

if [[ -f /Applications/Firefox.app/Contents/Resources/defaults/pref/channel-prefs.js ]]; then
  result=$(awk -F """ '/app.update.channel/ {print $(NF-1)}' /Applications/Firefox.app/Contents/Resources/defaults/pref/channel-prefs.js)
else
  result="Not installed"
fi

echo "<result>${result}</result>"

mphilly03
New Contributor

Thanks @cbrewer! Just what I was looking for.