xref: /petsc/systems/Apple/OSX/bin/makedmg (revision 409736cdc5550e273706b74b1ce3f26cf9a00064)
1e6363104SBarry Smith#!/bin/sh
2e6363104SBarry Smith#
3*409736cdSBarry Smith# This script makes a Apple Mac OS X dmg from the PETSc framework and docset, see ./makeall
4e6363104SBarry Smith#
5e6363104SBarry Smith# Make sure that "Enable access for assistive devices" is checked in System Preferences>>Universal Access. It is required for the AppleScript to work.
63923b477SBarry Smith#
7a211788bSBarry Smithecho "Creating ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg from ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework and ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset"
8e6363104SBarry Smithrm -rf pack.temp.dmg tempsource ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg
9e6363104SBarry Smithmkdir tempsource
10a211788bSBarry Smithcp -r ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset tempsource
11e6363104SBarry Smithlet size=`du  -c tempsource | tail -1 | cut -f1`
12e6363104SBarry Smithlet size=2*$size
13e6363104SBarry Smith
14e6363104SBarry Smithhdiutil create -srcfolder tempsource -volname PETSc -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${size}k pack.temp.dmg
15e6363104SBarry Smithsleep 5
16e6363104SBarry Smithdevice=`hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | head -1 | cut -f1`
17e6363104SBarry Smithecho Created device $device
18e6363104SBarry Smithecho '
19e6363104SBarry Smith   tell application "Finder"
20e6363104SBarry Smith     tell disk "PETSc"
21e6363104SBarry Smith           open
22e6363104SBarry Smith           set current view of container window to icon view
23e6363104SBarry Smith           set toolbar visible of container window to false
24e6363104SBarry Smith           set statusbar visible of container window to false
25b0fb1394SBarry Smith           set the bounds of container window to {400, 100, 885, 430}
26e6363104SBarry Smith           set theViewOptions to the icon view options of container window
27e6363104SBarry Smith           set arrangement of theViewOptions to not arranged
28e6363104SBarry Smith           set icon size of theViewOptions to 72
29a211788bSBarry Smith           make new alias file at container window to POSIX file "/Library/Frameworks" with properties {name:"Copy in PETSc.frameworks"}
30a211788bSBarry Smith           make new alias file at container window to POSIX file "/Applications/Xcode.app/Contents/Developer/Documentation/DocSets" with properties {name:"Copy in PETSc.docset"}
31e6363104SBarry Smith           eject
32e6363104SBarry Smith     end tell
33e6363104SBarry Smith   end tell
34e6363104SBarry Smith' | osascript
35e6363104SBarry Smithsleep 8
36e6363104SBarry Smithsync
37e6363104SBarry Smithsync
38b0fb1394SBarry Smithecho 'Completed osascript'
39e6363104SBarry Smith#hdiutil detach ${device}
40e6363104SBarry Smithhdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg
41e6363104SBarry Smithrm -rf pack.temp.dmg tempsource
42a211788bSBarry Smithhdiutil detach /Volumes/PETSc
43