1#!/bin/sh 2# 3# This script makes a Apple Mac OS X dmg from the PETSc framework and docset, see ./makeall 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# 7hdiutil detach /Volumes/PETSc 8# 9echo "Creating ${PETSC_DIR}/PETSc-OSX.dmg from frameworks in ${PETSC_DIR}/arch-osx-release and debug/PETSc-OSX and ${PETSC_DIR}/PETSc.docset" 10echo " and examples in ${PETSC_DIR}/systems/Apple/OSX/examples" 11 12rm -rf pack.temp.dmg tempsource ${PETSC_DIR}/PETSc-OSX.dmg 13mkdir tempsource 14cp -r ${PETSC_DIR}/arch-osx-release/PETSc-OSX tempsource 15cp -r ${PETSC_DIR}/arch-osx-debug/PETSc-OSX tempsource 16cp -r ${PETSC_DIR}/PETSc.docset tempsource 17cp -r ${PETSC_DIR}/systems/Apple/OSX/examples tempsource/PETSc-OSX.examples 18 19# copy the PETSc source for the examples into the example directories and modify the include to point to them 20# in the PETSc tree the examples point to the original source elsewhere in the PETSc tree 21cp ${PETSC_DIR}/src/snes/tutorials/ex19.c tempsource/PETSc-OSX.examples/PETSc\ command\ line\ example/PETSc\ command\ line\ example 22sed -i "" s?../../../../../../src/snes/tutorials/??g tempsource/PETSc-OSX.examples/PETSc\ command\ line\ example/PETSc\ command\ line\ example/main.c 23cp ${PETSC_DIR}/src/snes/tutorials/ex19.c tempsource/PETSc-OSX.examples/PETSc\ cocoa\ example/PETSc\ cocoa\ example 24sed -i "" s?../../../../../../src/snes/tutorials/??g tempsource/PETSc-OSX.examples/PETSc\ cocoa\ example/PETSc\ cocoa\ example/AppDelegate.m 25 26let size=`du -c tempsource | tail -1 | cut -f1` 27let size=2*$size 28 29hdiutil create -srcfolder tempsource -volname PETSc -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${size}k pack.temp.dmg 30sleep 5 31device=`hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | head -1 | cut -f1` 32echo Created device $device 33sleep 5 34echo " 35 tell application \"Finder\" 36 tell disk \"PETSc\" 37 open 38 set current view of container window to icon view 39 set toolbar visible of container window to false 40 set statusbar visible of container window to false 41 make new alias file at container window to POSIX file \"/Library/Frameworks\" with properties {name:\"Copy in PETSc-OSX\"} 42 make new alias file at container window to POSIX file \"${HOME}/Library/Developer/Shared/Documentation/DocSets\" with properties {name:\"Copy in PETSc.docset\"} 43 make new alias file at container window to (path to home folder) with properties {name:\"Copy in PETSc-OSX.examples\"} 44 eject 45 end tell 46 end tell 47" | osascript 48sleep 8 49sync 50sync 51echo 'Completed osascript' 52#hdiutil detach ${device} 53hdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o ${PETSC_DIR}/PETSc-OSX.dmg 54rm -rf pack.temp.dmg tempsource 55sync 56sleep 2 57hdiutil detach /Volumes/PETSc 58 59# set the bounds of container window to {400, 100, 885, 630} 60# set theViewOptions to the icon view options of container window 61# set icon size of theViewOptions to 72 62# set arrangement of theViewOptions to not arranged 63