3
# === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
5
# Copyright 2011, John Maguire <john.maguire@gmail.com>
7
# Tomahawk is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
12
# Tomahawk is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
20
# author: max@last.fm, muesli@tomahawk-player.org
21
# brief: Produces a compressed DMG from a bundle directory
22
# usage: Pass the bundle directory as the only parameter
23
# note: This script depends on the UDJ build system, and must be run from
25
#Shamelessly stolen from the tomahawk project. Super thanks to them.
26
################################################################################
32
# echo VERSION must be set
38
echo "Please pass the bundle.app directory as the first parameter."
41
################################################################################
44
NAME=$(basename "$1" | perl -pe 's/(.*).app/\1/')
49
################################################################################
56
# create DMG contents and copy files
58
#mkdir -p "$TMP/.background"
59
#cp ../admin/mac/dmg_background.png "$TMP/.background/background.png"
60
#cp ../admin/mac/DS_Store.in "$TMP/.DS_Store"
61
#chmod go-rwx "$TMP/.DS_Store"
62
ln -s /Applications "$TMP/Applications"
63
# copies the prepared bundle into the dir that will become the DMG
67
hdiutil makehybrid -hfs -hfs-volume-name UDJ -hfs-openfolder "$TMP" "$TMP" -o tmp.dmg
68
hdiutil convert -format UDZO -imagekey zlib-level=9 tmp.dmg -o "$OUT"
73
#hdiutil create -srcfolder "$TMP" \
74
# -format UDZO -imagekey zlib-level=9 \
77
# || die "Error creating DMG :("
80
echo 'DMG size:' `du -hs "$OUT" | awk '{print $1}'`