## 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.
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
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>
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;;
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
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
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
echo "Waiting for \"$DSSTORE\" to update"
done
-cp "$DSSTORE" "${WDIR}/${OUTPUTNAME}"
+cp "$DSSTORE" "$OUTPUTNAME"
echo "Created new .DS_Store as \"$OUTPUTNAME\""
umount "$VOLDIR"