JAL-4421 Also add DMG filename to python script. Necessitates DS_Store for x64 and...
authorBen Soares <b.soares@dundee.ac.uk>
Mon, 3 Jun 2024 18:13:40 +0000 (19:13 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Mon, 3 Jun 2024 18:13:40 +0000 (19:13 +0100)
build.gradle
utils/install4j/install4j10_template.install4j
utils/macos_dmg/jalview_customise_dsstore.py

index 044242c..f8a6a20 100644 (file)
@@ -247,7 +247,8 @@ ext {
   install4jPngIconFile = string("${install4j_images_dir}/${install4j_png_icon_file}")
   install4jBackground = string("${install4j_images_dir}/${install4j_background}")
   install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}"
-  install4jDMGFixedDSStore = "${install4jBuildDir}/${install4j_dmg_ds_store}"
+  install4jDMGFixedDSStoreX64 = "build/macos_dmg/${install4j_dmg_ds_store}-x64"
+  install4jDMGFixedDSStoreAarch64 = "build/macos_dmg/${install4j_dmg_ds_store}-aarch64"
   install4jCheckSums = true
 
   applicationName = "${jalview_name}"
@@ -438,7 +439,7 @@ ext {
                                     .replaceAll("_+", "_") // collapse __
                                     .replaceAll("_*-_*", "-") // collapse _-_
                                     .toLowerCase()
-  install4jmacOSArchiveX86Name = "${install4jmacOSArchiveName} (Intel)"
+  install4jmacOSArchiveX64Name = "${install4jmacOSArchiveName} (Intel)"
   install4jmacOSArchiveAarch64Name = "${install4jmacOSArchiveName} (Apple Silicon)"
 
   getdownWrapperLink = install4jUnixApplicationFolder // e.g. "jalview_local"
@@ -537,6 +538,9 @@ ext {
   if (install4jHomeDir.startsWith("~/")) {
     install4jHomeDir = System.getProperty("user.home") + install4jHomeDir.substring(1)
   }
+  install4jmacOSArchiveX64DMGFilename = "${install4jApplicationFolder}-${JALVIEW_VERSION}-macos-x64-java_${JAVA_INTEGER_VERSION}"
+  install4jmacOSArchiveAarch64DMGFilename = "${install4jApplicationFolder}-${JALVIEW_VERSION}-macos-aarch64-java_${JAVA_INTEGER_VERSION}"
+
 
   resourceBuildDir = string("${buildDir}/resources")
   resourcesBuildDir = string("${resourceBuildDir}/resources_build")
@@ -2840,13 +2844,43 @@ python {
   pip 'ds_store:1.3.1'
 }
 
-task install4jCustomiseDS_Store(type: PythonTask) {
+task install4jCustomiseDS_StoreX64(type: PythonTask) {
   inputs.file(install4jDMGDSStore)
   inputs.file(install4jDMGDSStoreJSON)
-  outputs.file(install4jDMGFixedDSStore)
-  command = [ jalview_customise_ds_store, '--input', install4jDMGDSStore, '--output', install4jDMGFixedDSStore, '--volumename', install4jmacOSArchiveName, '--background', install4j_dmg_background_filename, '--config', install4jDMGDSStoreJSON ]
+  outputs.file(install4jDMGFixedDSStoreX64)
+  def command_args = [ jalview_customise_ds_store, '--input', install4jDMGDSStore, '--output', install4jDMGFixedDSStoreX64, '--volumename', install4jmacOSArchiveX64Name, '--backgroundfile', install4j_dmg_background_filename, '--dmg', install4jmacOSArchiveX64DMGFilename + ".dmg" ]
+  if (file(install4jDMGDSStoreJSON).exists()) {
+    command_args += [ '--config', install4jDMGDSStoreJSON ]
+  }
+  command = command_args
+  doFirst {
+    println("Running command '${command_args.join(' ')}'")
+  }
 }
 
+task install4jCustomiseDS_StoreAarch64(type: PythonTask) {
+  inputs.file(install4jDMGDSStore)
+  inputs.file(install4jDMGDSStoreJSON)
+  outputs.file(install4jDMGFixedDSStoreAarch64)
+  def command_args = [ jalview_customise_ds_store, '--input', install4jDMGDSStore, '--output', install4jDMGFixedDSStoreAarch64, '--volumename', install4jmacOSArchiveAarch64Name, '--backgroundfile', install4j_dmg_background_filename, '--dmg', install4jmacOSArchiveAarch64DMGFilename + ".dmg" ]
+  if (file(install4jDMGDSStoreJSON).exists()) {
+    command_args += [ '--config', install4jDMGDSStoreJSON ]
+  }
+  command = command_args
+  doFirst {
+    def print_args = []
+    for (int i = 0; i < command_args.size(); i++) {
+      def arg = command_args[i]
+      print_args += (i > 0 && !arg.startsWith("-")) ? "\"${arg}\"" : arg
+    }
+    println("Running command '${print_args.join(' ')}'")
+  }
+}
+
+task install4jCustomiseDS_Store {
+  dependsOn install4jCustomiseDS_StoreX64
+  dependsOn install4jCustomiseDS_StoreAarch64
+}
 
 task install4jDMGProcesses {
   dependsOn install4jDMGBackgroundImageProcess
@@ -2898,7 +2932,8 @@ task installerFiles(type: com.install4j.gradle.Install4jTask) {
     'BUNDLE_ID': install4jBundleId,
     'INTERNAL_ID': install4jInternalId,
     'WINDOWS_APPLICATION_ID': install4jWinApplicationId,
-    'MACOS_DMG_DS_STORE': install4jDMGFixedDSStore,
+    'MACOS_X64_DMG_DS_STORE': install4jDMGFixedDSStoreX64,
+    'MACOS_AARCH64_DMG_DS_STORE': install4jDMGFixedDSStoreAarch64,
     'MACOS_DMG_BG_IMAGE': "${install4jDMGBackgroundImageBuildDir}/${install4jDMGBackgroundImageFile}",
     'MACOS_DMG_BG_FILENAME': install4j_dmg_background_filename,
     'WRAPPER_LINK': getdownWrapperLink,
@@ -2906,7 +2941,7 @@ task installerFiles(type: com.install4j.gradle.Install4jTask) {
     'POWERSHELL_WRAPPER_SCRIPT': getdown_powershell_wrapper_script,
     'BATCH_WRAPPER_SCRIPT': getdown_batch_wrapper_script,
     'WRAPPER_SCRIPT_BIN_DIR': getdown_wrapper_script_dir,
-    'MACOSARCHIVE_X86_NAME': install4jmacOSArchiveX86Name,
+    'MACOSARCHIVE_X64_NAME': install4jmacOSArchiveX64Name,
     'MACOSARCHIVE_AARCH64_NAME': install4jmacOSArchiveAarch64Name,
     'INSTALL4J_UTILS_DIR': install4j_utils_dir,
     'GETDOWN_CHANNEL_DIR': getdownChannelDir,
@@ -2926,6 +2961,8 @@ task installerFiles(type: com.install4j.gradle.Install4jTask) {
     'WINDOWS_ICONS_FILE': install4jWindowsIconsFile,
     'PNG_ICON_FILE': install4jPngIconFile,
     'BACKGROUND': install4jBackground,
+    'MACOSARCHIVE_X64_DMG_FILENAME': install4jmacOSArchiveX64DMGFilename,
+    'MACOSARCHIVE_AARCH64_DMG_FILENAME': install4jmacOSArchiveAarch64DMGFilename,
   ]
 
   def varNameMap = [
index 39c0b48..b118189 100644 (file)
       <variable name="JAVA_VERSION" value="11" />
       <variable name="JAVA_INTEGER_VERSION" value="11" />
       <variable name="VERSION" value="DEVELOPMENT" />
-      <variable name="MACOS_X86_JAVA_VM_DIR" value="${compiler:env.HOME}/buildtools/jre/jre-${compiler:JAVA_INTEGER_VERSION}-mac-x/jre" />
+      <variable name="MACOS_X64_JAVA_VM_DIR" value="${compiler:env.HOME}/buildtools/jre/jre-${compiler:JAVA_INTEGER_VERSION}-mac-x/jre" />
       <variable name="MACOS_AARCH64_JAVA_VM_DIR" value="${compiler:env.HOME}/buildtools/jre/jre-${compiler:JAVA_INTEGER_VERSION}-mac-aarch64/jre" />
-      <variable name="WINDOWS_X86_JAVA_VM_DIR" value="${compiler:env.HOME}/buildtools/jre/jre-${compiler:JAVA_INTEGER_VERSION}-windows-x64/jre" />
-      <variable name="LINUX_X86_JAVA_VM_DIR" value="${compiler:env.HOME}/buildtools/jre/jre-${compiler:JAVA_INTEGER_VERSION}-linux-x64/jre" />
+      <variable name="WINDOWS_X64_JAVA_VM_DIR" value="${compiler:env.HOME}/buildtools/jre/jre-${compiler:JAVA_INTEGER_VERSION}-windows-x64/jre" />
+      <variable name="LINUX_X64_JAVA_VM_DIR" value="${compiler:env.HOME}/buildtools/jre/jre-${compiler:JAVA_INTEGER_VERSION}-linux-x64/jre" />
       <variable name="LINUX_AARCH64_JAVA_VM_DIR" value="${compiler:env.HOME}/buildtools/jre/jre-${compiler:JAVA_INTEGER_VERSION}-linux-aarch64/jre" />
-      <variable name="MACOS_X86_JAVA_VM_TGZ" value="${compiler:env.HOME}/buildtools/jre/tgz/jre_${compiler:JAVA_INTEGER_VERSION}_mac_x64.tar.gz" />
+      <variable name="MACOS_X64_JAVA_VM_TGZ" value="${compiler:env.HOME}/buildtools/jre/tgz/jre_${compiler:JAVA_INTEGER_VERSION}_mac_x64.tar.gz" />
       <variable name="MACOS_AARCH64_JAVA_VM_TGZ" value="${compiler:env.HOME}/buildtools/jre/tgz/jre_${compiler:JAVA_INTEGER_VERSION}_mac_aarch64.tar.gz" />
-      <variable name="WINDOWS_X86_JAVA_VM_TGZ" value="${compiler:env.HOME}/buildtools/jre/tgz/jre_${compiler:JAVA_INTEGER_VERSION}_windows_x64.tar.gz" />
-      <variable name="LINUX_X86_JAVA_VM_TGZ" value="${compiler:env.HOME}/buildtools/jre/tgz/jre_${compiler:JAVA_INTEGER_VERSION}_linux_x64.tar.gz" />
+      <variable name="WINDOWS_X64_JAVA_VM_TGZ" value="${compiler:env.HOME}/buildtools/jre/tgz/jre_${compiler:JAVA_INTEGER_VERSION}_windows_x64.tar.gz" />
+      <variable name="LINUX_X64_JAVA_VM_TGZ" value="${compiler:env.HOME}/buildtools/jre/tgz/jre_${compiler:JAVA_INTEGER_VERSION}_linux_x64.tar.gz" />
       <variable name="LINUX_AARCH64_JAVA_VM_TGZ" value="${compiler:env.HOME}/buildtools/jre/tgz/jre_${compiler:JAVA_INTEGER_VERSION}_linux_aarch64.tar.gz" />
       <variable name="COPYRIGHT_MESSAGE" value="..." />
       <variable name="BUNDLE_ID" value="org.jalview.jalview-desktop" />
       <variable name="INTERNAL_ID" value="Jalview" />
       <variable name="WINDOWS_APPLICATION_ID" value="6595-2347-1923-0725" />
+      <variable name="MACOS_X64_DMG_DS_STORE" value="utils/channels/default/images/jalview_default_dmg_DS_Store" />
+      <variable name="MACOS_AARCH64_DMG_DS_STORE" value="utils/channels/default/images/jalview_default_dmg_DS_Store" />
       <variable name="MACOS_DMG_DS_STORE" value="utils/channels/default/images/jalview_default_dmg_DS_Store" />
       <variable name="MACOS_DMG_BG_IMAGE" value="utils/channels/default/images/jalview_default_dmg_background-72dpi.png" />
       <variable name="MACOS_DMG_BG_FILENAME" value="background.png" />
       <variable name="WRAPPER_LINK" value="jalview" />
       <variable name="BASH_WRAPPER_SCRIPT" value="jalview.sh" />
       <variable name="WRAPPER_SCRIPT_BIN_DIR" value="bin" />
-      <variable name="MACOSARCHIVE_X86_NAME" value="Install Jalview (Intel)" />
+      <variable name="MACOSARCHIVE_X64_NAME" value="Install Jalview (Intel)" />
       <variable name="MACOSARCHIVE_AARCH64_NAME" value="Install Jalview (Apple Silicon)" />
       <variable name="INSTALL4J_UTILS_DIR" value="utils/install4j" />
       <variable name="GETDOWN_CHANNEL_DIR" value="build/website/docroot/getdown/default" />
@@ -66,6 +68,8 @@
       <variable name="POWERSHELL_WRAPPER_SCRIPT" value="jalview.ps1" />
       <variable name="WIZARD_WIDTH" value="640" description="Default/initial width of installer wizard window.  Linux media types adapt this.&#xA;NOT USED" />
       <variable name="WIZARD_HEIGHT" value="480" description="Default/initial width of installer wizard window.  Linux media types adapt this.&#xA;NOT USED" />
+      <variable name="MACOSARCHIVE_X64_DMG_FILENAME" value="${compiler:APPLICATION_FOLDER}-${compiler:JALVIEW_VERSION}-${compiler:sys.platform}-x64-java_${compiler:JAVA_INTEGER_VERSION}" />
+      <variable name="MACOSARCHIVE_AARCH64_DMG_FILENAME" value="${compiler:APPLICATION_FOLDER}-${compiler:JALVIEW_VERSION}-${compiler:sys.platform}-aarch64-java_${compiler:JAVA_INTEGER_VERSION}" />
     </variables>
     <codeSigning macEnabled="true" macPkcs12File="${compiler:OSX_KEYSTORE}" macNotarize="true" appleId="${compiler:OSX_APPLEID}">
       <macAdditionalBinaries>
   <files defaultUninstallMode="2">
     <filesets>
       <fileset name="Full file set" id="734" customizedId="FULL_FILE_SET" />
-      <fileset name="macOS x64 JVM" id="2801" customizedId="MACOS_X86_JVM" />
+      <fileset name="macOS x64 JVM" id="2801" customizedId="MACOS_X64_JVM" />
       <fileset name="macOS aarch64 JVM" id="2803" customizedId="MACOS_AARCH64_JVM" />
     </filesets>
     <roots>
       </dirEntry>
       <dirEntry mountPoint="736" file="${compiler:JALVIEW_DIR}/examples" overwriteMode="1" uninstallMode="2" overrideFileMode="true" overrideOverwriteMode="true" overrideUninstallMode="true" entryMode="subdir" subDirectory="examples" />
       <dirEntry mountPoint="736" file="${compiler:JALVIEW_DIR}/${compiler:GETDOWN_CHANNEL_DIR}/${compiler:JAVA_VERSION}/${compiler:WRAPPER_SCRIPT_BIN_DIR}" fileMode="755" overrideFileMode="true" overrideUninstallMode="true" entryMode="subdir" subDirectory="${compiler:WRAPPER_SCRIPT_BIN_DIR}" overrideDirMode="true" />
-      <dirEntry mountPoint="2805" file="${compiler:MACOS_X86_JAVA_VM_DIR}" overwriteMode="1" fileMode="755" uninstallMode="2" overrideFileMode="true" overrideOverwriteMode="true" overrideUninstallMode="true" entryMode="subdir" subDirectory="${compiler:JRE_DIR}" />
+      <dirEntry mountPoint="2805" file="${compiler:MACOS_X64_JAVA_VM_DIR}" overwriteMode="1" fileMode="755" uninstallMode="2" overrideFileMode="true" overrideOverwriteMode="true" overrideUninstallMode="true" entryMode="subdir" subDirectory="${compiler:JRE_DIR}" />
       <dirEntry mountPoint="2806" file="${compiler:MACOS_AARCH64_JAVA_VM_DIR}" overwriteMode="1" fileMode="755" uninstallMode="2" overrideFileMode="true" overrideOverwriteMode="true" overrideUninstallMode="true" entryMode="subdir" subDirectory="${compiler:JRE_DIR}" />
     </entries>
     <components>
@@ -1495,18 +1499,18 @@ ${compiler:JALVIEW_APPLICATION_NAME} will now launch.</property>
         <entry filesetId="2801" />
         <entry filesetId="2803" />
       </exclude>
-      <jreBundle jreBundleSource="preCreated" includedJre="${compiler:WINDOWS_X86_JAVA_VM_TGZ}" manualJreEntry="true" />
+      <jreBundle jreBundleSource="preCreated" includedJre="${compiler:WINDOWS_X64_JAVA_VM_TGZ}" manualJreEntry="true" />
     </windows>
-    <macosArchive name="macOS (Intel) Disk Image" id="878" customizedId="MACOS-X64-DMG" mediaFileName="${compiler:APPLICATION_FOLDER}-${compiler:JALVIEW_VERSION}-${compiler:sys.platform}-x64-java_${compiler:JAVA_INTEGER_VERSION}" volumeName="${compiler:MACOSARCHIVE_X86_NAME}" launcherId="737" setupAppId="2746">
+    <macosArchive name="macOS (Intel) Disk Image" id="878" customizedId="MACOS-X64-DMG" mediaFileName="${compiler:MACOSARCHIVE_X64_DMG_FILENAME}" volumeName="${compiler:MACOSARCHIVE_X64_NAME}" launcherId="737" setupAppId="2746">
       <exclude>
         <entry defaultFileset="true" />
         <entry filesetId="2803" />
       </exclude>
-      <jreBundle jreBundleSource="none" includedJre="${compiler:MACOS_X86_JAVA_VM_TGZ}" manualJreEntry="true" />
+      <jreBundle jreBundleSource="none" includedJre="${compiler:MACOS_X64_JAVA_VM_TGZ}" manualJreEntry="true" />
       <topLevelFiles>
         <symlink name="&quot; &quot;" target="/Applications" />
         <file name=".background/${compiler:MACOS_DMG_BG_FILENAME}" file="${compiler:JALVIEW_DIR}/${compiler:MACOS_DMG_BG_IMAGE}" />
-        <file name=".DS_Store" file="${compiler:JALVIEW_DIR}/${compiler:MACOS_DMG_DS_STORE}" />
+        <file name=".DS_Store" file="${compiler:JALVIEW_DIR}/${compiler:MACOS_X64_DMG_DS_STORE}" />
         <file name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/Resources/Jalview-File.icns" file="${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/Jalview-File.icns" />
         <file name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/Resources/jvl_file.icns" file="${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/jvl_file.icns" />
         <symlink name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/MacOS/${compiler:WRAPPER_LINK}" target="../Resources/app/${compiler:WRAPPER_SCRIPT_BIN_DIR}/${compiler:BASH_WRAPPER_SCRIPT}" />
@@ -1514,7 +1518,7 @@ ${compiler:JALVIEW_APPLICATION_NAME} will now launch.</property>
         <symlink name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/Resources/app/jre/Contents/Home/bin/${compiler:JALVIEW_NAME}" target="java" />
       </topLevelFiles>
     </macosArchive>
-    <macosArchive name="macOS (Apple Silicon) Disk Image" id="2796" customizedId="MACOS-AARCH64-DMG" mediaFileName="${compiler:APPLICATION_FOLDER}-${compiler:JALVIEW_VERSION}-${compiler:sys.platform}-aarch64-java_${compiler:JAVA_INTEGER_VERSION}" volumeName="${compiler:MACOSARCHIVE_AARCH64_NAME}" architecture="aarch64" launcherId="737" setupAppId="2746">
+    <macosArchive name="macOS (Apple Silicon) Disk Image" id="2796" customizedId="MACOS-AARCH64-DMG" mediaFileName="${compiler:MACOSARCHIVE_AARCH64_DMG_FILENAME}" volumeName="${compiler:MACOSARCHIVE_AARCH64_NAME}" architecture="aarch64" launcherId="737" setupAppId="2746">
       <exclude>
         <entry defaultFileset="true" />
         <entry filesetId="2801" />
@@ -1523,7 +1527,7 @@ ${compiler:JALVIEW_APPLICATION_NAME} will now launch.</property>
       <topLevelFiles>
         <symlink name="&quot; &quot;" target="/Applications" />
         <file name=".background/${compiler:MACOS_DMG_BG_FILENAME}" file="${compiler:JALVIEW_DIR}/${compiler:MACOS_DMG_BG_IMAGE}" />
-        <file name=".DS_Store" file="${compiler:JALVIEW_DIR}/${compiler:MACOS_DMG_DS_STORE}" />
+        <file name=".DS_Store" file="${compiler:JALVIEW_DIR}/${compiler:MACOS_AARCH64_DMG_DS_STORE}" />
         <file name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/Resources/Jalview-File.icns" file="${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/Jalview-File.icns" />
         <file name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/Resources/jvl_file.icns" file="${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/jvl_file.icns" />
         <symlink name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/MacOS/${compiler:WRAPPER_LINK}" target="../Resources/app/${compiler:WRAPPER_SCRIPT_BIN_DIR}/${compiler:BASH_WRAPPER_SCRIPT}" />
@@ -1544,7 +1548,7 @@ ${compiler:JALVIEW_APPLICATION_NAME} will now launch.</property>
         <variable name="variable" value="720" />
         <variable name="WIZARD_HEIGHT" value="540" />
       </variables>
-      <jreBundle jreBundleSource="preCreated" includedJre="${compiler:LINUX_X86_JAVA_VM_TGZ}" manualJreEntry="true" />
+      <jreBundle jreBundleSource="preCreated" includedJre="${compiler:LINUX_X64_JAVA_VM_TGZ}" manualJreEntry="true" />
     </unixInstaller>
     <unixInstaller name="Linux aarch64 Shell Installer" id="2782" customizedId="LINUX-AARCH64-SH" mediaFileName="${compiler:UNIX_APPLICATION_FOLDER}-${compiler:JALVIEW_VERSION}-linux-aarch64-java_${compiler:JAVA_INTEGER_VERSION}" installDir="${compiler:UNIX_APPLICATION_FOLDER}" customInstallBaseDir="~/opt/">
       <excludedBeans>
@@ -1570,7 +1574,7 @@ ${compiler:JALVIEW_APPLICATION_NAME} will now launch.</property>
         <entry filesetId="2801" />
         <entry filesetId="2803" />
       </exclude>
-      <jreBundle jreBundleSource="none" includedJre="${compiler:LINUX_X86_JAVA_VM_TGZ}" manualJreEntry="true" />
+      <jreBundle jreBundleSource="none" includedJre="${compiler:LINUX_X64_JAVA_VM_TGZ}" manualJreEntry="true" />
     </unixArchive>
     <unixInstaller name="Unix Shell Installer" id="2639" customizedId="UNIX--SH" mediaFileName="${compiler:UNIX_APPLICATION_FOLDER}-${compiler:JALVIEW_VERSION}-${compiler:sys.platform}-java_${compiler:JAVA_INTEGER_VERSION}" installDir="${compiler:UNIX_APPLICATION_FOLDER}" customInstallBaseDir="~/opt/">
       <excludedBeans>
@@ -1581,7 +1585,7 @@ ${compiler:JALVIEW_APPLICATION_NAME} will now launch.</property>
         <entry filesetId="2801" />
         <entry filesetId="2803" />
       </exclude>
-      <jreBundle jreBundleSource="none" includedJre="${compiler:LINUX_X86_JAVA_VM_TGZ}" manualJreEntry="true" />
+      <jreBundle jreBundleSource="none" includedJre="${compiler:LINUX_X64_JAVA_VM_TGZ}" manualJreEntry="true" />
     </unixInstaller>
   </mediaSets>
   <buildIds>
index 8434b69..5360c49 100755 (executable)
@@ -3,8 +3,8 @@
 # Copyright (c) 2013-2017 The Bitcoin Core developers
 # Distributed under the MIT software license, see the accompanying
 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
-from ds_store import DSStore
-from pprint import pprint
+import ds_store
+import pprint
 import mac_alias
 import argparse
 import json
@@ -16,9 +16,11 @@ parser = argparse.ArgumentParser(
 parser.add_argument("-i", "--input", help="The existing styled DS_Store file", dest="input")
 parser.add_argument("-o", "--output", help="The output DS_Store file", dest="output")
 parser.add_argument("-v", "--volumename", help="The name of the output DS_Store volume", dest="volumename")
-parser.add_argument("-b", "--background", help="The background image filename to use", dest="background")
+parser.add_argument("-b", "--backgroundfile", help="The background image filename to use", dest="backgroundfile", default="background.png")
+parser.add_argument("-d", "--backgrounddir", help="The background image hidden dirname to use", dest="backgrounddir", default=".background")
 parser.add_argument("-c", "--config", help="YAML configuration for window and icon sizes and positions", dest="config")
-parser.add_argument("-d", "--dump", help="Display contents of the input DS_Store to stdout", action="store_true", dest="dump")
+parser.add_argument("-m", "--dmg", help="The filename of the DMG file", dest="dmg", default="Jalview_macos.dmg")
+parser.add_argument("--dump", help="Display contents of the input DS_Store to stdout", action="store_true", dest="dump")
 parser.add_argument("-q", "--quiet", help="Don't print messages to stdout", action="store_true", dest="quiet")
 parser.add_argument("-f", "--filenames", help="List of comma-separated filenames to show information for --dump", dest="filenames", default="")
 
@@ -30,30 +32,34 @@ def myprint(string):
 
 def mypprint(string):
   if (not args.quiet):
-    pprint(string)
+    pprint.pprint(string)
 
 if (args.dump and not args.input):
   exit("When --dump used, an --input must be given")
 
 if (args.dump):
-  with DSStore.open(args.input, 'r+') as d:
+  with ds_store.DSStore.open(args.input, 'r+') as d:
+    print(f"d=")
+    print(pprint.pformat(d['.']['bwsp'], width=1))
+
     for key in ["bwsp", "icvp","Iloc"]:
       try:
-        myprint(f"d['.']['{key}']=")
-        mypprint(str(d['.'][key]))
+        print(f"d['.']['{key}']=")
+        pprint.pprint(str(d['.'][key]), width=1)
       except:
-        myprint(f"No info for d['.']['{key}']")
+        print(f"No info for d['.']['{key}']")
 
-    alias = mac_alias.Alias.from_bytes( d['.']['icvp']['backgroundImageAlias'] )
-    myprint("backgroundImageAlias=")
-    mypprint(alias)
+    a = mac_alias.Alias.from_bytes( d['.']['icvp']['backgroundImageAlias'] )
+    print("backgroundImageAlias:")
+    print("alias.volume="+pprint.pformat(a.volume))
+    print("alias.target="+pprint.pformat(a.target))
 
     for data in d:
       try:
         data = str(data)
-        mypprint(f"d['{data}']=",d[data])
+        pprint.pprint(f"d['{data}']="+d[data], width=1)
       except:
-        myprint(f"No info for d['{data}']")
+        print(f"No info for d['{data}']")
 #    for filename in args.filenames.split(","):
 #      if (filename):
 #        for f in d.find(filename):
@@ -71,16 +77,18 @@ if (not args.output):
 if (not args.volumename):
   exit("Provide a volume name with --volumename NAME")
 
-if (not args.background):
-  exit("Provide a background image filename (just the file, no path) with --background FILENAME")
+if (not args.backgroundfile):
+  exit("Provide a background image filename (just the file, no path) with --backgroundfile FILENAME")
 
 package_name_ns = args.volumename
 configfilename = args.config
-configfile = open(configfilename, 'r')
+config = None
+if (configfilename):
+  configfile = open(configfilename, 'r')
+  config = json.load(configfile)
 
-config = json.load(configfile)
-inputds = DSStore.open(args.input)
-outputds = DSStore.open(args.output, 'w+')
+inputds = ds_store.DSStore.open(args.input)
+outputds = ds_store.DSStore.open(args.output, 'w+')
 
 
 bwsp = {}
@@ -93,13 +101,34 @@ outputds['.']['bwsp'] = bwsp
 
 icvp = {}
 
+#alias = mac_alias.Alias.from_bytes(inputds['.']['icvp']['backgroundImageAlias'])
+#alias.volume.name = args.volumename
+#alias.volume.posix_path = '/Volumes/' + args.volumename
+#alias.volume.disk_image_alias.target.filename = args.volumename + '.dmg'
+#alias.volume.disk_image_alias.target.carbon_path = 'Macintosh HD:Users:\x00Jalview:\x00' + args.volumename + ':\x00' + args.volumename + '.dmg'
+#alias.volume.disk_image_alias.target.posix_path = '/Users/Jalview/' + args.volumename + '.dmg'
+#alias.target.carbon_path = args.volumename + ':' + args.backgrounddir + ':\x00' + args.backgroundfile
+#alias.target.posix_path = '/Volumes/' + args.volumename + '/' + args.backgrounddir
+#alias.target.filename = args.backgroundfile
+
+
 alias = mac_alias.Alias.from_bytes(inputds['.']['icvp']['backgroundImageAlias'])
+
 alias.volume.name = args.volumename
-alias.volume.posix_path = '/Volumes/' + args.volumename
-alias.volume.disk_image_alias.target.filename = args.volumename + '.dmg'
-alias.volume.disk_image_alias.target.carbon_path = 'Macintosh HD:Users:\x00Jalview:\x00' + args.volumename + ':\x00' + args.volumename + '.dmg'
-alias.volume.disk_image_alias.target.posix_path = '/Users/Jalview/' + args.volumename + '.dmg'
-alias.target.carbon_path = args.volumename + ':.background:\x00' + args.background
+alias.volume.posix_path = "/Volumes/" + args.volumename
+
+alias.volume.disk_image_alias.volume.name = "Macintosh HD"
+alias.volume.disk_image_alias.volume.posix_path = "/"
+
+alias.volume.disk_image_alias.target.filename = args.dmg
+alias.volume.disk_image_alias.target.folder_name = "Downloads"
+alias.volume.disk_image_alias.target.carbon_path = f'Macintosh HD:Users:Jalview:Downloads:{args.dmg}'
+alias.volume.disk_image_alias.target.posix_path = f'/Users/jalview/Downloads/{args.dmg}'
+
+alias.target.filename = args.backgroundfile
+alias.target.folder_name = args.backgrounddir
+alias.target.carbon_path = f'{args.volumename}:{args.backgrounddir}:{args.backgroundfile}'
+alias.target.posix_path = f'/{args.backgrounddir}/{args.backgroundfile}'
 
 icvp['backgroundImageAlias'] = alias.to_bytes()
 
@@ -115,10 +144,10 @@ outputds['.']['icvp'] = icvp
 
 outputds['.']['vSrn'] = ('long', 1)
 
-for fileinfo in config['files']:
-  outputds[fileinfo['name']]['Iloc'] = (fileinfo['xpos'], fileinfo['ypos'])
+if config:
+  for fileinfo in config['files']:
+    outputds[fileinfo['name']]['Iloc'] = (fileinfo['xpos'], fileinfo['ypos'])
 
 outputds.flush()
 outputds.close()
 inputds.close()
-