JAL-3393 Updated DS_Store files, script and doc
authorBen Soares <bsoares@dundee.ac.uk>
Fri, 11 Mar 2022 17:49:44 +0000 (17:49 +0000)
committerBen Soares <bsoares@dundee.ac.uk>
Fri, 11 Mar 2022 17:49:44 +0000 (17:49 +0000)
doc/README-DMG_creation.md
utils/channels/develop/images/jalview_develop_dmg_DS_Store
utils/channels/release/images/jalview_dmg_DS_Store
utils/channels/test-release/images/jalview_test-release_dmg_DS_Store
utils/install4j/mk_ds_store.sh

index 6542b7c..566ad05 100644 (file)
@@ -3,7 +3,7 @@
 ## New method to make the DS_Store file from scratch (on a Mac)
 
 ```
-./utils/install4j/mk_ds_store.sh --name Jalview [--bgimg ./utils/channels/release/image/jalview_dmg_background.png] [--output ./utils/channels/release/image/jalview_dmg_DS_Store]
+./utils/install4j/mk_ds_store.sh --name Jalview [--volname "Jalview Installer (2.11.2.0)"] [--bgimg ./utils/channels/release/image/jalview_dmg_background.png] [--output ./utils/channels/release/image/jalview_dmg_DS_Store]
 ```
 
 A script that creates a new DMG with the top level items to be found in a Jalview Installer DMG, mounts the volume, then uses an AppleScript to adjust the background image, size and position of the icons, and appearance of the Finder window.
@@ -12,6 +12,8 @@ The .DS_Store is then copied out of the volume by the script, the volume unmount
 
 To use it, the NAME (of the application, without the `.app` extension) should be set in the script (set to "Jalview"), and the background image that you want to use should be copied to your working directory as `background.png` (or use the --bgimg option).
 
+While it is running you will see a styled Finder window appear.  The App icon will be broken as only a folder for the App is put in place, not an actual .app.
+
 Once it is run (only works on a Mac with osascript) it will leave a file Output-DS_Store in your working directory (or use the --output option).
 
 > This script borrows extensively from https://github.com/create-dmg/create-dmg
index f948c20..a63a3ce 100644 (file)
Binary files a/utils/channels/develop/images/jalview_develop_dmg_DS_Store and b/utils/channels/develop/images/jalview_develop_dmg_DS_Store differ
index 006f829..cb0d612 100644 (file)
Binary files a/utils/channels/release/images/jalview_dmg_DS_Store and b/utils/channels/release/images/jalview_dmg_DS_Store differ
index d03fc55..6730098 100644 (file)
Binary files a/utils/channels/test-release/images/jalview_test-release_dmg_DS_Store and b/utils/channels/test-release/images/jalview_test-release_dmg_DS_Store differ
index 9bbac91..c0cabbe 100755 (executable)
@@ -14,6 +14,8 @@ Usage: $(basename "$0") --name "Your Application Name" [options]
 Options:
   --name <name>
       The application name (without '.app' extension) (mandatory)
+  --volname <volname>
+      The Volume name of the DMG when mounted (defaults to "<name> Installer")
   --bgimg <pic.png>
       Path to your background image (defaults to background.png)
   --output <outputfile-dsstore>
@@ -30,10 +32,13 @@ BACKGROUNDIMG="background.png"
 OUTPUTNAME="Output-DS_Store"
 
 while [[ "${1:0:1}" = "-" ]]; do
-       case $1 in
-               --name)
-                       NAME="$2"
-                       shift; shift;;
+  case $1 in
+    --name)
+      NAME="$2"
+      shift; shift;;
+    --volname)
+      VOLNAME="$2"
+      shift; shift;;
     --bgimg)
       BACKGROUNDIMG="$2"
       shift; shift;;
@@ -50,18 +55,20 @@ if [[ -z "$NAME" ]]; then
   exit 1
 fi
 
+if [[ -z "$VOLNAME" ]]; then
+  VOLNAME="${NAME} Installer"
+fi
+
+APPNAME="${NAME}.app"
+
 WDIR=$(pwd)
 # make a relative path absolute as we'll be cd-ing to /tmp
 if [[ "${BACKGROUNDIMG#/}" = "${BACKGROUNDIMG}" ]]; then
   BACKGROUNDIMG="${WDIR}/${BACKGROUNDIMG}"
 fi
-
-# Note that VOLNAME is only for making the DS_Store file in. The final DMG can have a different Volume name
-# This temporary VOLNAME can be seen if you do `strings /Volume/Your DMG Name/.DS_Store` on the final .DS_Store
-# so we set this to something relatable to the application name.
-VOLNAME="${NAME// /_}_Installer"
-
-APPNAME="${NAME}.app"
+if [[ "${OUTPUTNAME#/}" = "${OUTPUTNAME}" ]]; then
+  OUTPUTNAME="${WDIR}/${OUTPUTNAME}"
+fi
 
 DMG="${VOLNAME}.dmg"
 # We set the Applications folder link to " " in the DMG
@@ -99,10 +106,10 @@ APPLICATIONSY=124
 TEXTSIZE=14
 ICONSIZE=76
 
-osascript - "$VOLNAME" "$APPNAME" <<EOF
-on run {volumeName, appName}
+osascript <<EOF
+on run
        tell application "Finder"
-               tell disk (volumeName as string)
+               tell disk "$VOLNAME"
                        open
                        
                        set theXOrigin to $WINX
@@ -133,17 +140,20 @@ on run {volumeName, appName}
                        
                        set background picture of opts to file ".background:background.png"
                        
-                       set position of item (appName as string) to {$APPX, $APPY}
+                       set position of item "$APPNAME" to {$APPX, $APPY}
                        set position of item "$APPLICATIONSFOLDERLINK" to {$APPLICATIONSX, $APPLICATIONSY}
 
                        tell container window
+                               set bounds to {theXOrigin, theYOrigin, theBottomRightX + 10, theBottomRightY + 10}
+                               delay 1
                                set bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
                        end tell
                        
                        close
                        open
 
-                       update every item
+                       update every item without registering applications
+                       delay 3
                end tell
        end tell
 end run
@@ -158,7 +168,7 @@ until [ -e "$DSSTORE" ] && grep background.png "$DSSTORE"; do
   echo "Waiting for \"$DSSTORE\" to update"
 done
 
-cp "$DSSTORE" "${WDIR}/${OUTPUTNAME}"
+cp "$DSSTORE" "$OUTPUTNAME"
 echo "Created new .DS_Store as \"$OUTPUTNAME\""
 
 umount "$VOLDIR"