1#!/bin/sh
2# Copyright 2009 Google Inc. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16PKG_DIR="$HOME/Desktop"
17
18if [ ! -d "cocoa" ]; then
19  echo "cocoa/ directory not find in pwd"
20  exit 1
21fi
22
23rm -Rf $PKG_DIR/namebench.app
24find cocoa/build/Release -name "*.pyc" -delete
25find cocoa/build/Release -name "*~" -delete
26find cocoa/build/Release -name "*." -delete
27cp -Rp cocoa/build/Release/namebench.app $PKG_DIR/
28# No longer required now that our Xcode project was setup properly.
29#tmp="/tmp/namebench-$$"
30#svn checkout http://namebench.googlecode.com/svn/trunk/ $tmp
31#rsync -va --exclude ".svn/" --exclude "*~" --exclude "*.pyc" $tmp/ $PKG_DIR/namebench.app/Contents/Resources/
32version=`grep "^VERSION" libnamebench/version.py | cut -d\' -f2`
33dmg="$PKG_DIR/namebench-${version}-Mac_OS_X.dmg"
34rm bundle.dmg
35if [ -f "$dmg" ]; then
36  rm -f "$dmg"
37fi
38hdiutil create -srcfolder $PKG_DIR/namebench.app bundle.dmg
39rm -Rf $PKG_DIR/namebench.app
40hdiutil convert -imagekey zlib-level=9 -format UDZO -o $dmg bundle.dmg
41open $dmg
42