Changing the content of the DragNDrop DMG root folder.
======================================================

The files and links in this folder are populated by the WSJT-X CMake build script. There are install commands which are only run on Apple hosts, this is important because they will get installed at the install root on other platforms, which would be very bad on Linux for example since that is /usr normally!

The symlink to /Applications, the background image (derived from ".../artwork/DragNDrop Background.svg") and, the custom .DS_Store file (".../Darwin/wsjtx_DMG.DS_Store") are all handled specifically by the CPack DragNDrop packager so you don't need to install those.



Modifying the .DS_Store folder options for the DragNDrop DMG root folder.
=========================================================================

The DragNDrop installer is a generated a DMG file that has a custom .DS_Store file that defines the layout, background image and, folder view options of the DMG root folder.

To modify this file, first you need to make a DragNDrop package then mount the DMG file, then modify the root .DS_Store file using Finder. Once you are happy with the results, you check into source control the modified .DS_Store file and then future package builds will use that file.

The installer DMG is read only and shrunk to exactly the size of the contents, also the .DS_Store file is read only and the background image PNG file is hidden. You need to undo all of these things before changing the .DS_Store file. Don't forget to redo these things before checking in a new version of the custom .DS_Store file.

The following recipe shows how to amend the content and layout of the DMG root folder:

# convert the DMG to a R/W copy (substitute the DMG you have built)
hdiutil convert wsjtx-1.7.0-rc1-Darwin.dmg -format UDRW -o rw.dmg

# expand the R/W copy to make room for changes
# first find the current number of sectors
hdiutil resize -limits rw.dmg
# the output looks like:
#
#  min 	 cur 	 max
#109696	109696	33037872
#
# you need to increase the sector count to something a bit bigger than current
#  e.g. in this case use 110000
hdiutil resize -sectors 110000 rw.dmg

# now you can mount the R/W DMG
hdiutil attach rw.dmg

# make the .DS_Store file writeable
chmod 644 /Volumes/WSJT-X/.DS_Store

# now you can change Finder view options, rearrange icons etc. Remember that you are
# only changing the folder options, not the folder content as that is controlled by
# the install steps in the project CMakeLists.txt if you are adding or removing a file
# to the DMG root folder, you need to have changed the install steps before doing this
# procedure so the content changes are reflected in the installer DMG you start with.

# when you are happy with the layout etc. move the Finder window by any amount, this
# ensures that the .DS_Store file is updated from Finder's cache.

# make the .DS_Store file read only
chmod 444 /Volumes/WSJT-X/.DS_Store

# update the custom .DS_Store file in the source repository (NOTE the file name)
cp /Volumes/WSJT-X/.DS_Store .../wsjtx/wsjtx_DMG.DS_Store

# dismount and eject the R/W DMG and discard it
hdiutil detach /Volumes/WSJT-X
rm rw.dmg

# build a new package and try out the new installer to test your changes
# if all is well commit the changes

# That's all Folks!
