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