From 970b76576ba3bdd0cc12d0cbe572f8c32fcf2b4b Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 17 Jul 2024 16:31:01 +0100 Subject: [PATCH] JAL-3631 Extensive working of options in install4j for allowing/disabling user default appdir updates, and also allowing/disabling installation appdir updates. Appropriate guidance in tooltips and warnings when no updates will occur are given. A user-space install only allows disabling updates. --- utils/install4j/install4j10_template.install4j | 482 +++++++++++++++++++++++- utils/install4j/warning.png | Bin 0 -> 3255 bytes 2 files changed, 473 insertions(+), 9 deletions(-) create mode 100644 utils/install4j/warning.png diff --git a/utils/install4j/install4j10_template.install4j b/utils/install4j/install4j10_template.install4j index 6172279..705a45c 100644 --- a/utils/install4j/install4j10_template.install4j +++ b/utils/install4j/install4j10_template.install4j @@ -1,6 +1,6 @@ - + @@ -164,11 +164,7 @@ # 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] - -# Uncomment these two lines to disable user-space automatic updates. -#-Dnouserdefaultappdir=true -#-Dsilent=noupdate +# -include-options [path to other .vmoption file] ${compiler:file("${compiler:INFO_PLIST_FILE_ASSOCIATIONS_FILE}")} @@ -396,6 +392,73 @@ return wrapperLink; Util.isMacOS() && !context.getBooleanVariable("isAdmin") // Admin on macOS will add path to /etc/paths.d in Create File action + + + + + Boolean.TRUE + + + allowUserDefaultAppdirUpdates + + + + + + + Boolean.FALSE + + + allowInstallerAppdirUpdates + + + + + + + Map<String, String> osAppDataPathMap = new HashMap<>(); +osAppDataPathMap.put("macos", "Library/Application Support/Jalview-Desktop"); +osAppDataPathMap.put("linux", ".local/share/jalview-desktop"); +osAppDataPathMap.put("windows", "AppData\\Local\\Jalview-Desktop"); +osAppDataPathMap.put("other", ".jalview-desktop"); +String appDataPath; +String append; +if (Util.isMacOS()) { + appDataPath = osAppDataPathMap.get("macos"); + append = context.getCompilerVariable("JALVIEW_APPLICATION_NAME"); +} else if (Util.isWindows()) { + appDataPath = osAppDataPathMap.get("windows"); + append = context.getCompilerVariable("APPLICATION_FOLDER"); +} else if (Util.isLinux()) { + appDataPath = osAppDataPathMap.get("linux"); + append = context.getCompilerVariable("APPLICATION_FOLDER").toLowerCase(Locale.ROOT); +} else { + appDataPath = osAppDataPathMap.get("other"); + append = context.getCompilerVariable("APPLICATION_FOLDER").toLowerCase(Locale.ROOT); +} +return "~" + File.separator + appDataPath + File.separator + append; + + + userDefaultAppdirBase + + + + + + + if (Util.isWindows()) { + return "Windows"; +} else if (Util.isMacOS()) { + return "macOS"; +} else if (Util.isLinux()) { + return "Linux"; +} +return context.getCompilerVariable("sys.platform"); + + + osName + + @@ -565,7 +628,7 @@ return console.askOkCancel(message, true); - User account + Additional tasks for user installation (${installer:sys.userName}) ${i18n:WizardSelectTasks} !context.getBooleanVariable("isAdmin") @@ -614,11 +677,122 @@ return console.askOkCancel(message, true); ) ) + + + + Enable advanced options + + 2980 + 2975 + 2989 + + + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("US_ADVANCED_OPTIONS"); +Class<?> cl_advancedOptions = fc_advancedOptions.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_advancedOptions)) { + return; +} +JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); +boolean advancedOptions = fc_advancedOptions.isEnabled() && jcb_advancedOptions.isSelected(); + +FormComponent fc_userUpdates = formEnvironment.getFormComponentById("US_ALLOW_USER_APPDIR_UPDATES"); +Class<?> cl_user = fc_userUpdates.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_user)) { + return; +} +JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); +boolean userUpdates = fc_userUpdates.isEnabled() && jcb_user.isSelected(); + +boolean showWarning = advancedOptions && (!userUpdates); + +formEnvironment.getFormComponentById("US_NO_UPDATES_WARNING").setVisible(showWarning); + +FormComponent fc_label = formEnvironment.getFormComponentById("US_LABEL"); +fc_label.setVisible(advancedOptions); +fc_userUpdates.setVisible(advancedOptions); + + + + advancedOptions + + + + + <html>The following option is strongly recommended to be left as default unless there is a particular reason to change them.</html> + + context.getBooleanVariable("advancedOptions") + + + + + + Allow user-space updates for ${compiler:JALVIEW_APPLICATION_NAME} components + <html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME} +<br> +components to be automatically downloaded +<br> +under the user's home space, separately from +<br> +the installation location. +<br> +<strong>This option is strongly recommended.</strong> +<br> +<br> +On ${installer:osName}, user updates will be installed under +<br> +<pre>${installer:userDefaultAppdirBase}</pre> +</html> + + + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("US_ADVANCED_OPTIONS"); +Class<?> cl_advancedOptions = fc_advancedOptions.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_advancedOptions)) { + return; +} +JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); +boolean advancedOptions = fc_advancedOptions.isEnabled() && jcb_advancedOptions.isSelected(); + +FormComponent fc_userUpdates = formEnvironment.getFormComponentById("US_ALLOW_USER_APPDIR_UPDATES"); +Class<?> cl_user = fc_userUpdates.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_user)) { + return; +} +JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); +boolean userUpdates = fc_userUpdates.isEnabled() && jcb_user.isSelected(); + +boolean showWarning = advancedOptions && (!userUpdates); + +formEnvironment.getFormComponentById("US_NO_UPDATES_WARNING").setVisible(showWarning); + + + allowUserDefaultAppdirUpdates + + context.getBooleanVariable("advancedOptions") + + + + + + + ${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/warning.png + + + No automatic updates will occur when Jalview is launched + + context.getBooleanVariable("advancedOptions") +&& +!( + context.getBooleanVariable("allowUserDefaultAppdirUpdates") + || context.getBooleanVariable("allowInstallerAppdirUpdates") +) + - System + Additional tasks for administrator installation ${i18n:WizardSelectTasks} context.getBooleanVariable("isAdmin") @@ -654,6 +828,200 @@ return console.askOkCancel(message, true); ) + + + + Enable advanced options + + 2985 + + + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +Class<?> cl_advancedOptions = fc_advancedOptions.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_advancedOptions)) { + return; +} +JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); +boolean advancedOptions = fc_advancedOptions.isEnabled() && jcb_advancedOptions.isSelected(); + +FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES"); +Class<?> cl_user = fc_userUpdates.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_user)) { + return; +} +JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); +boolean userUpdates = fc_userUpdates.isEnabled() && jcb_user.isSelected(); + +FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES"); +Class<?> cl_installer = fc_installerUpdates.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_installer)) { + return; +} +JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject(); +boolean installerUpdates = fc_installerUpdates.isEnabled() && jcb_installer.isSelected(); + +boolean showWarning = advancedOptions && !(userUpdates || installerUpdates); + +formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING").setVisible(showWarning); + +fc_installerUpdates.setEnabled(!userUpdates); + +FormComponent fc_label = formEnvironment.getFormComponentById("SS_LABEL"); +fc_label.setVisible(advancedOptions); +fc_userUpdates.setVisible(advancedOptions); +fc_installerUpdates.setVisible(advancedOptions); + + + + advancedOptions + + + + + <html>The following options are strongly recommended to be left as default unless there is a particular reason to change them.</html> + + context.getBooleanVariable("advancedOptions") + + + + + + Allow user-space updates for ${compiler:JALVIEW_APPLICATION_NAME} components + <html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME} +<br> +components to be automatically downloaded +<br> +under the user's home space, separately from +<br> +the installation location. +<br> +<strong>This option is strongly recommended.</strong> +<br> +<br> +On ${installer:osName}, user updates will be installed under +<br> +<pre>${installer:userDefaultAppdirBase}</pre> +</html> + + + + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +Class<?> cl_advancedOptions = fc_advancedOptions.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_advancedOptions)) { + return; +} +JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); +boolean advancedOptions = fc_advancedOptions.isEnabled() && jcb_advancedOptions.isSelected(); + +FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES"); +Class<?> cl_user = fc_userUpdates.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_user)) { + return; +} +JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); +boolean userUpdates = fc_userUpdates.isEnabled() && jcb_user.isSelected(); + +FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES"); +Class<?> cl_installer = fc_installerUpdates.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_installer)) { + return; +} +JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject(); +boolean installerUpdates = fc_installerUpdates.isEnabled() && jcb_installer.isSelected(); + +boolean showWarning = advancedOptions && !(userUpdates || installerUpdates); + +formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING").setVisible(showWarning); + +fc_installerUpdates.setEnabled(!userUpdates); + + + + allowUserDefaultAppdirUpdates + + context.getBooleanVariable("advancedOptions") + + + + + Allow installation updates for ${compiler:JALVIEW_APPLICATION_NAME} components + <html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME} +<br> +components to be automatically downloaded +<br> +into the installation location. +<br> +If you are installing into a system location, +<br> +a non-administrator user may have problems +<br> +launching ${compiler:JALVIEW_APPLICATION_NAME}. +<br> +<strong> +It is strongly recommended to use the +<br> +user-space updates option above. +</strong> +<br> +<br> +Installation updates will be installed into +<br> +<pre>${installer:sys.contentDir}</pre> +</html> + + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +Class<?> cl_advancedOptions = fc_advancedOptions.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_advancedOptions)) { + return; +} +JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); +boolean advancedOptions = fc_advancedOptions.isEnabled() && jcb_advancedOptions.isSelected(); + +FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES"); +Class<?> cl_user = fc_userUpdates.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_user)) { + return; +} +JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); +boolean userUpdates = fc_userUpdates.isEnabled() && jcb_user.isSelected(); + +FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES"); +Class<?> cl_installer = fc_installerUpdates.getConfigurationObjectClass(); +if (!JCheckBox.class.equals(cl_installer)) { + return; +} +JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject(); +boolean installerUpdates = fc_installerUpdates.isEnabled() && jcb_installer.isSelected(); + +boolean showWarning = advancedOptions && !(userUpdates || installerUpdates); + +formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING").setVisible(showWarning); + + + allowInstallerAppdirUpdates + + context.getBooleanVariable("advancedOptions") + + + + + + + ${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/warning.png + + + No automatic updates will occur when Jalview is launched + + context.getBooleanVariable("advancedOptions") +&& +!( + context.getBooleanVariable("allowUserDefaultAppdirUpdates") + || context.getBooleanVariable("allowInstallerAppdirUpdates") +) + @@ -728,11 +1096,23 @@ return console.askOkCancel(message, true); - + + + + ${i18n:FinishedHeadingLabel(${compiler:JALVIEW_APPLICATION_NAME})} + + + + + + + + + @@ -965,6 +1345,85 @@ context.getBooleanVariable("addToDockAction") + + + + + + + boolean advanced = context.getBooleanVariable("advancedOptions"); +boolean allowUser = context.getBooleanVariable("allowUserDefaultAppdirUpdates"); + +return advanced ? !allowUser : false; + + + disableUserDefaultAppdirUpdates + + + + + + + boolean advanced = context.getBooleanVariable("advancedOptions"); +boolean allowUser = context.getBooleanVariable("allowUserDefaultAppdirUpdates"); +boolean allowInstaller = context.getBooleanVariable("allowInstallerAppdirUpdates"); + +return advanced ? !( allowUser || allowInstaller ) : false; + + + disableUpdates + + + + + 2823 + + # Jalview specific options below + + + + + + 2823 + + # Uncomment the following line to disable user-space updates + #-Dnouserdefaultappdir=true + + + !context.getBooleanVariable("disableUserDefaultAppdirUpdates") + + + + 2823 + + # Comment out the following line to allow user-space updates + -Dnouserdefaultappdir=true + + + context.getBooleanVariable("disableUserDefaultAppdirUpdates") + + + + 2823 + + # Uncomment the following line to also disable all updates + #-Dsilent=noupdate + + + !context.getBooleanVariable("disableUpdates") + + + + 2823 + + # Comment out the following line to enable updates + -Dsilent=noupdate + + + context.getBooleanVariable("disableUpdates") + + + @@ -1059,6 +1518,11 @@ context.getBooleanVariable("addToDockAction") + + + + + diff --git a/utils/install4j/warning.png b/utils/install4j/warning.png new file mode 100644 index 0000000000000000000000000000000000000000..2063df2fd6f6224c4a9cbf1ab63a194ea84be2c3 GIT binary patch literal 3255 zcmV;o3`p~dP)EX>4Tx07!|Imj_f6*&4_1%%qdh0+CMWO^_lGKza>DdbJUf0HK7C5L84(WpM>o z6cG_nR&*6a!LtaDvRNerOxclCD@16I}xtZVj^4+@&KgsvxH&39`u;lI68h9KtLXlfCa#?*dl>@NJt<+WA6U^V8Ea zrnwzuhb@L8{4OB}sX9Ei*yz;)w)ltkwVLcKq*1PZQ6Lp@%kdvd}LKy{k;` zTWUstl=%sZgXfsXnW>-QWU*i59J589adXUJc?C%OrY#Pf<3yehQ>v52jF@9#MwnEe zEAkGX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