diff --git a/Installer/osx help/Duplicati-launcher b/Installer/osx help/Duplicati-launcher new file mode 100644 index 000000000..6d55c17e4 --- /dev/null +++ b/Installer/osx help/Duplicati-launcher @@ -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 \ No newline at end of file diff --git a/Installer/osx help/Duplicati.icns b/Installer/osx help/Duplicati.icns new file mode 100644 index 000000000..5ae573290 Binary files /dev/null and b/Installer/osx help/Duplicati.icns differ diff --git a/Installer/osx help/Info.plist b/Installer/osx help/Info.plist new file mode 100644 index 000000000..f7905a495 --- /dev/null +++ b/Installer/osx help/Info.plist @@ -0,0 +1,30 @@ + + + + + LSApplicationCategoryType + public.app-category.productivity + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.hexad.Duplicati + CFBundleDisplayName + Duplicati + CFBundleName + Duplicati + CFBundleExecutable + Duplicati + CFBundleIconFile + Duplicati.icns + CFBundleInfoDictionaryVersion + 6.0 + CFBundleShortVersionString + 1.3 + CFBundleVersion + 1.3.0.973 + CFBundleSignature + hand + NSAppleScriptEnabled + NO + + diff --git a/Installer/osx help/make-dmg-from-zip.sh b/Installer/osx help/make-dmg-from-zip.sh new file mode 100644 index 000000000..7eb9a08c5 --- /dev/null +++ b/Installer/osx help/make-dmg-from-zip.sh @@ -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" \ No newline at end of file diff --git a/Installer/osx help/template.dmg.bz2 b/Installer/osx help/template.dmg.bz2 new file mode 100644 index 000000000..85906c866 Binary files /dev/null and b/Installer/osx help/template.dmg.bz2 differ