xref: /petsc/systems/Apple/OSX/bin/makedmg (revision 5edf65166e22df6feda2ed6bd8a6e348419dee17)
1#!/bin/sh
2#
3# This script makes a Apple Mac OS X dmg from the PETSc framework
4#
5# Make sure that "Enable access for assistive devices" is checked in System Preferences>>Universal Access. It is required for the AppleScript to work.
6#
7#  Before runningt this script follow the directions in ./systems/Apple/OSX/bin/makeframework  to make the Apple PETSc Framework
8#
9echo "Creating ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg from ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework"
10rm -rf pack.temp.dmg tempsource ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg
11mkdir tempsource
12cp -r ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework tempsource
13let size=`du  -c tempsource | tail -1 | cut -f1`
14let size=2*$size
15
16hdiutil create -srcfolder tempsource -volname PETSc -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${size}k pack.temp.dmg
17sleep 5
18device=`hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | head -1 | cut -f1`
19echo Created device $device
20echo '
21   tell application "Finder"
22     tell disk "PETSc"
23           open
24           set current view of container window to icon view
25           set toolbar visible of container window to false
26           set statusbar visible of container window to false
27           set the bounds of container window to {400, 100, 685, 430}
28           set theViewOptions to the icon view options of container window
29           set arrangement of theViewOptions to not arranged
30           set icon size of theViewOptions to 72
31           make new alias file at container window to POSIX file "/Library/Frameworks" with properties {name:"Frameworks"}
32           set position of item "'PETSc.framework'" of container window to {100, 100}
33           set position of item "Frameworks" of container window to {375, 100}
34           update without registering applications
35           delay 5
36           eject
37     end tell
38   end tell
39' | osascript
40sleep 8
41sync
42sync
43#hdiutil detach ${device}
44hdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg
45rm -rf pack.temp.dmg tempsource
46