Nice .DMG for Mac OSX

This commit is contained in:
David Schmidt 2012-02-22 03:18:18 +00:00
parent e7ff3fbe25
commit 889e13cd7a
2 changed files with 74 additions and 1 deletions

View File

@ -45,7 +45,13 @@ gsportmac: $(OBJECTS) compile_time.o
cp -f 525.icns ../GSport.app/Contents/Resources/
cp -f 2mg.icns ../GSport.app/Contents/Resources/
touch '../GSport.app/Icon?'
cp -f ../config.template ../config.txt
rm -rf ../GSportDmg
mkdir ../GSportDmg
mkdir ../GSportDmg/GSport
mv ../GSport.app ../GSportDmg/GSport
cp -f ../config.template ../GSportDmg/GSport/config.txt
cp ../GSport.html ../GSportDmg/GSport/GSport.html
arch/mac/makedmg.sh .. GSportDmg GSport GSport 7
# Linux for X builds:
gsportx: $(OBJECTS) compile_time.o

67
src/arch/mac/makedmg.sh Executable file
View File

@ -0,0 +1,67 @@
#!/bin/sh
# mkdmg.sh - makes an OSX disk image from directory contents
# From Philip Weaver: http://www.informagen.com/JarBundler/DiskImage.html
BASE="$1"
SRC="$2"
DEST="$3"
VOLUME="$4"
MEGABYTES="$5"
echo Base Directory $1
echo Source $2
echo Destination $3
echo Volume $4
echo Megabytes $5
TEMP="TEMPORARY"
cd $BASE
hdiutil create -megabytes $MEGABYTES $DEST$TEMP.dmg -layout NONE
MY_DISK=`hdid -nomount $DEST$TEMP.dmg`
newfs_hfs -v $VOLUME $MY_DISK
hdiutil eject $MY_DISK
hdid $DEST$TEMP.dmg
chflags -R nouchg,noschg "$SRC"
ditto -rsrcFork -v "$SRC" "/Volumes/$VOLUME"
mkdir "/Volumes/$VOLUME/.background"
cp ./lib/arch/mac/GSportMacInstallBackground.png "/Volumes/$VOLUME/.background/background.png"
cp GSportDMG.icns "/Volumes/$VOLUME/.VolumeIcon.icns"
SetFile -c icns "/Volumes/$VOLUME/.VolumeIcon.icns"
SetFile -a C /Volumes/$VOLUME
./lib/arch/mac/setfileicon GSportFolder.icns /Volumes/$VOLUME/$VOLUME
rm -rf /Volumes/$VOLUME/.Trashes
rm -rf /Volumes/$VOLUME/.fseventsd
echo '
tell application "Finder"
tell disk "'${VOLUME}'"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 723, 305}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 72
#set background picture of theViewOptions to file ".background:background.png"
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
set position of item "'${VOLUME}'" of container window to {83, 101}
set position of item "Applications" of container window to {242, 101}
update without registering applications
close
open
delay 5
end tell
end tell
' | osascript
hdiutil eject $MY_DISK
hdiutil convert -format UDCO $DEST$TEMP.dmg -o $DEST$VOLUME.dmg
hdiutil internet-enable -yes $DEST$VOLUME.dmg
mv $DEST$VOLUME.dmg $DEST.dmg
rm $DEST$TEMP.dmg