| 1 | #!/bin/bash |
| 2 | |
| 3 | VERSION="2.6" |
| 4 | applicationName="CheeseCutter.app" |
| 5 | backgroundPictureName="background.png" |
| 6 | source="dist" |
| 7 | title="CheeseCutter ${VERSION}" |
| 8 | size=20000 |
| 9 | finalDMGName="CheeseCutter_${VERSION}.dmg" |
| 10 | |
| 11 | mkdir "${source}" |
| 12 | cp -r "${applicationName}" "${source}" |
| 13 | |
| 14 | hdiutil create -srcfolder "${source}" -volname "${title}" -fs HFS+ \ |
| 15 | -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${size}k pack.temp.dmg |
| 16 | device=$(hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | \ |
| 17 | egrep '^/dev/' | sed 1q | awk '{print $1}') |
| 18 | sleep 5 |
| 19 | mkdir /Volumes/"${title}"/.background |
| 20 | cp arch/background.png /Volumes/"${title}"/.background |
| 21 | cp -r tunes README COPYING Changelog /Volumes/"${title}"/ |
| 22 | |
| 23 | pushd /Volumes/"${title}" |
| 24 | ln -s /Applications |
| 25 | popd |
| 26 | |
| 27 | echo ' |
| 28 | tell application "Finder" |
| 29 | tell disk "'${title}'" |
| 30 | open |
| 31 | set current view of container window to icon view |
| 32 | set toolbar visible of container window to false |
| 33 | set statusbar visible of container window to false |
| 34 | set the bounds of container window to {400, 100, 885, 430} |
| 35 | set theViewOptions to the icon view options of container window |
| 36 | set arrangement of theViewOptions to not arranged |
| 37 | set icon size of theViewOptions to 72 |
| 38 | set background picture of theViewOptions to file ".background:'${backgroundPictureName}'" |
| 39 | delay 1 |
| 40 | set position of item "'${applicationName}'" of container window to {100, 100} |
| 41 | set position of item "Applications" of container window to {375, 100} |
| 42 | update without registering applications |
| 43 | close |
| 44 | open |
| 45 | delay 5 |
| 46 | eject |
| 47 | end tell |
| 48 | end tell |
| 49 | ' | osascript |
| 50 | |
| 51 | chmod -Rf go-w /Volumes/"${title}" |
| 52 | sync |
| 53 | sync |
| 54 | hdiutil detach ${device} |
| 55 | hdiutil convert pack.temp.dmg -format UDZO -imagekey zlib-level=9 -o ${finalDMGName} |
| 56 | rm pack.temp.dmg |