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