curl current and future versions of Oracle Java 7 builds

ToriAnneke
Contributor II

Hey all,

Anyone got a script to download and silently install Java as a script?

For example I found this for Flash Player. I don't remember where I found this.
(Kudos to the script writer whoever, wherever you are!!)

#!/bin/sh

# This script downloads and installs the latest Flash player for compatible Macs

# Determine OS version
osvers=$(sw_vers -productVersion | awk -F. '{print $2}')

# Specify the complete address of the Adobe Flash Player
# disk image

fileURL="http://fpdownload.macromedia.com/get/flashplayer/current/licensing/mac/install_flash_player_14_osx_pkg.dmg"

# Specify name of downloaded disk image

flash_dmg="/tmp/flash.dmg"

if [[ ${osvers} -lt 6 ]]; then
  echo "Adobe Flash Player is not available for Mac OS X 10.5.8 or below."
fi

if [[ ${osvers} -ge 6 ]]; then

    # Download the latest Adobe Flash Player software disk image

    /usr/bin/curl --output "$flash_dmg" "$fileURL"

    # Specify a /tmp/flashplayer.XXXX mountpoint for the disk image

    TMPMOUNT=`/usr/bin/mktemp -d /tmp/flashplayer.XXXX`

    # Mount the latest Flash Player disk image to /tmp/flashplayer.XXXX mountpoint

    hdiutil attach "$flash_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen

    # Install Adobe Flash Player from the installer package stored inside the disk image

    /usr/sbin/installer -dumplog -verbose -pkg "$(/usr/bin/find $TMPMOUNT -maxdepth 1 ( -iname *.pkg -o -iname *.mpkg ))" -target "/"

    # Clean-up

    # Unmount the Flash Player disk image from /tmp/flashplayer.XXXX

    /usr/bin/hdiutil detach "$TMPMOUNT"

    # Remove the /tmp/flashplayer.XXXX mountpoint

    /bin/rm -rf "$TMPMOUNT"

    # Remove the downloaded disk image

    /bin/rm -rf "$flash_dmg"
fi

exit 0
6 REPLIES 6

emily
Valued Contributor III
Valued Contributor III

This is from @rtrouton. I'd be interested to see a comparable script for Java (and Adobe Reader tbh).

rtrouton
Release Candidate Programs Tester

I recently updated that script, to make it more future-proof:

https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/install_latest_adobe_flash...

For Java and Adobe Reader updates, I've been using AutoPkg:

https://github.com/autopkg/autopkg

There's a new tool named AutoPkgr that's available to help with managing AutoPkg. I have a post on it here:

http://derflounder.wordpress.com/2014/07/15/autopkgr-a-gui-for-autopkg/

This post was about AutoPkgr's initial release, but the developer has already released a new version that incorporated feedback from the community:

https://github.com/lindegroup/autopkgr

emily
Valued Contributor III
Valued Contributor III

I just spent the last hour trying to figure out how all of that works and I still have no idea. I'm not sure what I'm doing wrong or what any of it means, really. Git is still a bit of a mystery to me. Is there a way to find a direct download link for some of these apps aside from AutoPkg(r) for those of us that aren't as code-savvy or experienced with tools and services like this?

rtrouton
Release Candidate Programs Tester

For those getting started with AutoPkg, the Penn State MacAdmins Conference has just posted the video for Greg Neagle's AutoPkg session. It's available here on YouTube:

https://www.youtube.com/watch?v=mqK-MAEZekI

AutoPkg solves a lot of problems, including how to get both Oracle's Java 7 and Adobe's Reader installers. I really encourage folks to start checking it out if they haven't already.

ToriAnneke
Contributor II

Will do!! Thanks rtrouton!!!

Kallendal
New Contributor III

Emily brings up a good point. Anyone have something comparable to a java auto install script?

In truth, if anyone knows a auto downloader site (FTP), that in itself could be useful just to try and manipulate the same script for java.

Thanks