forked from rentzsch/clicktoflash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_installer_pkg.command
executable file
·61 lines (52 loc) · 1.9 KB
/
build_installer_pkg.command
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
#!/bin/bash
cd "`dirname \"$0\"`"
SCRIPT_WD=`pwd`
if [ -z "$PROJECT_DIR" ]; then
# Script invoked outside of Xcode, figure out environmental vars for ourself.
PROJECT_DIR='..'
BUILT_PRODUCTS_DIR="$PROJECT_DIR/build/Release"
BUILD_STYLE='Release'
BUILT_PLUGIN="$BUILT_PRODUCTS_DIR/ClickToFlash.webplugin"
PRODUCT_VERSION=`/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$BUILT_PLUGIN/Contents/Info.plist"`
SYSTEM_DEVELOPER_UTILITIES_DIR='/Developer/Applications/Utilities'
fi
if [ $BUILD_STYLE != "Release" ]; then
echo "Could not generate package."
echo "Active Configuration needs to be set to 'Release'."
exit 1
fi
MY_INSTALLER_ROOT="$BUILT_PRODUCTS_DIR/ClickToFlash.dst"
BUILT_PLUGIN="$BUILT_PRODUCTS_DIR/ClickToFlash.webplugin"
BUILT_PKG="$BUILT_PRODUCTS_DIR/ClickToFlash.pkg" # Sparkle currently can't handle -$VERSION in .pkg names.
VERSIONED_NAME="ClickToFlash-$PRODUCT_VERSION"
BUILT_ZIP="$BUILT_PRODUCTS_DIR/$VERSIONED_NAME.zip"
# Delete old files if they're around.
if [ -d "$MY_INSTALLER_ROOT" ]; then
rm -rf "$MY_INSTALLER_ROOT"
fi
if [ -d "$BUILT_PKG" ]; then
rm -rf "$BUILT_PKG"
fi
if [ -f "$BUILT_ZIP" ]; then
rm -rf "$BUILT_ZIP"
fi
# Create the .pkg.
mkdir "$MY_INSTALLER_ROOT"
cp -R "$BUILT_PLUGIN" "$MY_INSTALLER_ROOT"
"$SYSTEM_DEVELOPER_UTILITIES_DIR/PackageMaker.app/Contents/MacOS/PackageMaker" \
--root "$BUILT_PRODUCTS_DIR/ClickToFlash.dst" \
--info Info.plist \
--resources resources \
--scripts scripts \
--target 10.4 \
--version "$PRODUCT_VERSION" \
--verbose \
--out "$BUILT_PKG"
# Stuff it into a .zip.
cd "$BUILT_PRODUCTS_DIR"
zip -r "$VERSIONED_NAME.zip" "ClickToFlash.pkg"
if [ -f "$HOME/Documents/releases/ClickToFlash/dsa_priv.pem" ]; then
`openssl dgst -sha1 -binary < "$VERSIONED_NAME.zip" | openssl dgst -dss1 -sign "$HOME/Documents/releases/ClickToFlash/dsa_priv.pem" | openssl enc -base64 > $VERSIONED_NAME.dsaSignature`
fi
cd "$SCRIPT_WD"
rm -rf "$MY_INSTALLER_ROOT"