Skip to content

Instantly share code, notes, and snippets.

@jamesez
Created July 3, 2012 13:31
Show Gist options
  • Save jamesez/3039711 to your computer and use it in GitHub Desktop.
Save jamesez/3039711 to your computer and use it in GitHub Desktop.
Adobe AIR Munki Packaging
#!/bin/bash -ex
# download latest Adobe AIR
ftp -o adobeair.dmg http://airdownload.adobe.com/air/mac/download/latest/AdobeAIR.dmg
# Mount disk image on temp space
mountpoint=`hdiutil attach -mountrandom /tmp -nobrowse adobeair.dmg | awk '/private\/tmp/ { print $3 } '`
echo Mounted on $mountpoint
# Obtain version
version=`defaults read "$mountpoint/Adobe AIR Installer.app/Contents/Frameworks/Adobe AIR.framework/Resources/Info.plist" CFBundleVersion`
# Make a disk image with just the framework on it
hdiutil create -srcfolder "$mountpoint/Adobe AIR Installer.app/Contents/Frameworks" -format UDZO -o AdobeAIR-${version}.dmg
hdiutil detach "$mountpoint"
# Build pkginfo
plist=`pwd`/AdobeAIR-${version}.plist
/usr/local/munki/makepkginfo AdobeAIR-${version}.dmg -i 'Adobe AIR.framework' -d /Library/Frameworks --postinstall_script "postinstall.sh" > "$plist"
# Change path and other details in the plist
defaults write "${plist}" installer_item_location "jenkins/AdobeAIR-${version}.dmg"
defaults write "${plist}" minimum_os_version "10.7.0"
defaults write "${plist}" uninstallable -bool NO
defaults write "${plist}" display_name "Adobe AIR Framework"
defaults write "${plist}" name "AdobeAIR"
# Make readable by humans
/usr/bin/plutil -convert xml1 "$plist"
chmod a+r "$plist"
#!/bin/bash
# Delete old versions
rm -rf '/Applications/Adobe/Flash Player/AddIns/airappinstaller'
rm -rf '/Applications/Utilities/Adobe AIR Application Installer.app'
rm -rf '/Applications/Utilities/Adobe AIR Uninstaller.app'
rm -rf '/Users/Shared/Library/Application Support/Adobe/AIR'
# Copy installer app
rsync -avE '/Library/Frameworks/Adobe AIR.framework/Versions/Current/Adobe AIR Application Installer.app' '/Applications/Utilities'
# Add config to make installer app be able to open .air files
defaults write '/Applications/Utilities/Adobe AIR Application Installer.app/Contents/Info.plist' 'CFBundleDocumentTypes' '( { CFBundleTypeExtensions = ( "air" ); CFBundleTypeIconFile = "Adobe AIR Installer Package.icns"; CFBundleTypeMIMETypes = ( "application/vnd.adobe.air-application-installer-package+zip" ); CFBundleTypeName = "com.adobe.air.InstallerPackage"; CFBundleTypeRole = Viewer; } )'
plutil -convert xml1 '/Applications/Utilities/Adobe AIR Application Installer.app/Contents/Info.plist'
chmod a+r '/Applications/Utilities/Adobe AIR Application Installer.app/Contents/Info.plist'
# I heard you like plugins so I put a plugin in your plugin
mkdir -p '/Applications/Adobe/Flash Player/AddIns/airappinstaller'
cp '/Library/Frameworks/Adobe AIR.framework/Resources/airappinstaller' '/Applications/Adobe/Flash Player/AddIns/airappinstaller'
cp '/Library/Frameworks/Adobe AIR.framework/Resources/airappinstaller.rsrc' '/Applications/Adobe/Flash Player/AddIns/airappinstaller/airappinstaller/..namedfork/rsrc'
cp '/Library/Frameworks/Adobe AIR.framework/Resources/digest.s' '/Applications/Adobe/Flash Player/AddIns/airappinstaller'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment