Skip to content

Commit

Permalink
Added initial support for exporting an installer dmg
Browse files Browse the repository at this point in the history
  • Loading branch information
HernanRivasAcosta committed Dec 27, 2013
1 parent 87a52e5 commit 6086338
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Build
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
buildConfiguration = "Release"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.png
10 changes: 0 additions & 10 deletions FreckleForMac/icons/build

This file was deleted.

12 changes: 0 additions & 12 deletions FreckleForMac/icons/source.svg

This file was deleted.

1 change: 1 addition & 0 deletions packager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.dmg
57 changes: 57 additions & 0 deletions packager/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Create a tmp folder that will hold the data to be placed in the dmg
rm -rf tmp
mkdir tmp
# Clean previous dmgs
rm *.dmg

# Create the background of the dmg
mkdir tmp/.background
convert -density 1024 -background none -resize 500x400 -extent 600x400 -gravity center source.svg tmp/.background/DMGBackground.png

# Add the .app
cp -r ../Build/Products/Release/FreckleForMac.app tmp/FreckleForMac.app

# Add an alias to Applications
#./make_alias /Applications/ tmp/.

# Create a dmg with the contents of the folder
hdiutil create temp.dmg -megabytes 100 -volname "FreckleForMacInstall" -fs HFS+ -format UDRW -scrub -srcfolder "tmp/"

chflags nouchg .

device=$(hdiutil attach -readwrite -noverify -noautoopen "temp.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}')

# Format the visual style of the dmg
echo '
tell application "Finder"
tell disk "'FreckleForMacInstall'"
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 {0, 0, 600, 400}
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:'DMGBackground.png'"
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
set position of item "'FreckleForMac.app'" of container window to {180, 300}
set position of item "Applications" of container window to {420, 300}
update without registering applications
delay 5
eject
end tell
end tell
' | osascript

#chmod -Rf go-w /Volumes/"FreckleForMacInstall"
sync
sync
hdiutil detach ${device}

# Encript it (make it read-only)
hdiutil convert temp.dmg -format UDCO -o FreckleForMac.dmg

# Cleanup
rm temp.dmg
rm -rf tmp
31 changes: 31 additions & 0 deletions packager/source.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6086338

Please sign in to comment.