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