Skip to main content
Question

Firefox update script


Forum|alt.badge.img+2

Hi all
Being a newbie please be gentle.
I have found and used the Flash update script on this site and was wondering if there is a way of doing similar qwith Firefox - script downloads and installs the latest Firefox for compatible Macs
kind regards
john

56 replies

Forum|alt.badge.img+14
  • Valued Contributor
  • 85 replies
  • January 7, 2015

Hallo John,

We use autopkg for this.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 7, 2015

Autopkg would make the most sense overall to use for this purpose. However, everyone's needs and/or tolerances for what should be something packaged and contained in the JSS, versus just allowing the clients to download and install the latest version, will be unique.

That said, I have a single script that can be used to update up to 8 different apps/plug-ins, including Flash Player, Oracle's Java, Silverlight, Adobe Reader, VLC, Flip4Mac (free version), Office 2011 and Firefox.
In all above cases, it doesn't require any packaging of the apps or plug-ins. It will direct the client to download and install the product directly. For this reason, if internet bandwidth usage is a concern, then this wouldn't be a good solution. If bandwidth use is not a concern, then it can be an option. My primary reason for working on it was that I was getting tired of needing to build complex Smart Groups to target the right machines with package install policies. The script checks the installed version and will know if it needs to be updated. If its not installed, in all cases except for Office since those are only updaters, it can install it new. Its just a flag you can set in the script to install new or skip if not installed.
The script also has both a silent mode and a Self Service mode, which uses cocoaDialog for dialogs, progress bars and feedback, etc.


emily
Forum|alt.badge.img+24
  • Employee
  • 870 replies
  • January 7, 2015

@mm2270 for us mooches ;) any chance you have a scrubbed version of that script that folks can look at?


Forum|alt.badge.img+8
  • Contributor
  • 23 replies
  • January 7, 2015

I second this request


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 7, 2015

@emilykausalik - Right now I do not, but that won't be hard to do. There isn't much "scrubbing" needed for it. Only one line actually reference anything in our org and its only for the titles of the dialogs. Everything else is pretty standard. Give me a day or two and I will post it on my github page and post back here.


emily
Forum|alt.badge.img+24
  • Employee
  • 870 replies
  • January 7, 2015

@mm2270 you're a hero! Perhaps even a superhero.


Forum|alt.badge.img+8
  • Contributor
  • 23 replies
  • January 7, 2015

thanks Mike! much appreciated!


Forum|alt.badge.img+10
  • Contributor
  • 123 replies
  • January 7, 2015

I wish there was some sort of JAMF repository for things like this (or is there?). Thanks so much for offering to share.....super helpful and super nice to share.


Forum|alt.badge.img+12
  • Contributor
  • 189 replies
  • January 7, 2015

There is the Script section (https://jamfnation.jamfsoftware.com/scripts.html) located under the More... tab at the top of JAMF Nation, though pretty much almost everything is shared in individual githubs.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 9, 2015

I've posted the script that I mentioned above to my github page now. The information can be found here:
https://github.com/mm2270/CasperSuiteScripts
Its the first script mentioned in the ReadMe, "Update_Core_Apps.sh" which you can get to directly with this link:
https://github.com/mm2270/CasperSuiteScripts/blob/master/Update_Core_Apps.sh

The ReadMe has most of the information you need to understand how it works, but if anyone has questions on it, feel free to ask. Just a couple of details:
The power of the script comes from a case statement that sets a large number of variables to use as the script runs, which is set by whatever is passed in Parameter 4. The case statement keeps the number of functions down a bit since in some cases a single function can be used for any of the apps or plug-ins the script can update.
As I mentioned above, since the script downloads updates directly and installs them, bandwidth conscious environments may not want to use something like this since it means each client will be accessing the downloads over the internet. But the advantage of the approach is not needing to worry about Smart Groups and updating Smart Groups to target Macs that need an update. The script takes care of the version checks.

The script is still a little bit of a work in progress but is pretty much feature complete as I envisioned it anyway. But of course if you see anything not working, or see any odd issues, let me know and I will look into it. Any feedback is welcome.


Forum|alt.badge.img+14
  • Valued Contributor
  • 85 replies
  • January 9, 2015

Hallo Mike i really admire your post here on jamfnation !! looking @your script seems like you spend allot of time on it all i can say is thank you for sharing.

Great work!


jhbush
Forum|alt.badge.img+26
  • Esteemed Contributor
  • 539 replies
  • January 9, 2015

@mm2270][/url very nice work and thanks for posting this. Is there a way I'm missing to string all of the apps in $4 or is it one at a time? I tested the Java update portion and that seems to be unable to gather the latest version from Oracle. If someone else could verify for me, if I add the script multiple times it grabs the same value even if you set different values for each run of the script.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 10, 2015

@hcodfrie and @jhbush1973 - thanks for the feedback guys.
@ Jason - right now it works with one app/plug-in at a time. This is because when I began working on it, I saw it as a way to add to single policies that would appear in Self Service Though I've already been thinking about a way to make it run through a list of apps to check and update all of them at once. In fact, I have something else that is doing something along those lines right now, so it shouldn't be hard to do, once I get around to it.
As for the Java issue, what OS version did you test on? Was it Yosemite? I've occasionally seen some issues with 10.10 and the Java version check. I thought I corrected that, but I may need to take another look at it. I just tested the script today against 10.9.5 and it was working fine to grab the latest Java version.


Forum|alt.badge.img+14
  • Valued Contributor
  • 85 replies
  • January 10, 2015

Hey jhbush1973 i had the same i created 7 scripts for this with both the $4 and $5 also have problems updating the java one.

It would be nice to gave them running in one script, can we make a feature request?


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 10, 2015

@hcodfrie and @jhbush1973 - If you guys can let me know some details on the Macs you tested the Oracle Java update on, I can see if I can replicate it. If so, I'll see how to get it fixed. As I mentioned, I don't see the issue in testing on 10.9.5, so I suspect it may be under 10.10 or an earlier OS, so I would just need to know that if possible.

As for making it work to update all apps/plug-ins at once, as I mentioned, its something I've been thinking about. Just a question on that though - were you guys thinking mostly silent updates, or also for Self Service? If you also mean the latter, I would have to think about how to make that happen. Right now, its designed to work as follows in Self Service mode-

1) Policy runs and checks installed version against current released version
2) If a new version is found, it prompts the user if they would like to update
3) If they click Update Now it:
    a) Shows download progress for update
    b) Shows install progress as it installs
4) Shows final confirmation dialog (success or failure)

To have that sequence repeat for as many as 7 or 8 products at once would not be a good UX, so it would need to be reworked quite a bit. The same general process under the hood would apply for determining what needs to be updated, but i would need to show it as a single installation process and not separate ones for each. I'm not saying it isn't possible, just that it would take some work. I'm willing to do it, but its not a couple of lines of code change.


Forum|alt.badge.img+14
  • Valued Contributor
  • 85 replies
  • January 11, 2015

Hey mike i tested it with a 10.10.1 machine with the $5 option ... So selfservice would be great.


jescala
Forum|alt.badge.img+12
  • Contributor
  • 91 replies
  • January 12, 2015

I realize I'm a little late to the party, but here is the script I created to install/update Firefox with the latest ESR version:

#!/usr/bin/python
############
# This script installs/updates the latest ESR version of the Firefox web browser.
############
# 1.0 - Jorge Escala - 2014-12-24
#        * Initial script creation.
############

import re, os
from distutils.dir_util import copy_tree
from os.path import isfile
from plistlib import readPlist
from ftplib import FTP

server='ftp.mozilla.org'
path='pub/mozilla.org/firefox/releases/latest-esr/mac/en-US'
plistFile='/Applications/Firefox.app/Contents/Info.plist'
DEBUG=False

ftp=FTP(server)
ftp.login()
ftp.cwd(path)
fileList=(ftp.nlst())

# Get latest version of Firefox and filename
latestFirefoxDownload=next(i for i in fileList if re.match( r'Firefox.*.dmg', i))
latestFirefoxVersion=latestFirefoxDownload[8:-7]

# Get currently installed version of Firefox
if isfile(plistFile):
    pl = readPlist(plistFile)
    currentFirefoxVersion=pl["CFBundleShortVersionString"]
else:
    currentFirefoxVersion="none"

if DEBUG:
    print("current: "+currentFirefoxVersion)
    print("latest: "+latestFirefoxVersion)

if latestFirefoxVersion != currentFirefoxVersion:
    ftp.retrbinary('RETR '+latestFirefoxDownload, open('/tmp/Firefox.dmg', 'wb').write)
    commandCall='hdiutil attach -nobrowse -mountpoint "/Volumes/Firefox" "/tmp/Firefox.dmg"'
    os.system(commandCall)
    copy_tree("/Volumes/Firefox/Firefox.app", "/Applications/Firefox.app")
    commandCall='hdiutil detach "/Volumes/Firefox"'
    os.system(commandCall)

Forum|alt.badge.img+12
  • Valued Contributor
  • 181 replies
  • January 13, 2015

Love the script. The only thing I changed for our school district was to modify the upToDate function to output the version information, because people here like to see what version is installed when they are told that they are already at the most recent version.

EDIT: I know that information is in the logs, I just added it to what is shown to the user in Self Service mode.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 13, 2015

Thanks @musat! That's a good modification. I may incorporate your edit into my posted version.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 13, 2015

The script was updated to correct for the Java version checking issue that was reported. Seems to be working as expected now.
I haven't incorporated a change as @musat mentioned to include the version info when the app/plug-in is up to date (in the Self Service dialogs), but will do that soon.


Forum|alt.badge.img+16
  • Honored Contributor
  • 329 replies
  • January 28, 2015

Looks like that Update_Core_Apps script is not working for Adobe Reader installs/updates. It fails saying it could not locate the package in the mounted volume. Oddly, it works as an update with dialogue but not silently or a new install.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 28, 2015

@McAwesome - just curious, but when did you download the script? I had corrected that issue some days back and updated the script on github. It was a string in the case statement that was set wrong, so it was looking for the wrong package name. Try downloading the script again from my page and try it again. If you still see an issue with this, either post here, or better yet, submit an issue on my github page so we can track it.
In the meantime, I'll run it locally in silent mode to see if I can reproduce the problem.
Thanks.


Forum|alt.badge.img+16
  • Honored Contributor
  • 329 replies
  • January 28, 2015

I downloaded it(the Jan 15, 2015 version) a couple of hours ago today. With the GUI, it gets to 97% or so and fails. Silently it gets to stage 5 and fails. I'd report it on GitHub, but I currently don't have an account there(never have to use it myself).


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 28, 2015

@McAwesome - please download the script again. It was just updated. I had a grep where there should have been an egrep on one line. The new version labeled as modified on 2015-01-28 is now working in silent mode. I just tested it by updating Adobe Reader to 11.0.10 on my Mac.
The latest script also includes the ability to update or install Dropbox and Cyberduck. MS Lync was also rolled in from a previous beta version.


Forum|alt.badge.img+12
  • Contributor
  • 312 replies
  • January 28, 2015

Dear sweet baby spaghetti monster.

STEPS:

  1. Look at my avatar icon.
  2. Read this out loud, "I should use autopkg for this. It is amazing. It is simple. It is easy."
  3. Repeat.

;)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings