nbalonso.com

buildflash.sh for instaDMG

| Comments

As many people know Adobe is not know for sticking to good practices when it comes to helping enterprises cope with Adobe’s products.

One of the key components for many companies for many reasons is Adobe Flash Player and is no surprise that the installer for this product in OS X /o es ten/ is tricky.

Lately they changed the installer from http://www.adobe.com/go/getflash so that the so called installer is an app that downloads and then installs the actual plugin. This is a problem for products such a Munki or instaDMG.

So tired of re-packing the plugin to include it in my instaDMG workflow and while trying to move from the metapackages that the Packages application was doing for me I wrote this script.

Instructions are simple. Install on your test machine, run the script and collect the result from your desktop.

My buildflash.sh looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh

##building a flat package for Flash to use with instaDMG from the version on this computer

PKGBUILD='/usr/bin/pkgbuild'
MKDIR='/bin/mkdir -p'
CP='/bin/cp -r'
RM='/bin/rm -rfd'
CURRENTVER=`defaults read /Library/Internet\ Plug-Ins/Flash\ Player.plugin/Contents/version CFBundleShortVersionString`
LOGGER='/usr/bin/logger'
#Select 1 for 'Allow Adobe to install updates (recommended)'
#Select 2 for 'Notify me to install updates'
#Select 3 for 'Never check for updates (not recommended)'
UPDATECHOICE=3

##Prepare the folder structure
$MKDIR /tmp/buildflash/Applications/Utilities/
$MKDIR /tmp/buildflash/Library/Application\ Support/Macromedia
$MKDIR /tmp/buildflash/Library/Internet\ Plug-Ins/
$MKDIR /tmp/buildflash/Library/PreferencePanes/
##
if [ -e "/Library/Internet Plug-Ins/Flash Player.plugin" ]; then
  $CP /Library/Internet\ Plug-Ins/Flash\ Player.plugin /tmp/buildflash/Library/Internet\ Plug-Ins/
else
  $LOGGER -s -t buildflash.sh \
      "ERROR: plugin was not found. Exiting" 1>&2
  exit -1
fi
if [ -e "/Library/Internet Plug-Ins/flashplayer.xpt" ]; then
  $CP /Library/Internet\ Plug-Ins/flashplayer.xpt /tmp/buildflash/Library/Internet\ Plug-Ins/
else
  $LOGGER -s -t buildflash.sh \
      "WARNING: flashplayer.xpt not found. Won't be included" 1>&2
fi
if [ -e "/Applications/Utilities/Adobe Flash Player Install Manager.app" ]; then
  $CP /Applications/Utilities/Adobe\ Flash\ Player\ Install\ Manager.app /tmp/buildflash/Applications/Utilities/
else
  $LOGGER -s -t buildflash.sh \
      "WARNING: Install manager not found. Won't be included" 1>&2
fi
if [ -e "/Library/PreferencePanes/Flash Player.prefPane" ]; then
  $CP /Library/PreferencePanes/Flash\ Player.prefPane /tmp/buildflash/Library/PreferencePanes/
else
  $LOGGER -s -t buildflash.sh \
      "WARNING: prefPane not found. Won't be included" 1>&2
fi
##Choice setup
case "$UPDATECHOICE" in
  1)   echo 'AutoUpdateDisable=0' > /tmp/buildflash/Library/Application\ Support/Macromedia/mms.cfg && \
      echo 'SilentAutoUpdateEnable=1' >> /tmp/buildflash/Library/Application\ Support/Macromedia/mms.cfg ;;

  2)   echo 'AutoUpdateDisable=0' > /tmp/buildflash/Library/Application\ Support/Macromedia/mms.cfg && \
      echo 'SilentAutoUpdateEnable=0' >> /tmp/buildflash/Library/Application\ Support/Macromedia/mms.cfg ;;

  3)   echo 'AutoUpdateDisable=1' > /tmp/buildflash/Library/Application\ Support/Macromedia/mms.cfg && \
      echo 'SilentAutoUpdateEnable=0' >> /tmp/buildflash/Library/Application\ Support/Macromedia/mms.cfg ;;
esac
##
##Actual build
$PKGBUILD --identifier com.adobe.pkg.FlashPlayer --version $CURRENTVER --root /tmp/buildflash/ --install-location / ~/Desktop/myflashinstaller-$CURRENTVER.pkg
##
##Clean the house
$RM /tmp/buildflash
##

exit 0

I’m recently using logger as read on one of Greg’s article in MacTech. I’ll try to do a similar task to automate the Office installation for instaDMG.

PS: for Munki you can sign the re-distribution agreement and then find the proper installer inside the .dmg

Comments