xref: /petsc/systems/Apple/OSX/bin/makedmg (revision 1263af9a6fcf8127cd2b5a60e5a615e689f50791)
1e6363104SBarry Smith#!/bin/sh
2e6363104SBarry Smith#
3409736cdSBarry 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
10*1263af9aSBarry Smithcp -r ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset ${PETSC_DIR}/systems/Apple/OSX/examples 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
18*1263af9aSBarry Smithsleep 5
19e6363104SBarry Smithecho '
20e6363104SBarry Smith   tell application "Finder"
21e6363104SBarry Smith     tell disk "PETSc"
22e6363104SBarry Smith           open
23e6363104SBarry Smith           set current view of container window to icon view
24e6363104SBarry Smith           set toolbar visible of container window to false
25e6363104SBarry Smith           set statusbar visible of container window to false
26a211788bSBarry Smith           make new alias file at container window to POSIX file "/Library/Frameworks" with properties {name:"Copy in PETSc.frameworks"}
27a211788bSBarry 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"}
28*1263af9aSBarry Smith           make new alias file at container window to POSIX file "/Users/barrysmith/" with properties {name:"Copy in examples"}
29e6363104SBarry Smith           eject
30e6363104SBarry Smith     end tell
31e6363104SBarry Smith   end tell
32e6363104SBarry Smith' | osascript
33e6363104SBarry Smithsleep 8
34e6363104SBarry Smithsync
35e6363104SBarry Smithsync
36b0fb1394SBarry Smithecho 'Completed osascript'
37e6363104SBarry Smith#hdiutil detach ${device}
38e6363104SBarry Smithhdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg
39e6363104SBarry Smithrm -rf pack.temp.dmg tempsource
40a211788bSBarry Smithhdiutil detach /Volumes/PETSc
41*1263af9aSBarry Smith
42*1263af9aSBarry Smith#           set the bounds of container window to {400, 100, 885, 630}
43*1263af9aSBarry Smith#           set theViewOptions to the icon view options of container window
44*1263af9aSBarry Smith#           set icon size of theViewOptions to 72
45*1263af9aSBarry Smith#           set arrangement of theViewOptions to not arranged
46