Offline OOB Mac Installation
Download the files used in this tutorial here.
One nice addition in Silverlight 4 at (least for Windows) was the ability to install an “out of browser” (OOB) application without being disconnected to the internet or without the need of having the browser open using SLLuancher, the Silverlight shell that makes OOB applications work. This allows for admins to push out unattended installs and allows software developers to write installers for distribution through more traditional means such as CD’s and Downloads. This ability, however, was not included in the Mac version of Silverlight, so this little how-to was to show how to build an offline installer for OSX using OOB.
What you will need:
PackageMaker: This is a package builder for building installation packages for OSX. It is not a part of the default OSX install, but it comes with XCode on Leopard and Snow Leopard CD’s for OSX. Follow this guide on how to install XCode. I use a Mac for development, so I had already installed it.
A Silverlight Application configured for OOB: You do not have to have a production server for this to work, but this will make updates to the software difficult. Silverlight’s built-in update feature checks for software update from the source of the installation. For this reason, Silverlight OOB installs are more or less married to a domain when they are installed, so when installing applications offline, one must provide this URL. This will be the domain under which the application is installed. The domain in the URL for this example is http://asi770.
So here’s how to build the installer:
1.) Load your Silverlight Application in a browser on your Mac with XCode, then right click the application and install it on your Mac as an OOB application. It will either drop your application (i.e. a “.app” file) in your “Applications” folder or in your “Downloads”.
2.) Create a folder for your installation project. I created one called “OOB Offline Installer” on my desktop. Copy the application (.app) file to this folder.
3.) In Finder, select the “Go” menu and select “Go To Folder”. Type in “~/Library/Application Support/Microsoft/Silverlight/OutOfBrowser”.
This will open the location of the installed Out of Browser applications. You will see a series of folders with some random numbers then the name of your domain in the style of “12345678.domain” and an index folder. Mine is called “1507697575.asi770”. You will also see a folder called “index” with files corresponding to domains in them. Mine is called “asi770”.
4.) Copy the “12345678.domain” folder and “domain” file to your installation projects folder. don’t copy the “index” folder. You don’t need it. You should now have the Application (“.app”) file, the “12345678.domain” folder, and he “domain” file in your installation project folder.
5.) Start up PackageMaker. Open your Mac hard drive, Select Developer à Applications à Utilities à PackageMaker. Give the application a name and description.
a. If you want to add some customization to this, you can by adding your organization and some requirements. I find it useful to set a minimum OS version (Silverlight requires 10.4) and making sure that Silverlight is installed by detecting the existence of the Silverlight preference app. This can be done under “Requirements”. This however is not required.
6.) From finder, drag the file one at a time. First drag the “12345678.domain” folder, then the “domain” file, then the application “.app” file.
7.) Set the installation destinations
a. For the “12345678.domain” set its destination to “/tmp/12345678.domain”.
b. For the “domain” file, set its destination to “/tmp” only.
c. For the .app file, it will default to the “Applications” folder. You shouldn’t have to change this.
8.) Download and edit this script.
a. Set line 30 to read like this: “mv -f /tmp/12345678.domain .” For my app, the line read, “mv -f /tmp/1507697575.asi770 .”
b. Set line 40 to read like this: “mv -f /tmp/domain .” For my app, the line read, “mv -f /tmp/asi770 .”
c. Save the file in your installation project folder
9.) In PackageMaker, select the “domain” file, select “Scripts”, point the “Postflight” script to the script you just edited.
10.) When you’re done, you should have something that looks like this.
11.) Build the project to make sure it builds, but do not run it. You’ll need to remove the OOB application before testing the install. Do this by starting the application, right clicking it, and selecting “Remove this application…” option the menu.
12.) Test the installer. If the installer runs without a problem, you should be able to launch the application from the “Applications” folder. Sometimes, when testing it on the machine using PackageManager, the installer does not copy the application to the “Applications” folder. This does not mean it’s broken or did not function properly. The best way to try it is to copy your newly created package to another Mac and run it to see if it works.
That should be everything to get you going. I’ve tested my installers on a number of Macs with using 10.4, 10.5, and 10.6 respectively and all of them were successful. Maybe in the future, this workaround won’t be necessary because there will be similar functionality to do offline OOB installs natively as they are done in Windows.