jmhobbs@pyhacker archive2011/adding-software-license-agreement-dmg-file/

Adding a Software License Agreement to a DMG file

As part of the software distribution process I go through at my job (Qforma, Inc), I package up our software for both Windows and Mac. For Windows, I create an installer using NSIS which requires a user to agree to a Software License Agreement (SLA) before installing the software. For Mac, rather than using an installer, I have a customized disk image (DMG) that contains the app and a symlink to the /Applications directory.

Since we require a user to agree to our SLA before using our software on Windows, I wanted to require the same on Mac. I searched the internet for an easy way to add an SLA to a DMG and couldn't find a solution that didn't involve using a third party GUI program. Of course all my build processes are automated and run headless so those GUI programs won't work for me. I also wanted to use utilities built in to OS X (or available through Xcode).

Anyway, I figured out how to add an SLA to a DMG and was able to add it to my automated build process. I figured I'd create a simple python script that'll do it too and share it with everyone.

To use the script, make sure Xcode is installed to the default location (/Applications/Xcode.app/Contents/Developer). This assumes you've downloaded and installed Xcode from the Mac App Store. Download the file, make it executable, then simply run:

./licenseDMG.py <dmgFile> <licenseFile>

where <dmgFile> is the path to your DMG file and <licenseFile> is the path to your plain ascii text license file.

Hopefully someone else will also find this useful.

This script runs on Python 2.6 or 2.7. If the default locations of Rez and the FlatCarbon headers are different on your machine, you'll need to specify the correct location using the command line options --rez and --flat-carbon.

Find the code here: licenseDMG.py

327

dmg license mac sla

Comments powered by Disqus
  • Tag Cloud

  •  

    Copyright © 2014 Jared Hobbs. All rights reserved. Powered by Pelican. PyHacker theme available here.