Browse Source

Fix issue 2037

tags/0.6.3m1rc1
Shane Mc Cormack 15 years ago
parent
commit
6770b514fd
1 changed files with 43 additions and 23 deletions
  1. 43
    23
      launcher/unix/DMDirc.sh

+ 43
- 23
launcher/unix/DMDirc.sh View File

@@ -168,6 +168,8 @@ else
168 168
 	jar=`dirname $0`/DMDirc.jar
169 169
 fi
170 170
 launcherUpdater=${profiledir}/updateLauncher.sh
171
+BSDJava1="/usr/local/jdk1.6.0/jre/bin/java"
172
+BSDJava2="/usr/local/diablo-jdk1.6.0/jre/bin/java"
171 173
 echo "---------------------"
172 174
 echo "DMDirc - Open Source IRC Client"
173 175
 echo "Launcher Version: ${LAUNCHERVERSION}"
@@ -344,21 +346,20 @@ if [ "${ISOSX}" = "1" ]; then
344 346
 		JAVA="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java"
345 347
 	fi;
346 348
 else
347
-	# Location where ports on FreeBSD/PCBSD installs java6
348
-	# check it first, because it isn't added to the path automatically
349
-	JAVA="/usr/local/jdk1.6.0/jre/bin/java"
349
+	if [ -e "${HOME}/.profile" ]; then
350
+		# Source the profile incase java can't be found otherwise
351
+		. ${HOME}/.profile
352
+	fi;
353
+	JAVA=`which java`
350 354
 	if [ ! -e "${JAVA}" ]; then
351
-		# Try alternative BSD Location
352
-		JAVA="/usr/local/diablo-jdk1.6.0/jre/bin/java"
355
+		# Location where ports on FreeBSD/PCBSD installs java6
356
+		# check it first, because it isn't added to the path automatically
357
+		JAVA=${BSDJava1}
353 358
 		if [ ! -e "${JAVA}" ]; then
354
-			# Look in path
355
-			if [ -e "${HOME}/.profile" ]; then
356
-				# Source the profile incase java can't be found otherwise
357
-				. ${HOME}/.profile
358
-			fi;
359
-			JAVA=`which java`
360
-		fi
361
-	fi
359
+			# Try alternative BSD Location
360
+			JAVA=${BSDJava2}
361
+		fi;
362
+	fi;
362 363
 fi;
363 364
 
364 365
 if [ "" != "${JAVA}" ]; then
@@ -384,17 +385,36 @@ if [ -e "${jar}" ]; then
384 385
 	# error message to be printed.
385 386
 	${JAVA} -jar ${jar} --help >/dev/null 2>&1
386 387
 	if [ $? -ne 0 ]; then
387
-		echo "Failed."
388
-		ERROR="Sorry, the currently installed version of java is not compatible with DMDirc.";
389
-		ERROR=${ERROR}"\n";
390
-		if [ "${ISOSX}" = "1" ]; then
391
-			ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM.";
392
-		else
393
-			ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM, you can get one from: http://www.java.com";
394
-			ERROR=${ERROR}"\nor reinstall DMDirc and let the installer install one for you.";
388
+		FAILED=1
389
+		# If we are on BSD, check to see if there is alternative versions of java
390
+		# than the one in the path.
391
+		if [ "`echo ${KERNEL} | grep -i BSD`" != "" ]; then
392
+			if [ "${JAVA}" != "${BSDJava1}" -a "${JAVA}" != "${BSDJava2}" ]; then
393
+				JAVA=${BSDJava1}
394
+				if [ ! -e "${JAVA}" ]; then
395
+					JAVA=${BSDJava2}
396
+				fi;
397
+				# Now check to see if DMDirc runs again.
398
+				${JAVA} -jar ${jar} --help >/dev/null 2>&1
399
+				if [ $? -eq 0 ]; then
400
+					# It runs!
401
+					FAILED=0
402
+				fi;
403
+			fi;
404
+		fi;
405
+		if [ ${FAILED} -eq 1 ]; then
406
+			echo "Failed."
407
+			ERROR="Sorry, the currently installed version of java is not compatible with DMDirc.";
408
+			ERROR=${ERROR}"\n";
409
+			if [ "${ISOSX}" = "1" ]; then
410
+				ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM.";
411
+			else
412
+				ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM, you can get one from: http://www.java.com";
413
+				ERROR=${ERROR}"\nor reinstall DMDirc and let the installer install one for you.";
414
+			fi;
415
+			errordialog "Unable to launch dmdirc!" "${ERROR}";
416
+			exit 1;
395 417
 		fi;
396
-		errordialog "Unable to launch dmdirc!" "${ERROR}";
397
-		exit 1;
398 418
 	fi
399 419
 
400 420
 	# Now we can run the client for real, this allows stderr/stdout output

Loading…
Cancel
Save