| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | if [ -n "$1" ];then |
|---|
| 4 | UPLOAD=true |
|---|
| 5 | fi |
|---|
| 6 | CLEAN=true |
|---|
| 7 | |
|---|
| 8 | VERSION=3.0 |
|---|
| 9 | DMGFILE=/tmp/oggzcap-$VERSION.dmg |
|---|
| 10 | echo $DMGFILE |
|---|
| 11 | |
|---|
| 12 | BUILD=build/Release/OggZCap.app |
|---|
| 13 | VOLNAME=OggZCap |
|---|
| 14 | APPNAME=OggZCap.app |
|---|
| 15 | BGPIC=./dmgbg.png |
|---|
| 16 | |
|---|
| 17 | TMPFILE=/tmp/ogztmp.dmg |
|---|
| 18 | MNTPATH=/tmp/mnt/ |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | if [ -n "$CLEAN" ]; then |
|---|
| 23 | xcodebuild clean || exit |
|---|
| 24 | fi |
|---|
| 25 | xcodebuild ||exit |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | mkdir -p $MNTPATH |
|---|
| 32 | if [ -e $TMPFILE -o -e $DMGFILE -o ! -d $MNTPATH ]; then |
|---|
| 33 | echo "could not make DMG. (file exists?!)" |
|---|
| 34 | exit; |
|---|
| 35 | fi |
|---|
| 36 | |
|---|
| 37 | hdiutil create -megabytes 200 $TMPFILE |
|---|
| 38 | DiskDevice=$(hdid -nomount "${TMPFILE}" | grep Apple_HFS | cut -f 1 -d ' ') |
|---|
| 39 | newfs_hfs -v "${VOLNAME}" "${DiskDevice}" |
|---|
| 40 | |
|---|
| 41 | mount -t hfs "${DiskDevice}" "${MNTPATH}" |
|---|
| 42 | |
|---|
| 43 | cp -r ${BUILD} ${MNTPATH}/ |
|---|
| 44 | mkdir ${MNTPATH}/.background |
|---|
| 45 | BGFILE=$(basename $BGPIC) |
|---|
| 46 | cp -vi ${BGPIC} ${MNTPATH}/.background/${BGFILE} |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | echo ' |
|---|
| 50 | tell application "Finder" |
|---|
| 51 | tell disk "'${VOLNAME}'" |
|---|
| 52 | open |
|---|
| 53 | set current view of container window to icon view |
|---|
| 54 | set toolbar visible of container window to false |
|---|
| 55 | set statusbar visible of container window to false |
|---|
| 56 | set the bounds of container window to {400, 200, 800, 425} |
|---|
| 57 | set theViewOptions to the icon view options of container window |
|---|
| 58 | set arrangement of theViewOptions to not arranged |
|---|
| 59 | set icon size of theViewOptions to 64 |
|---|
| 60 | set background picture of theViewOptions to file ".background:'${BGFILE}'" |
|---|
| 61 | make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"} |
|---|
| 62 | set position of item "'${APPNAME}'" of container window to {100, 100} |
|---|
| 63 | set position of item "Applications" of container window to {310, 100} |
|---|
| 64 | close |
|---|
| 65 | open |
|---|
| 66 | update without registering applications |
|---|
| 67 | delay 3 |
|---|
| 68 | eject |
|---|
| 69 | end tell |
|---|
| 70 | end tell |
|---|
| 71 | ' | osascript |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | umount "${DiskDevice}" |
|---|
| 75 | hdiutil eject "${DiskDevice}" |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | hdiutil convert -format UDZO "${TMPFILE}" -imagekey zlib-level=9 -o "${DMGFILE}" |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | rm $TMPFILE |
|---|
| 82 | rmdir $MNTPATH |
|---|
| 83 | |
|---|
| 84 | if [ -n "$UPLOAD" ];then |
|---|
| 85 | scp $DMGFILE rg42.org:/var/sites/inout/docroot/software/ |
|---|
| 86 | fi |
|---|