xref: /petsc/systems/Apple/OSX/bin/makedmg (revision a211788b13239c16d45a92650c57588aec0b3cfc)
1e6363104SBarry Smith#!/bin/sh
2e6363104SBarry Smith#
3e6363104SBarry Smith# This script makes a Apple Mac OS X dmg from the PETSc framework
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#
7*a211788bSBarry Smith#  Before runningt this script follow the directions in ./systems/Apple/OSX/bin/makeframework and
8*a211788bSBarry Smith#  ./systems/Apple/OSX/bin/makedocs to make the Apple PETSc Framework and XCode specific documentation
9e6363104SBarry Smith#
10*a211788bSBarry Smithecho "Creating ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg from ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework and ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset"
11e6363104SBarry Smithrm -rf pack.temp.dmg tempsource ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg
12e6363104SBarry Smithmkdir tempsource
13*a211788bSBarry Smithcp -r ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset tempsource
14e6363104SBarry Smithlet size=`du  -c tempsource | tail -1 | cut -f1`
15e6363104SBarry Smithlet size=2*$size
16e6363104SBarry Smith
17e6363104SBarry Smithhdiutil create -srcfolder tempsource -volname PETSc -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${size}k pack.temp.dmg
18e6363104SBarry Smithsleep 5
19e6363104SBarry Smithdevice=`hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | head -1 | cut -f1`
20e6363104SBarry Smithecho Created device $device
21e6363104SBarry Smithecho '
22e6363104SBarry Smith   tell application "Finder"
23e6363104SBarry Smith     tell disk "PETSc"
24e6363104SBarry Smith           open
25e6363104SBarry Smith           set current view of container window to icon view
26e6363104SBarry Smith           set toolbar visible of container window to false
27e6363104SBarry Smith           set statusbar visible of container window to false
28b0fb1394SBarry Smith           set the bounds of container window to {400, 100, 885, 430}
29e6363104SBarry Smith           set theViewOptions to the icon view options of container window
30e6363104SBarry Smith           set arrangement of theViewOptions to not arranged
31e6363104SBarry Smith           set icon size of theViewOptions to 72
32*a211788bSBarry Smith           make new alias file at container window to POSIX file "/Library/Frameworks" with properties {name:"Copy in PETSc.frameworks"}
33*a211788bSBarry 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"}
34e6363104SBarry Smith           eject
35e6363104SBarry Smith     end tell
36e6363104SBarry Smith   end tell
37e6363104SBarry Smith' | osascript
38e6363104SBarry Smithsleep 8
39e6363104SBarry Smithsync
40e6363104SBarry Smithsync
41b0fb1394SBarry Smithecho 'Completed osascript'
42e6363104SBarry Smith#hdiutil detach ${device}
43e6363104SBarry Smithhdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg
44e6363104SBarry Smithrm -rf pack.temp.dmg tempsource
45*a211788bSBarry Smithhdiutil detach /Volumes/PETSc
46