Flash Removal Script

denmoff
Contributor III

Here's a script to uninstall flash using Adobe's uninstaller app. I am borrowing heavily from @peterloobuyck's great flash updater script. Unfortunately, it won't notify the user to close their web browser. Not sure how much that matters.

If you know of a better way to do this, feel free to post it here. I didn't see any posts about removing flash on here. I imagine it would just be a couple of rm commands, but i'm not sure what exactly gets removed with the uninstaller.

EDIT: I forgot that using /usr/bin/dirname doesn't seem to work in Self Service. Switched to using /tmp/ instead.

#!/bin/sh

dmgfile="uninstall_flash_player_osx.dmg"
volname="Flash"
logfile="/Library/Logs/FlashRemovalScript.log"

url="https://fpdownload.macromedia.com/get/flashplayer/current/support/uninstall_flash_player_osx.dmg"


    currentinstalledver=`/usr/bin/defaults read "/Library/Internet Plug-Ins/Flash Player.plugin/Contents/version" CFBundleShortVersionString`
    if [ "${currentinstalledver}" ]; then
        /bin/echo "`date`: Downloading uninstaller." >> ${logfile}
        /usr/bin/curl -s -o /tmp/$dmgfile $url
        /bin/echo "`date`: Mounting uninstaller disk image." >> ${logfile}
        /usr/bin/hdiutil attach /tmp/$dmgfile -nobrowse -quiet
        /bin/echo "`date`: Uninstalling..." >> ${logfile}
        /Volumes/Flash Player/Adobe Flash Player Uninstaller.app/Contents/MacOS/Adobe Flash Player Install Manager -uninstall> /dev/null
        /bin/sleep 10
        /bin/echo "`date`: Unmounting uninstaller disk image." >> ${logfile}
        /usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep ${volname} | awk '{print $1}') -quiet
        /bin/sleep 10
        /bin/echo "`date`: Deleting disk image." >> ${logfile}
        /bin/rm /tmp/${dmgfile}
    else
        /bin/echo "`date`: Flash is not installed" >> ${logfile}
        /bin/echo "--" >> ${logfile}
    fi
4 REPLIES 4

MrP
Contributor III

Works perfectly. Thanks!

I added this to the top for our environment, fwiw:

proxy="HTTP://PROXY:PORT"
echo Using proxy: $proxy
export ALL_PROXY=$proxy
export http_proxy=$proxy
export https_proxy=$proxy
export HTTP_PROXY=$proxy
export HTTPS_PROXY=$proxy

tcandela
Valued Contributor II

is this adobe flash uninstall script good to go or is there something more current?

sdagley
Esteemed Contributor II

jhalvorson
Valued Contributor

I agree with @sdagley with the recommendation to use @rtrouton 's script.