Disk image
This section describes how to create and modify a Mac OS/X .dmg file (disk image).
Create/convert
To create an image Tribler.dmg from a source folder imagecontents/, use:
hdiutil create -srcfolder imagecontents/ -format UDRW -scrub
-volname Tribler Tribler.dmg
The UDRW format allows read/write-access. This allows modifications to the image such as setting the background. Useful formats are:
- UDRW: Read/write
- UDZO: Read-only
- UDCO: Read-only, compressed
To convert to a different format, use:
hdiutil convert Tribler.dmg -format UDCO -imagekey zlib-level=9 -o Tribler-readonly.dmg
The -imagekey zlib-level=9 sets the compression level for UDCO (1=fastest, 9=smallest).
Mount/unmount
To mount an image on build/mnt, use:
mkdir -p build hdiutil attach -readwrite -noverify -noautoopen Tribler.dmg -mountpoint build/mnt
To unmount it, use:
hdiutil detach build/mnt
EULA
Mac OS/X can present the user with an EULA when the disk image is opened. This EULA is stored in the resource fork of the disk image. Special care is needed, as the EULA has special file format and subversion cannot be used to store resource forks.
An example EULA file can be found in the SLA SDK of Apple, and is called SLAResources. We'll first extract the EULA from the example file's resource fork:
cp SLAResources/rsrc SLAResources.rsrc
The file SLAResources.rsrc can be stored in Subversion. To edit it, use for example RezKnife.
Finally, to attach the EULA to a disk image, the image needs to be unflattened (i.e. data/resource forks restored), but it needs to be flattened again in the end:
hdiutil unflatten Tribler.dmg /Developer/Tools/DeRez -useDF SLAResources.rsrc > sla.r /Developer/Tools/Rez -a sla.r -o Tribler.dmg hdiutil flatten Tribler.dmg
Attachments
- SLAs_for_UDIFs_1.0.dmg (33.8 kB) -
Apple's SLA SDK
, added by jdmol on 05/06/07 12:55:06.
