Chris@232: #!/bin/bash Chris@232: Chris@232: # Execute this from the top-level directory of the project (the one Chris@366: # that contains the .app bundle). Supply the name of the .app bundle Chris@366: # as argument (the target will use $app.app regardless, but we need Chris@366: # to know the source) Chris@232: Chris@366: source="$1" Chris@366: dmg="$2" Chris@366: if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then Chris@366: echo "Usage: $0 " Chris@366: exit 2 Chris@366: fi Chris@232: app=EasyMercurial Chris@232: Chris@372: version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' src/version.h` Chris@260: case "$version" in Chris@260: [0-9].[0-9]) bundleVersion="$version".0 ;; Chris@260: [0-9].[0-9].[0-9]) bundleVersion="$version" ;; Chris@260: *) echo "Error: Version $version is neither two- nor three-part number" ;; Chris@260: esac Chris@232: Chris@232: echo Chris@366: echo "Making target tree." Chris@366: Chris@366: volume="$app"-"$version" Chris@366: target="$volume"/"$app".app Chris@366: dmg="$dmg"-"$version".dmg Chris@366: Chris@366: mkdir "$volume" || exit 1 Chris@366: Chris@366: ln -s /Applications "$volume"/Applications Chris@366: cp -rp "$source" "$target" Chris@366: Chris@366: echo "Done" Chris@366: Chris@232: echo "Writing version $bundleVersion in to bundle." Chris@232: echo "(This should be a three-part number: major.minor.point)" Chris@232: Chris@232: perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \ Chris@366: > "$target"/Contents/Info.plist Chris@232: Chris@366: echo "Done: check $target/Contents/Info.plist for sanity please" Chris@256: Chris@256: echo Chris@232: echo "Making dmg..." Chris@232: Chris@366: hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" && Chris@366: rm -r "$volume" Chris@232: Chris@232: echo "Done"