forked from dustinrue/ControlPlane
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake_disk_image.sh
More file actions
executable file
·63 lines (50 loc) · 1.41 KB
/
make_disk_image.sh
File metadata and controls
executable file
·63 lines (50 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/sh
# make_disk_image.sh
# MarcoPolo
#
# Created by David Symonds on 17/02/07.
# Modified by Dustin Rue on 7/28/2011.
# Get version number
VERSION=`cat Info.plist | grep -A 1 'CFBundleShortVersionString' | \
tail -1 | sed "s/[<>]/|/g" | cut -d\| -f3`
APPNAME=ControlPlane
IMG=$APPNAME-$VERSION.dmg
CONFIGURATION=Release
APP=build/$CONFIGURATION/$APPNAME.app
ICON=graphics/cp-icon.icns
cd scripts
./update-oui.sh
./update-usb-data.sh
cd ..
xcodebuild -configuration "$CONFIGURATION" clean build
if [ ! -d "$APP" ]; then
echo "Something failed in the build process!"
exit 1
fi
# Create an initial disk image (32 megs)
if [ -f "$IMG" ]; then rm "$IMG"; fi
hdiutil create -size 32m -fs HFS+ -volname "$APPNAME-$VERSION" "$IMG" || exit 1
# Mount the disk image
hdiutil attach "$IMG" || exit 1
# Obtain device information
DEVS=$(hdiutil attach "$IMG" | grep HFS)
DEV=$(echo $DEVS | cut -d ' ' -f 1)
ROOT=$(echo $DEVS | cut -d ' ' -f 3)
# Copy files
cp -R $APP $ROOT
if [ -f "$ICON" ]; then
cp $ICON $ROOT/.VolumeIcon.icns
/Developer/Tools/SetFile -a C $ROOT
fi
# Unmount the disk image
hdiutil detach $DEV || exit 1
# Convert the disk image to read-only
TMP="tmp-${IMG}"
mv "$IMG" "$TMP"
hdiutil convert "$TMP" -format UDBZ -o "$IMG"
rm "$TMP"
# sign the file for Sparkle
# run a helper script exposing location of private key for Sparkle updates
. sparkle_env.sh
ls -l "$IMG"
ruby "$SIGNING_SCRIPT" "$IMG" "$PRIVATE_KEY"