comparison deploy/osx/deploy.sh @ 409:27446c7f3935

Some deployment gubbins (to be refined)
author Chris Cannam
date Fri, 08 Apr 2011 14:33:27 +0100
parents
children 44741262c2e0
comparison
equal deleted inserted replaced
408:9d1dd846238b 409:27446c7f3935
1 #!/bin/bash
2
3 # Execute this from the top-level directory of the project (the one
4 # that contains the .app bundle). Supply the name of the .app bundle
5 # as argument (the target will use $app.app regardless, but we need
6 # to know the source)
7
8 source="$1"
9 dmg="$2"
10 if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then
11 echo "Usage: $0 <source.app> <target-dmg-basename>"
12 exit 2
13 fi
14 app=`basename "$source" .app`
15
16 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
17 case "$version" in
18 [0-9].[0-9]) bundleVersion="$version".0 ;;
19 [0-9].[0-9].[0-9]) bundleVersion="$version" ;;
20 *) echo "Error: Version $version is neither two- nor three-part number" ;;
21 esac
22
23 echo
24 echo "Making target tree."
25
26 volume="$app"-"$version"
27 target="$volume"/"$app".app
28 dmg="$dmg"-"$version".dmg
29
30 mkdir "$volume" || exit 1
31
32 ln -s /Applications "$volume"/Applications
33 cp -rp "$source" "$target"
34
35 echo "Done"
36
37 echo "Writing version $bundleVersion in to bundle."
38 echo "(This should be a three-part number: major.minor.point)"
39
40 perl -p -e "s/SV_VERSION/$bundleVersion/" deploy/osx/Info.plist \
41 > "$target"/Contents/Info.plist
42
43 echo "Done: check $target/Contents/Info.plist for sanity please"
44
45 echo
46 echo "Making dmg..."
47
48 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" &&
49 rm -r "$volume"
50
51 echo "Done"