Script to download and install latest Shockwave player

nadams
New Contributor III

Hi All,

I have a script here that checks for the latest version of Flash Player, downloads, installs, and then cleans up after itself. I didn't create the script, and it's a little more complex than I'm used to, so I'm not sure how to recreate it for Shockwave (which would also include Flash Player). Does anyone have anything created already? I looked around but I didn't find one. Here's the content of the existing script:

#!/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}')

# Determine current major version of Adobe Flash for use
# with the fileURL variable

flash_major_version=`/usr/bin/curl --silent http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml | cut -d , -f 1 | awk -F" '/update version/{print $NF}'`

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

fileURL="http://fpdownload.macromedia.com/get/flashplayer/current/licensing/mac/install_flash_player_"$flash_major_version"_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
5 REPLIES 5

mm2270
Legendary Contributor III

If you don't care about checking the version of Shockwave, and are only interested in downloading and installing it, here is the download URL for the latest OS X version

http://fpdownload.macromedia.com/get/shockwave/default/english/macosx/latest/Shockwave_Installer_Full_64bit.dmg

I'll let you work out what lines to replace in the script above to get it to download and install.

nadams
New Contributor III

Thanks. I assume there will be a similar XML file if I use that URL as a reference point. I'll have to check it out.

mm2270
Legendary Contributor III

I'm not sure. I haven't looked that far into it. The xml that Flash uses helps locate the latest version information, since its what the Flash auto update mechanism uses. But I'm not sure whether that info is important to you. The script you posted is only using that xml as a reference for part of the download path, not to check to see if the installed version is less than or equal to the latest version up on Adobe's servers. IOW, its not doing any on-the-fly version checking. Its just downloading and installing it.

For the Shockwave download, the URL I posted doesn't use a version string in its URL, so it should (I think) always download the latest version.

jbjorn
New Contributor II

@nadams - Did you have any success with the Shockwave script? If so, would you be so kind as to post a copy here? Thanks!

nadams
New Contributor III

@jbjorn sorry for the delay in getting this to you. Here's the script:

#!/bin/sh

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

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

fileURL="http://fpdownload.macromedia.com/get/shockwave/default/english/macosx/latest/Shockwave_Installer_Full_64bit.dmg"

# Specify name of downloaded disk image

flash_dmg="/tmp/shockwave.dmg"


    # Download the latest Adobe Flash Player software disk image

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

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

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

    # Mount the latest Shockwave disk image to /tmp/shockwave.XXXX mountpoint

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

    # Install Adobe Shockwave 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/shockwave.XXXX

    /usr/bin/hdiutil detach "$TMPMOUNT"

    # Remove the /tmp/shockwave.XXXX mountpoint

    /bin/rm -rf "$TMPMOUNT"

    # Remove the downloaded disk image

    /bin/rm -rf "$flash_dmg"