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