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# 7echo "Creating ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg from ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework and ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset" 8rm -rf pack.temp.dmg tempsource ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg 9mkdir tempsource 10cp -r ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset ${PETSC_DIR}/systems/Apple/OSX/examples 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 18sleep 5 19echo ' 20 tell application "Finder" 21 tell disk "PETSc" 22 open 23 set current view of container window to icon view 24 set toolbar visible of container window to false 25 set statusbar visible of container window to false 26 make new alias file at container window to POSIX file "/Library/Frameworks" with properties {name:"Copy in PETSc.frameworks"} 27 make new alias file at container window to POSIX file "/Applications/Xcode.app/Contents/Developer/Documentation/DocSets" with properties {name:"Copy in PETSc.docset"} 28 make new alias file at container window to POSIX file "/Users/barrysmith/" with properties {name:"Copy in examples"} 29 eject 30 end tell 31 end tell 32' | osascript 33sleep 8 34sync 35sync 36echo 'Completed osascript' 37#hdiutil detach ${device} 38hdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg 39rm -rf pack.temp.dmg tempsource 40hdiutil detach /Volumes/PETSc 41 42# set the bounds of container window to {400, 100, 885, 630} 43# set theViewOptions to the icon view options of container window 44# set icon size of theViewOptions to 72 45# set arrangement of theViewOptions to not arranged 46