aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts/package-application.sh
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-03-26 02:29:06 +0000
committerrowanbeentje <rowan@beent.je>2009-03-26 02:29:06 +0000
commit8e148297c9ef0feda357265c91597d85769db6df (patch)
tree4c310ed1669c92ea0e93ff02717a5026e391b2de /Scripts/package-application.sh
parent805aacd10db95bfe5db463a4a4e79efb8a9c8a95 (diff)
downloadsequelpro-8e148297c9ef0feda357265c91597d85769db6df.tar.gz
sequelpro-8e148297c9ef0feda357265c91597d85769db6df.tar.bz2
sequelpro-8e148297c9ef0feda357265c91597d85769db6df.zip
- Update Sparkle to 1.5b6 (from 1.5b1). This should address Issue #197 as soon as the new framework is used (ie before 0.9.6)
- Add a public key to the project and add a link to it in Info.plist for use by Sparkle when verifying future updates - Add a new build configuration (Distribution), and add a new script for use with only that configuration - constructs a basic disk image, asks for the private key file, and signs it.
Diffstat (limited to 'Scripts/package-application.sh')
-rwxr-xr-xScripts/package-application.sh65
1 files changed, 65 insertions, 0 deletions
diff --git a/Scripts/package-application.sh b/Scripts/package-application.sh
new file mode 100755
index 00000000..efe63717
--- /dev/null
+++ b/Scripts/package-application.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# package-application.sh
+# sequel-pro
+#
+# A very basic script to build and sign a disk image for Sequel Pro; based on better work by Stuart Connolly.
+#
+# Created by Rowan Beentje on 25/03/2009.
+# Copyright 2009 Sequel Pro Team. All rights reserved.
+
+# Ensure the path to the application has been supplied - should have occurred when the
+# script was run by selecting "Distribution" target and building.
+if [ $# -eq 0 ]
+then
+ echo 'The path to the application must be supplied when running this script.'
+ exit
+fi
+
+# Grab the version number from the info.plist file
+VERSION_NUMBER=`cat "${BUILT_PRODUCTS_DIR}/${TARGET_NAME}${WRAPPER_SUFFIX}/Contents/Info.plist" | tr -d "\n\t" | sed -e 's/.*<key>CFBundleShortVersionString<\/key><string>\([^<]*\)<\/string>.*/\1/'`
+
+# Define target disk image name and temporary names
+DMG_VOLUME_NAME="Sequel Pro ${VERSION_NUMBER}"
+DMG_NAME="sequel-pro-${VERSION_NUMBER}"
+DMG_BUILD_PATH="${BUILT_PRODUCTS_DIR}"
+DISTTEMP="${DMG_BUILD_PATH}/disttemp"
+
+# Remove any existing disk images and files with this name
+if [ -e "${DMG_BUILD_PATH}/${DMG_NAME}.dmg" ]
+then
+ rm -f "${DMG_BUILD_PATH}/${DMG_NAME}.dmg"
+fi
+if [ -e "${DMG_BUILD_PATH}/${DMG_NAME}.dmg.signature" ]
+then
+ rm -f "${DMG_BUILD_PATH}/${DMG_NAME}.dmg.signature"
+fi
+
+# Create a temporary folder to house the disk image contents
+mkdir "${DISTTEMP}"
+
+# Copy in the required distribution files
+cp -R "${BUILT_PRODUCTS_DIR}/${TARGET_NAME}${WRAPPER_SUFFIX}" "${DMG_BUILD_PATH}/disttemp"
+
+# Create a disk image
+hdiutil create -srcfolder "${DISTTEMP}" -volname "$DMG_VOLUME_NAME" -fs HFS+ -fsargs '-c c=64,a=16,e=16' -format UDRW "${DMG_BUILD_PATH}/${DMG_NAME}.temp.dmg" > /dev/null
+
+# Compress the disk image
+hdiutil convert "${DMG_BUILD_PATH}/${DMG_NAME}.temp.dmg" -format UDZO -imagekey lib-level=9 -o "${DMG_BUILD_PATH}/${DMG_NAME}.dmg" > /dev/null
+
+# Remove temporary files and copies
+rm -rf "${DISTTEMP}"
+rm "${DMG_BUILD_PATH}/${DMG_NAME}.temp.dmg"
+
+# Ask for the location of the private key to use when signing the disk image
+PRIVATE_KEY_LOCATION=`osascript <<-eof
+ tell application "Xcode"
+ set theKey to POSIX path of ((choose file with prompt "Please locate the private key (sequelpro-sparkle-private-key.pem) for signing:" ) as string)
+ end tell
+ theKey
+ eof`
+if [ -e "$PRIVATE_KEY_LOCATION" ]
+then
+ SIGNATURE=`openssl dgst -sha1 -binary < "${DMG_BUILD_PATH}/${DMG_NAME}.dmg" | openssl dgst -dss1 -sign "$PRIVATE_KEY_LOCATION" | openssl enc -base64`
+ echo "$SIGNATURE" > "${DMG_BUILD_PATH}/${DMG_NAME}.dmg.signature"
+fi \ No newline at end of file