Posted on 01-12-2016 06:31 PM
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:
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
Solved! Go to Solution.
Posted on 01-12-2016 07:10 PM
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
Posted on 01-13-2016 01:16 AM
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
Posted on 01-12-2016 06:40 PM
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.
Posted on 01-12-2016 07:10 PM
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
Posted on 01-12-2016 10:21 PM
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
Posted on 01-12-2016 11:09 PM
@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
Posted on 01-12-2016 11:44 PM
https://bugzilla.mozilla.org/show_bug.cgi?id=1239228
Posted on 01-13-2016 01:16 AM
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
Posted on 01-13-2016 10:22 AM
@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.
Posted on 01-18-2016 01:47 AM
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>"
Posted on 05-11-2016 07:33 PM
EDIT: I was wrong, didn't see @mm2270 had a wildcard in his logic, we're good!
Posted on 06-01-2020 12:58 PM
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?
Posted on 06-01-2020 01:32 PM
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>"
Posted on 06-08-2020 09:39 AM
Thanks @cbrewer! Just what I was looking for.