From 4faa2819855dd8c5108640995f01e825d7939b14 Mon Sep 17 00:00:00 2001 From: mjwybrow Date: Sun, 23 Jul 2006 06:35:00 +0000 Subject: [PATCH] * macosx/osx-dmg.sh: Added code to allow packagers to create a new inkscape.ds_store file. --- packaging/macosx/osx-dmg.sh | 79 ++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 10 deletions(-) diff --git a/packaging/macosx/osx-dmg.sh b/packaging/macosx/osx-dmg.sh index 7402f6c10..0b11d4fe0 100755 --- a/packaging/macosx/osx-dmg.sh +++ b/packaging/macosx/osx-dmg.sh @@ -3,8 +3,9 @@ # Inkscape packaging script for Mac OS X # # The script creates a read-write disk image, -# copies Inkscape in it, customizes its appearance through -# an applescript and compresses the disk image for distribution +# copies Inkscape in it, customizes its appearance using a +# previously created .DS_Store file (inkscape.ds_store), +# and then compresses the disk image for distribution. # # Authors: # Jean-Olivier Irisson @@ -13,6 +14,28 @@ # Copyright 2006 # Licensed under GNU General Public License # +# +# How to update the disk image layout: +# ------------------------------------ +# +# Modify the 'dmg_background.svg' file and generate a new +# 'dmg_background.png' file. +# +# Update the AppleScript file 'dmg_set_style.scpt'. +# +# Run this script with the '-s' option. It will apply the +# 'dmg_set_style.scpt' AppleScript file, and then prompt the +# user to check the window size # and position before writing +# a new 'inkscape.ds_store' file to work around a bug in Finder +# and AppleScript. The updated 'inkscape.ds_store' will need +# to be commited to the repository when this is done. +# + +set_ds_store=false +if [ "$1" = "-s" ]; then + set_ds_store=true + shift +fi RWNAME="RWinkscape.dmg" VOLNAME="Inkscape" @@ -23,6 +46,7 @@ TMPDIR="/tmp/dmg-$$" rm -rf "$TMPDIR" mkdir "$TMPDIR" +echo "Copying files to temp directory..." # Copy Inkscape.app folder. cp -rf ../Inkscape.app "$TMPDIR"/ @@ -34,13 +58,18 @@ ln -sf /Applications "$TMPDIR"/ mkdir "$TMPDIR/.background" cp dmg_background.png "$TMPDIR/.background/background.png" -# Copy the .DS_Store file which contains information about window size, -# appearance, etc. Most of this can be set with Apple script but involves -# user intervention so we just keep a copy of the correct settings and -# use that instead. -cp inkscape.ds_store "$TMPDIR/.DS_Store" +AUTOOPENOPT= +if [ ${set_ds_store} = "false" ]; then + # Copy the .DS_Store file which contains information about + # window size, appearance, etc. Most of this can be set + # with Apple script but involves # user intervention so we + # just keep a copy of the correct settings and use that instead. + cp inkscape.ds_store "$TMPDIR/.DS_Store" + AUTOOPENOPT=-noautoopen +fi # Create a new RW image from the temp directory. +echo "Creating a new RW disk image..." rm -f "$RWNAME" /usr/bin/hdiutil create -srcfolder "tmp-dmg" -volname "$VOLNAME" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW "$RWNAME" @@ -48,14 +77,44 @@ rm -f "$RWNAME" rm -rf "$TMPDIR" # Mount the created image. +echo "Mounting the disk image..." MOUNT_DIR="/Volumes/$VOLNAME" -DEV_NAME=`/usr/bin/hdiutil attach -readwrite -noverify -noautoopen "$RWNAME" | egrep '^/dev/' | sed 1q | awk '{print $1}'` - -# /usr/bin/osascript dmg_set_style.scpt +DEV_NAME=`/usr/bin/hdiutil attach -readwrite -noverify $AUTOOPENOPT "$RWNAME" | egrep '^/dev/' | sed 1q | awk '{print $1}'` # Have the disk image window open automatically when mounted. bless -openfolder /Volumes/$VOLNAME +if [ ${set_ds_store} = "true" ]; then + /usr/bin/osascript dmg_set_style.scpt + + open "/Volumes/$VOLNAME" + # BUG: one needs to move and close the window manually for the + # changes in appearance to be retained... + echo " + ************************************** + * Please move the disk image window * + * to the center of the screen * + * then close it and press enter * + ************************************** + " + read -e DUMB + + # .DS_Store files aren't written till the disk is unmounted, + # or finder is restarted. + hdiutil detach "$DEV_NAME" + AUTOOPENOPT=-noautoopen + DEV_NAME=`/usr/bin/hdiutil attach -readwrite -noverify $AUTOOPENOPT "$RWNAME" | egrep '^/dev/' | sed 1q | awk '{print $1}'` + echo + echo "New inkscape.ds_store file written." + cp /Volumes/$VOLNAME/.DS_Store ./inkscape.ds_store + + # Unmount the disk image. + hdiutil detach "$DEV_NAME" + rm -f "$RWNAME" + + exit 0 +fi + # Unmount the disk image. hdiutil detach "$DEV_NAME" -- 2.30.2