JAL-3631 Some minor bugfixes to the install4j installer and word changes to match...
authorBen Soares <b.soares@dundee.ac.uk>
Fri, 26 Jul 2024 14:38:28 +0000 (15:38 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Fri, 26 Jul 2024 14:38:28 +0000 (15:38 +0100)
utils/install4j/install4j10_template.install4j

index 6916041..d2e2c0a 100644 (file)
 # For example, to adjust the maximum memory usage to 512 MB, uncomment the following line:
 # -Xmx512m
 # To include another file, uncomment the following line:
-# -include-options [path to other .vmoption file]</content>
+# -include-options [path to other .vmoption file]
+
+# Jalview specific options below</content>
       </vmOptionsFile>
       <infoPlist>${compiler:file("${compiler:INFO_PLIST_FILE_ASSOCIATIONS_FILE}")}</infoPlist>
       <iconImageFiles>
@@ -353,7 +355,7 @@ public static void showInvalidUserAppdirPathWarning(Context context, FormEnviron
     boolean userUpdates = ((JCheckBox) fc_userUpdates.getConfigurationObject()).isSelected();
     
     // get boolean status of "Customise the user-space path" checkbox
-    boolean allowUserAppdirPath = ((JCheckBox) fc_allowUserAppdirPath).isSelected();
+    boolean allowUserAppdirPath = ((JCheckBox) fc_allowUserAppdirPath.getConfigurationObject()).isSelected();
 
     // show/hide warning
     boolean showInvalidPathWarning = advancedOptions &amp;&amp; userUpdates &amp;&amp; allowUserAppdirPath &amp;&amp;  !isUserAppdirPathValid(context, fc_userAppdirPath);
@@ -1516,7 +1518,7 @@ return context.getBooleanVariable("allowUserDefaultAppdirUpdates") &amp;&amp; co
                   </property>
                 </serializedBean>
                 <beans>
-                  <action name="USERSPACE: Create start menu item" id="2916" beanClass="com.install4j.runtime.beans.actions.desktop.CreateStartMenuEntryAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
+                  <action name="USERSPACE: Create Start Menu item" id="2916" beanClass="com.install4j.runtime.beans.actions.desktop.CreateStartMenuEntryAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
                     <serializedBean>
                       <property name="allUsers" type="boolean" value="false" />
                       <property name="categories" type="string">${compiler:APPLICATION_CATEGORIES}</property>
@@ -1538,7 +1540,7 @@ return context.getBooleanVariable("allowUserDefaultAppdirUpdates") &amp;&amp; co
                         </object>
                       </property>
                     </serializedBean>
-                    <condition>!Util.hasFullAdminRights() &amp;&amp; !context.getBooleanVariable("sys.programGroupDisabled")</condition>
+                    <condition>!context.getBooleanVariable("sys.programGroupDisabled")</condition>
                   </action>
                   <action name="USERSPACE: Add a desktop link" id="2917" beanClass="com.install4j.runtime.beans.actions.desktop.CreateDesktopLinkAction" actionElevationType="elevated" rollbackBarrierExitCode="0" errorMessage="Could not make desktop link">
                     <serializedBean>
@@ -1561,7 +1563,7 @@ return context.getBooleanVariable("allowUserDefaultAppdirUpdates") &amp;&amp; co
                         </object>
                       </property>
                     </serializedBean>
-                    <condition>!Util.hasFullAdminRights() &amp;&amp; context.getBooleanVariable("createDesktopLinkAction")</condition>
+                    <condition>context.getBooleanVariable("createDesktopLinkAction")</condition>
                   </action>
                   <action name="USERSPACE: Add an executable to the dock (macOS)" id="2918" beanClass="com.install4j.runtime.beans.actions.desktop.AddToDockAction" actionElevationType="none" rollbackBarrierExitCode="0">
                     <serializedBean>
@@ -1571,9 +1573,7 @@ return context.getBooleanVariable("allowUserDefaultAppdirUpdates") &amp;&amp; co
                         </object>
                       </property>
                     </serializedBean>
-                    <condition>!Util.hasFullAdminRights()
-&amp;&amp;
-context.getBooleanVariable("addToDockAction")</condition>
+                    <condition>context.getBooleanVariable("addToDockAction")</condition>
                   </action>
                   <action name="USERSPACE: Add Jalview bin to the user's path (Windows)" id="2919" beanClass="com.install4j.runtime.beans.actions.misc.ModifyEnvironmentVariableAction" actionElevationType="elevated" rollbackBarrierExitCode="0" errorMessage="Could not add &quot;${installer:sys.contentDir}\${compiler:WRAPPER_SCRIPT_BIN_DIR}&quot; to the Path environment variable">
                     <serializedBean>
@@ -1581,7 +1581,7 @@ context.getBooleanVariable("addToDockAction")</condition>
                       <property name="value" type="string">${installer:sys.contentDir}\${compiler:WRAPPER_SCRIPT_BIN_DIR}</property>
                       <property name="variableName" type="string">Path</property>
                     </serializedBean>
-                    <condition>!Util.hasFullAdminRights() &amp;&amp; context.getBooleanVariable("appendToPathAction")</condition>
+                    <condition>context.getBooleanVariable("appendToPathAction")</condition>
                   </action>
                   <action name="USERSPACE: Create macOS symbolic link to jalview in user's local bin" id="2920" beanClass="com.install4j.runtime.beans.actions.files.CreateSymlinkAction" rollbackBarrierExitCode="0" errorMessage="Could not make a ${compiler:WRAPPER_LINK} symbolic link in ~/${installer:unixBinDir}">
                     <serializedBean>
@@ -1596,8 +1596,7 @@ context.getBooleanVariable("addToDockAction")</condition>
                         </object>
                       </property>
                     </serializedBean>
-                    <condition>Util.isMacOS() &amp;&amp; !Util.hasFullAdminRights() // Admin on macOS will add path to /etc/paths.d
-&amp;&amp;
+                    <condition>Util.isMacOS() &amp;&amp;
 (
   context.getBooleanVariable("makeSymbolicLinkAction")
   &amp;&amp; context.getVariable("unixBinDir") != null
@@ -1615,7 +1614,7 @@ context.getBooleanVariable("addToDockAction")</condition>
                   </property>
                 </serializedBean>
                 <beans>
-                  <action name="SYSTEMSPACE: Create start menu item" id="2950" beanClass="com.install4j.runtime.beans.actions.desktop.CreateStartMenuEntryAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
+                  <action name="SYSTEMSPACE: Create Start Menu item" id="2950" beanClass="com.install4j.runtime.beans.actions.desktop.CreateStartMenuEntryAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
                     <serializedBean>
                       <property name="categories" type="string">${compiler:APPLICATION_CATEGORIES}</property>
                       <property name="entryName" type="string">${compiler:JALVIEW_APPLICATION_NAME}</property>
@@ -1662,7 +1661,7 @@ context.getBooleanVariable("addToDockAction")</condition>
                     </serializedBean>
                     <condition>context.getBooleanVariable("createDesktopLinkAction")</condition>
                   </action>
-                  <action name="SYSTEMSPACE: Add Jalview bin to the user's path (Windows)" id="2952" beanClass="com.install4j.runtime.beans.actions.misc.ModifyEnvironmentVariableAction" actionElevationType="elevated" rollbackBarrierExitCode="0" errorMessage="Could not add &quot;${installer:sys.contentDir}\${compiler:WRAPPER_SCRIPT_BIN_DIR}&quot; to the Path environment variable">
+                  <action name="SYSTEMSPACE: Add Jalview bin to the system path (Windows)" id="2952" beanClass="com.install4j.runtime.beans.actions.misc.ModifyEnvironmentVariableAction" actionElevationType="elevated" rollbackBarrierExitCode="0" errorMessage="Could not add &quot;${installer:sys.contentDir}\${compiler:WRAPPER_SCRIPT_BIN_DIR}&quot; to the Path environment variable">
                     <serializedBean>
                       <property name="type" type="enum" class="com.install4j.runtime.beans.actions.misc.ModifyStringType" value="APPEND" />
                       <property name="userSpecific" type="boolean" value="false" />
@@ -1701,7 +1700,7 @@ return (Object) hash;
               </group>
               <group name="BOTHSPACE: Actions" id="2956" beanClass="com.install4j.runtime.beans.groups.ActionGroup" actionElevationType="elevated">
                 <beans>
-                  <action name="BOTHSPACE: Create Linux/Unix user symbolic link to jalview.sh in system bin" id="2955" beanClass="com.install4j.runtime.beans.actions.files.CreateSymlinkAction" rollbackBarrierExitCode="0" errorMessage="Could not make a ${compiler:WRAPPER_LINK} symbolic link in ~/${installer:unixBinDir}">
+                  <action name="BOTHSPACE: Create Linux/Unix user symbolic link to jalview.sh in system/user bin" id="2955" beanClass="com.install4j.runtime.beans.actions.files.CreateSymlinkAction" rollbackBarrierExitCode="0" errorMessage="Could not make a ${compiler:WRAPPER_LINK} symbolic link in ~/${installer:unixBinDir}">
                     <serializedBean>
                       <property name="file">
                         <object class="java.io.File">
@@ -1765,12 +1764,48 @@ return advanced ? !( allowUser || allowInstaller ) : false;</property>
                       <property name="variableName" type="string">disableUpdates</property>
                     </serializedBean>
                   </action>
+                  <action name="Set installerFilename" id="3043" beanClass="com.install4j.runtime.beans.actions.control.SetVariableAction" rollbackBarrierExitCode="0">
+                    <serializedBean>
+                      <property name="script">
+                        <object class="com.install4j.api.beans.ScriptProperty">
+                          <property name="value" type="string">String file = (String)context.getVariable("sys.mediaFile");
+int i = file.lastIndexOf(File.separator);
+return file.substring(i+1);</property>
+                        </object>
+                      </property>
+                      <property name="variableName" type="string">installerFilename</property>
+                    </serializedBean>
+                  </action>
+                  <action name="Set installDateTime" id="3044" beanClass="com.install4j.runtime.beans.actions.control.SetVariableAction" rollbackBarrierExitCode="0">
+                    <serializedBean>
+                      <property name="script">
+                        <object class="com.install4j.api.beans.ScriptProperty">
+                          <property name="value" type="string">String date = (String)context.getVariable("sys.date");
+String time = (String)context.getVariable("sys.time");
+StringBuilder sb = new StringBuilder();
+sb.append(date.substring(0,4));
+sb.append("-");
+sb.append(date.substring(4,6));
+sb.append("-");
+sb.append(date.substring(6,8));
+sb.append(" ");
+sb.append(time.substring(0,2));
+sb.append(":");
+sb.append(time.substring(2,4));
+sb.append(":");
+sb.append(time.substring(4,6));
+return sb.toString();
+</property>
+                        </object>
+                      </property>
+                      <property name="variableName" type="string">installDateTime</property>
+                    </serializedBean>
+                  </action>
                   <action name="Initial comment" id="3010" beanClass="com.install4j.runtime.beans.actions.misc.AddVmOptionsAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
                     <serializedBean>
                       <property name="launcherId" type="string">2823</property>
-                      <property name="vmOptions" type="array" elementType="string" length="2">
-                        <element index="0"># </element>
-                        <element index="1"># Jalview specific options below</element>
+                      <property name="vmOptions" type="array" elementType="string" length="1">
+                        <element index="0"># Jalview options added by ${installer:installerFilename} at ${installer:installDateTime}</element>
                       </property>
                     </serializedBean>
                   </action>
@@ -1862,7 +1897,7 @@ return advanced ? !( allowUser || allowInstaller ) : false;</property>
                       </property>
                       <property name="removeOnUninstall" type="boolean" value="false" />
                     </serializedBean>
-                    <condition>Util.isLinux() || Util.isMacOS()</condition>
+                    <condition>Util.isLinux() || ( Util.isMacOS() &amp;&amp; !Util.isUnixInstaller() )</condition>
                   </action>
                   <action name="macOS/Linux Jalview Appname-&gt;java symlink" id="2943" beanClass="com.install4j.runtime.beans.actions.files.CreateSymlinkAction" rollbackBarrierExitCode="0" errorMessage="Could not make symlink to wrapper script">
                     <serializedBean>
@@ -1878,7 +1913,7 @@ return advanced ? !( allowUser || allowInstaller ) : false;</property>
                       </property>
                       <property name="removeOnUninstall" type="boolean" value="false" />
                     </serializedBean>
-                    <condition>(Util.isLinux() || Util.isMacOS())
+                    <condition>( Util.isLinux() || ( Util.isMacOS() &amp;&amp; !Util.isUnixInstaller() ) )
 &amp;&amp; !((String)context.getCompilerVariable("JALVIEW_APPLICATION_NAME")).equals((String)context.getCompilerVariable("JALVIEW_NAME"))</condition>
                   </action>
                 </beans>