Added build scripts and resources for building a .dmg from a zip release

git-svn-id: https://duplicati.googlecode.com/svn/trunk@995 59da171f-624f-0410-aa54-27559c288bec
This commit is contained in:
kenneth.skovhede@gmail.com
2011-11-16 20:06:03 +00:00
parent da0a9f5d75
commit e6ef0ae63d
5 changed files with 261 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
#!/bin/sh
#
# This is a stub script that allows .apps to be relocatable on OSX but still
# find the managed assembly.
#
# This is copied from the Mono macpack tool and modified to fit Duplicati
#
# The Mono Version Check is from here:
# http://mjhutchinson.com/journal/2010/01/24/creating_mac_app_bundle_for_gtk_app
#
PWD=`pwd`
# Fetch the path relative to the launch point where this shell script exists.
APP_PATH=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+3] != "") { if (patharr[idx] != "/") {printf("%s/", patharr[idx]); idx++ }} }'`
APP_NAME="Duplicati"
ASSEMBLY="Duplicati.exe"
export MONO_MWF_USE_CARBON_BACKEND=1
export GDIPLUS_NOX=1
#mono version check
REQUIRED_MAJOR=2
REQUIRED_MINOR=6
VERSION_TITLE="Cannot launch $APP_NAME"
VERSION_MSG="$APP_NAME requires the Mono Framework version $REQUIRED_MAJOR.$REQUIRED_MINOR or later."
DOWNLOAD_URL="http://www.go-mono.com/mono-downloads/download.html"
MONO_VERSION="$(mono --version | grep 'Mono JIT compiler version ' | cut -f5 -d\ )"
MONO_VERSION_MAJOR="$(echo $MONO_VERSION | cut -f1 -d.)"
MONO_VERSION_MINOR="$(echo $MONO_VERSION | cut -f2 -d.)"
if [ -z "$MONO_VERSION" ] \
|| [ $MONO_VERSION_MAJOR -lt $REQUIRED_MAJOR ] \
|| [ $MONO_VERSION_MAJOR -eq $REQUIRED_MAJOR -a $MONO_VERSION_MINOR -lt $REQUIRED_MINOR ]
then
osascript \
-e "set question to display dialog \"$VERSION_MSG\" with title \"$VERSION_TITLE\" buttons {\"Cancel\", \"Download...\"} default button 2" \
-e "if button returned of question is equal to \"Download...\" then open location \"$DOWNLOAD_URL\""
echo "$VERSION_TITLE"
echo "$VERSION_MSG"
exit 1
fi
# Move into the folder where all the assemblies are located
cd "$APP_PATH/Contents/Resources"
# Make a symlink so Duplicati shows up as "Duplicati" in ps and not as "mono"
if [ ! -d "./bin" ]; then mkdir bin ; fi
if [ ! -d "./bin" ]
then
# We cannot make the extra dir (most likely we are running on read-only medium)
# Instead we attempt to use exec to set the appname
OSX_VERSION=$(uname -r | cut -f1 -d.)
if [ $OSX_VERSION -lt 9 ]; then # If OSX version is 10.4
MONO_EXEC="exec mono"
else
MONO_EXEC="exec -a \"$APP_NAME\" mono"
fi
$MONO_EXEC "$ASSEMBLY"
else
# We can make the helper file, lets use that
if [ -f "./bin/$APP_NAME" ]; then rm -f "./bin/$APP_NAME" ; fi
ln -s `which mono` "./bin/$APP_NAME"
# Start Duplicati using the renamed symlink to Mono
"./bin/$APP_NAME" "$ASSEMBLY"
fi
Binary file not shown.
+30
View File
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.hexad.Duplicati</string>
<key>CFBundleDisplayName</key>
<string>Duplicati</string>
<key>CFBundleName</key>
<string>Duplicati</string>
<key>CFBundleExecutable</key>
<string>Duplicati</string>
<key>CFBundleIconFile</key>
<string>Duplicati.icns</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>1.3</string>
<key>CFBundleVersion</key>
<string>1.3.0.973</string>
<key>CFBundleSignature</key>
<string>hand</string>
<key>NSAppleScriptEnabled</key>
<string>NO</string>
</dict>
</plist>
+159
View File
@@ -0,0 +1,159 @@
#!/bin/sh
#
# DMG building script adopted from:
# http://el-tramo.be/git/fancy-dmg/plain/Makefile
#
WC_DMG=wc.dmg
WC_DIR=wc
TEMPLATE_DMG=template.dmg
SOURCE_FILES=Duplicati.app
OUTPUT=Duplicati.dmg
UNWANTED_FILES="sqlite-3.6.12.so sqlite3.dll linux-sqlite-readme.txt win-tools"
SHOW_USAGE_ERROR=
if [ "$#" -lt "1" ]
then
SHOW_USAGE_ERROR="No input file given"
fi
if [ "$#" -gt "2" ]
then
SHOW_USAGE_ERROR="Too many arguments"
fi
if [ -n "$SHOW_USAGE_ERROR" ]
then
echo "$SHOW_USAGE_ERROR"
echo
echo "Usage:"
echo "$0 \"Duplicati 1.3.zip\" [output.dmg]"
echo
exit
fi
if [ ! -f "$1" ]
then
echo "Input file $1 does not exist"
exit
fi
TEMPLATE_DMG_BZ2=`echo "$TEMPLATE_DMG.bz2"`
DELETE_DMG=0
if [ -f "$TEMPLATE_DMG_BZ2" ]
then
if [ -f "$TEMPLATE_DMG" ]
then
rm -rf "$TEMPLATE_DMG"
fi
bzip2 --decompress --keep --quiet "$TEMPLATE_DMG_BZ2"
DELETE_DMG=1
fi
if [ ! -f "$TEMPLATE_DMG" ]
then
echo "Template file $TEMPLATE_DMG not found"
exit
fi
TMP_FILENAME=`basename "$1"`
OUTPUT=`echo "${TMP_FILENAME%%.zip}.dmg"`
if [ "$#" -gt "1" ]
then
if [ -d "$2" ]
then
OUTPUT=`echo "${2%%/}/$OUTPUT"`
else
OUTPUT=$2
fi
fi
VERSION_NAME=`basename "$OUTPUT"`
VERSION_NAME=${VERSION_NAME%%.dmg}
if [ -e "$OUTPUT" ]
then
rm -rf "$OUTPUT"
fi
# Remove any existing work copy
if [ -e "Duplicati" ]
then
rm -rf Duplicati
fi
# Get the current binary distribution
echo "Extracting files"
unzip -q "$1"
if [ ! -d "Duplicati" ]
then
echo "After unzipping the file $1 there was no Duplicati directory, is the zip file correct?"
exit
fi
# Remove some of the files that we do not like
for FILE in "$UNWANTED_FILES"
do
if [ -e "$FILE" ]
then
rm -rf "$FILE"
fi
done
# Prepare a new dmg
echo "Building dmg"
if [ "$DELETE_DMG" -eq "1" ]
then
# If we have just extracted the dmg, use that as working copy
WC_DMG=$TEMPLATE_DMG
else
# Otherwise we want a copy so we kan keep the original fresh
cp "$TEMPLATE_DMG" "$WC_DMG"
fi
# Make a mount point and mount the new dmg
mkdir -p "$WC_DIR"
hdiutil attach "$WC_DMG" -noautoopen -quiet -mountpoint "$WC_DIR"
# Change the dmg name
echo "Setting dmg name to $VERSION_NAME"
diskutil quiet rename wc "$VERSION_NAME"
# Make the Duplicati.app structure, root folder should exist
if [ ! -d "$WC_DIR/Duplicati.app" ]
then
mkdir "$WC_DIR/Duplicati.app"
fi
mkdir "$WC_DIR/Duplicati.app/Contents"
mkdir "$WC_DIR/Duplicati.app/Contents/Resources"
mkdir "$WC_DIR/Duplicati.app/Contents/MacOS"
# Copy in contents
cp "Info.plist" "$WC_DIR/Duplicati.app/Contents/"
cp "Duplicati-launcher" "$WC_DIR/Duplicati.app/Contents/MacOS/Duplicati"
cp -R "./Duplicati/"* "$WC_DIR/Duplicati.app/Contents/Resources"
cp "Duplicati.icns" "$WC_DIR/Duplicati.app/Contents/Resources"
chmod +x "$WC_DIR/Duplicati.app/Contents/MacOS/Duplicati"
# Unmount the dmg
hdiutil detach "$WC_DIR" -quiet -force
# Compress the dmg
hdiutil convert "$WC_DMG" -quiet -format UDZO -imagekey zlib-level=9 -o "$OUTPUT"
# Clean up
rm -rf "$WC_DMG"
rm -rf "$WC_DIR"
rm -rf "Duplicati"
echo "Done, created $OUTPUT"
Binary file not shown.