Skip to content

Instantly share code, notes, and snippets.

@opragel
Last active October 12, 2017 22:24
Show Gist options
  • Save opragel/a43802f4cbc72e440182 to your computer and use it in GitHub Desktop.
Save opragel/a43802f4cbc72e440182 to your computer and use it in GitHub Desktop.
uninstall_adobe_flash_player_osx.sh
#!/bin/bash
# your funeral
LOCAL_INSTALL_MANAGER="/Applications/Utilities/Adobe Flash Player Install Manager.app/Contents/MacOS/Adobe Flash Player Install Manager"
DOWNLOAD_URL="https://fpdownload.macromedia.com/get/flashplayer/current/support/uninstall_flash_player_osx.dmg"
DMG_NAME=$(printf "%s" "$DOWNLOAD_URL" | sed 's@.*/@@')
LOCAL_DMG_PATH="/tmp/$DMG_NAME"
LOCAL_VOLUME_NAME="Flash Player"
localFlashVersion=$(/usr/bin/defaults read "/Library/Internet Plug-Ins/Flash Player.plugin/Contents/version" CFBundleShortVersionString)
if [ "${localFlashVersion}" ]; then
if [ -f "$LOCAL_INSTALL_MANAGER" ]; then
flashInstallManager="$LOCAL_INSTALL_MANAGER"
"$flashInstallManager" -uninstall
else
/usr/bin/curl --retry 3 --silent -o "$LOCAL_DMG_PATH" "$DOWNLOAD_URL"
/usr/bin/hdiutil attach "$LOCAL_DMG_PATH" -nobrowse -quiet
flashInstallManager="/Volumes/$LOCAL_VOLUME_NAME/Adobe Flash Player Uninstaller.app/Contents/MacOS/Adobe Flash Player Install Manager"
"$flashInstallManager" -uninstall
/usr/bin/hdiutil detach "/Volumes/$LOCAL_VOLUME_NAME"
/bin/rm "$LOCAL_DMG_PATH"
fi
else
printf "Adobe Flash not found."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment