From 8e148297c9ef0feda357265c91597d85769db6df Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Thu, 26 Mar 2009 02:29:06 +0000 Subject: - 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. --- Scripts/package-application.sh | 65 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 Scripts/package-application.sh (limited to 'Scripts') 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/.*CFBundleShortVersionString<\/key>\([^<]*\)<\/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 -- cgit v1.2.3