From a04f8a0b0781506739d06451f5ef55e1c6889f47 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 28 Jun 2024 12:04:05 +0100 Subject: [PATCH] JAL-3631 Adjustments to the Windows installer --- utils/install4j/install4j10_template.install4j | 171 ++++++++++-------------- 1 file changed, 68 insertions(+), 103 deletions(-) diff --git a/utils/install4j/install4j10_template.install4j b/utils/install4j/install4j10_template.install4j index 8600f75..8d9e5b5 100644 --- a/utils/install4j/install4j10_template.install4j +++ b/utils/install4j/install4j10_template.install4j @@ -190,7 +190,6 @@ - @@ -323,51 +322,35 @@ - - + - + - String userHome = (String)context.getVariable("sys.userHome"); - -ArrayList<String> tryPaths = new ArrayList<> (); -tryPaths.add(userHome + File.separator + "bin"); -tryPaths.add(userHome + File.separator + "local" + File.separator + "bin"); -tryPaths.add(userHome + File.separator + ".local" + File.separator + "bin"); -tryPaths.add(userHome + File.separator + "opt" + File.separator + "bin"); - -for (int i = 0; i < tryPaths.size(); i++) { - String tryPath = tryPaths.get(i); - File unixBinDir = new File(tryPath); - if (unixBinDir.exists()) { - return tryPath; - } -} - -return null; - + Util.isLinux() || Util.isUnixInstaller() - unixBinDir + makeSymbolicLink - !Util.hasFullAdminRights() -&& -( - Util.isLinux() - || Util.isUnixInstaller() - || Util.isMacOS() -) - + ArrayList<String> tryPaths = new ArrayList<> (); -tryPaths.add(File.separator + "opt" + File.separator + "bin"); -tryPaths.add(File.separator + "usr" + File.separator + "local" + File.separator + "bin"); + +if (Util.hasFullAdminRights()) { + tryPaths.add(File.separator + "opt" + File.separator + "bin"); + tryPaths.add(File.separator + "usr" + File.separator + "local" + File.separator + "bin"); +} else { + String userHome = (String)context.getVariable("sys.userHome"); + tryPaths.add(userHome + File.separator + "bin"); + tryPaths.add(userHome + File.separator + "local" + File.separator + "bin"); + tryPaths.add(userHome + File.separator + ".local" + File.separator + "bin"); + tryPaths.add(userHome + File.separator + "opt" + File.separator + "bin"); +} for (int i = 0; i < tryPaths.size(); i++) { String tryPath = tryPaths.get(i); @@ -383,15 +366,9 @@ return null; unixBinDir - Util.hasFullAdminRights() -&& -( - Util.isLinux() - || Util.isUnixInstaller() - || Util.isMacOS() -) + context.getBooleanVariable("makeSymbolicLink") - + @@ -408,7 +385,7 @@ return wrapperLink; macWrapperLinkLocation - Util.isMacOS() + Util.isMacOS() && !Util.hasFullAdminRights() // Admin on macOS will add path to /etc/paths.d in Create File action @@ -785,9 +762,7 @@ return console.askOkCancel(message, true); - !Util.hasFullAdminRights() -&& -!context.getBooleanVariable("sys.programGroupDisabled") + !Util.hasFullAdminRights() && !context.getBooleanVariable("sys.programGroupDisabled") @@ -810,9 +785,7 @@ return console.askOkCancel(message, true); - !Util.hasFullAdminRights() -&& -context.getBooleanVariable("createDesktopLinkAction") + !Util.hasFullAdminRights() && context.getBooleanVariable("createDesktopLinkAction") @@ -832,9 +805,7 @@ context.getBooleanVariable("addToDockAction") ${installer:sys.contentDir}\${compiler:WRAPPER_SCRIPT_BIN_DIR} Path - !Util.hasFullAdminRights() -&& -context.getBooleanVariable("appendToPathAction") + !Util.hasFullAdminRights() && context.getBooleanVariable("appendToPathAction") @@ -849,16 +820,15 @@ context.getBooleanVariable("appendToPathAction") - !Util.hasFullAdminRights() + Util.isMacOS() && !Util.hasFullAdminRights() // Admin on macOS will add path to /etc/paths.d && ( - Util.isMacOS() - && context.getBooleanVariable("makeUserSymbolicLinkAction") + context.getBooleanVariable("makeSymbolicLinkAction") && context.getVariable("unixBinDir") != null && context.getVariable("macWrapperLinkLocation") != null ) - + @@ -871,11 +841,7 @@ context.getBooleanVariable("appendToPathAction") - ( - Util.isLinux() - || Util.isUnixInstaller() - || Util.isMacOS() -) + Util.isLinux() || Util.isUnixInstaller() || Util.isMacOS() @@ -933,9 +899,7 @@ context.getBooleanVariable("appendToPathAction") - Util.hasFullAdminRights() -&& -!context.getBooleanVariable("sys.programGroupDisabled") + Util.hasFullAdminRights() && !context.getBooleanVariable("sys.programGroupDisabled") @@ -958,9 +922,7 @@ context.getBooleanVariable("appendToPathAction") - Util.hasFullAdminRights() -&& -context.getBooleanVariable("createDesktopLinkAction") + Util.hasFullAdminRights() && context.getBooleanVariable("createDesktopLinkAction") @@ -969,9 +931,7 @@ context.getBooleanVariable("createDesktopLinkAction") ${installer:sys.contentDir}\${compiler:WRAPPER_SCRIPT_BIN_DIR} Path - Util.hasFullAdminRights() -&& -context.getBooleanVariable("appendToPathAction") + Util.hasFullAdminRights() && context.getBooleanVariable("appendToPathAction") @@ -982,8 +942,7 @@ context.getBooleanVariable("appendToPathAction") /Applications/${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/MacOS - Util.hasFullAdminRights() -&& Util.isMacOS() + Util.hasFullAdminRights() && Util.isMacOS() @@ -998,14 +957,9 @@ context.getBooleanVariable("appendToPathAction") - ( - context.getBooleanVariable("makeUserSymbolicLinkAction") - && ( - Util.isLinux() - || Util.isUnixInstaller() - ) - && context.getVariable("unixBinDir") != null -) + context.getBooleanVariable("makeSymbolicLinkAction") +&& context.getVariable("unixBinDir") != null +&& context.getBooleanVariable("makeSymbolicLink") @@ -1014,48 +968,56 @@ context.getBooleanVariable("appendToPathAction") ${form:finishedMessage} - + ${i18n:CreateDesktopIcon} createDesktopLinkAction - !Util.isMacOS() -&& !Util.hasFullAdminRights() + !Util.isMacOS() && !Util.hasFullAdminRights() - + ${i18n:AddToDock} addToDockAction - Util.isMacOS() -&& !Util.hasFullAdminRights() + Util.isMacOS() && !Util.hasFullAdminRights() - + - Add ${compiler:JALVIEW_APPLICATION_NAME}'s bin folder to the Path environment variable + Add ${compiler:JALVIEW_APPLICATION_NAME}'s bin folder to your Path environment variable appendToPathAction - Util.isWindows() + Util.isWindows() && !Util.hasFullAdminRights() + + + + Add ${compiler:JALVIEW_APPLICATION_NAME}'s bin folder to the system Path environment variable + + appendToPathAction + + Util.isWindows() && Util.hasFullAdminRights() Make a ${compiler:WRAPPER_LINK} symbolic link in ${installer:unixBinDir} - makeUserSymbolicLinkAction + makeSymbolicLinkAction - ( - Util.isLinux() - || Util.isUnixInstaller() - || ( - Util.isMacOS() - && context.getVariable("macWrapperLinkLocation") != null - ) - ) - && context.getVariable("unixBinDir") != null + context.getBooleanVariable("makeSymbolicLink") +&& context.getVariable("unixBinDir") != null +&& ( + Util.isLinux() + || Util.isUnixInstaller() + || ( + ( Util.isMacOS() && !Util.hasFullAdminRights() ) // Admin on macOS will add path to /etc/paths.d + && context.getVariable("macWrapperLinkLocation") != null + ) + ) + @@ -1064,6 +1026,8 @@ context.getBooleanVariable("appendToPathAction") ${i18n:UninstallerMenuEntry(${compiler:sys.fullName})} + + @@ -1406,13 +1370,14 @@ return console.askYesNo(message, true); ${compiler:WRAPPER_LINK}_setup + + ${compiler:sys.fullName} - @@ -1444,7 +1409,7 @@ return console.askYesNo(message, true); Make a ${compiler:WRAPPER_LINK} symbolic link in ${installer:unixBinDir} - makeUserSymbolicLinkAction + makeSymbolicLinkAction @@ -1774,7 +1739,7 @@ ${compiler:JALVIEW_APPLICATION_NAME} will now launch. - + @@ -1789,7 +1754,7 @@ ${compiler:JALVIEW_APPLICATION_NAME} will now launch. - + @@ -1815,7 +1780,7 @@ ${compiler:JALVIEW_APPLICATION_NAME} will now launch. - + -- 1.7.10.2