Browse Source

Add --help to installer.

Use --help to check if java is the right version (like the launcher), rather than just running the installer and moaning if it exits with non 0.
Fixes issue 1479


git-svn-id: http://svn.dmdirc.com/trunk@4455 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Shane Mc Cormack 16 years ago
parent
commit
9b732b42c6
3 changed files with 17 additions and 4 deletions
  1. 6
    3
      installer/linux/setup.sh
  2. 5
    1
      installer/windows/Setup.dpr
  3. 6
    0
      src/com/dmdirc/installer/Main.java

+ 6
- 3
installer/linux/setup.sh View File

@@ -200,15 +200,18 @@ if [ -e "DMDirc.jar" ]; then
200 200
 	if [ "${scriptOnly}" = "true" ]; then
201 201
 		echo "Script-only install requested."
202 202
 	else
203
-		echo "Running installer.."
204
-		${JAVA} -cp DMDirc.jar com.dmdirc.installer.Main ${isRoot}${isRelease}
203
+		echo "Checking java version.."
204
+		${JAVA} -cp DMDirc.jar com.dmdirc.installer.Main --help >/dev/null
205 205
 		if [ $? -ne 0 ]; then
206 206
 			installjre "upgrade"
207
-			echo "Trying to run installer again.."
207
+			echo "Trying to run installer.."
208 208
 			${JAVA} -cp DMDirc.jar com.dmdirc.installer.Main ${isRoot}${isRelease}
209 209
 			if [ $? -ne 0 ]; then
210 210
 				exit 1;
211 211
 			fi;
212
+		else
213
+			echo "Running installer.."
214
+			${JAVA} -cp DMDirc.jar com.dmdirc.installer.Main ${isRoot}${isRelease}
212 215
 		fi
213 216
 		exit 0;
214 217
 	fi

+ 5
- 1
installer/windows/Setup.dpr View File

@@ -460,7 +460,8 @@ begin
460 460
 		if (ReleaseNumber <> '') then begin
461 461
 			params := params+' --release '+ReleaseNumber;
462 462
 		end;
463
-		if (ExecAndWait(javaCommand+' -cp DMDirc.jar com.dmdirc.installer.Main '+params) <> 0) then begin
463
+		// CHeck if the installer runs
464
+		if (ExecAndWait(javaCommand+' -cp DMDirc.jar com.dmdirc.installer.Main --help') <> 0) then begin
464 465
 			dowriteln('Failed!');
465 466
 			if not installJRE(true) then begin
466 467
 				showError('Sorry, DMDirc setup can not continue without an updated version of java.', false, false);
@@ -470,6 +471,9 @@ begin
470 471
 				// Try again now that java is installed.
471 472
 				ExecAndWait(javaCommand+' -cp DMDirc.jar com.dmdirc.installer.Main '+params);
472 473
 			end;
474
+		else begin
475
+			// Java is the right version, run the installer
476
+			ExecAndWait(javaCommand+' -cp DMDirc.jar com.dmdirc.installer.Main '+params);
473 477
 		end;
474 478
 end
475 479
 	else begin

+ 6
- 0
src/com/dmdirc/installer/Main.java View File

@@ -139,6 +139,8 @@ public final class Main implements WizardListener {
139 139
 	 */
140 140
 	private static void setupCLIParser() {
141 141
 		cli.clear();
142
+		cli.add(new StringParam('h', "help", "Get Help"));
143
+		cli.setHelp(cli.getParam("-help"));
142 144
 		cli.add(new BooleanParam((char) 0, "isroot", "Installing as Root"));
143 145
 		cli.add(new StringParam('r', "release", "Release Name"));
144 146
 		cli.add(new StringParam('d', "directory", "Default install directory"));
@@ -177,6 +179,10 @@ public final class Main implements WizardListener {
177 179
 	 */
178 180
 	public static void main(final String[] args) {
179 181
 		setupCLIParser();
182
+		if (cli.wantsHelp(args)) {
183
+			cli.showHelp("DMDirc installer Help", "[options [--]]");
184
+			System.exit(0);
185
+		}
180 186
 		cli.parseArgs(args, false);
181 187
 		getWizardFrame().display();
182 188
 	}

Loading…
Cancel
Save