annotate deploy/osx/deploy.sh @ 433:c20da4213406

Part-way through a more effective version using standard python ConfigParser
author Chris Cannam
date Tue, 28 Jun 2011 10:22:09 +0100
parents 2d3f1e5d8638
children cd3dd285d0ff
rev   line source
Chris@232 1 #!/bin/bash
Chris@232 2
Chris@232 3 # Execute this from the top-level directory of the project (the one
Chris@366 4 # that contains the .app bundle). Supply the name of the .app bundle
Chris@366 5 # as argument (the target will use $app.app regardless, but we need
Chris@366 6 # to know the source)
Chris@232 7
Chris@366 8 source="$1"
Chris@366 9 dmg="$2"
Chris@366 10 if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then
Chris@366 11 echo "Usage: $0 <source.app> <target-dmg-basename>"
Chris@366 12 exit 2
Chris@366 13 fi
Chris@232 14 app=EasyMercurial
Chris@232 15
Chris@372 16 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' src/version.h`
Chris@260 17 case "$version" in
Chris@260 18 [0-9].[0-9]) bundleVersion="$version".0 ;;
Chris@260 19 [0-9].[0-9].[0-9]) bundleVersion="$version" ;;
Chris@260 20 *) echo "Error: Version $version is neither two- nor three-part number" ;;
Chris@260 21 esac
Chris@232 22
Chris@232 23 echo
Chris@366 24 echo "Making target tree."
Chris@366 25
Chris@366 26 volume="$app"-"$version"
Chris@366 27 target="$volume"/"$app".app
Chris@366 28 dmg="$dmg"-"$version".dmg
Chris@366 29
Chris@366 30 mkdir "$volume" || exit 1
Chris@366 31
Chris@366 32 ln -s /Applications "$volume"/Applications
Chris@366 33 cp -rp "$source" "$target"
Chris@366 34
Chris@366 35 echo "Done"
Chris@366 36
Chris@232 37 echo "Writing version $bundleVersion in to bundle."
Chris@232 38 echo "(This should be a three-part number: major.minor.point)"
Chris@232 39
Chris@232 40 perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@366 41 > "$target"/Contents/Info.plist
Chris@232 42
Chris@366 43 echo "Done: check $target/Contents/Info.plist for sanity please"
Chris@256 44
Chris@256 45 echo
Chris@232 46 echo "Making dmg..."
Chris@232 47
Chris@366 48 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" &&
Chris@366 49 rm -r "$volume"
Chris@232 50
Chris@232 51 echo "Done"