Remove bash depend
Set port default locations / java
Default to 2D (3D not working)

Index: geogebra/geogebra
--- geogebra/geogebra.orig
+++ geogebra/geogebra
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #---------------------------------------------
 # Script to start GeoGebra
 #---------------------------------------------
@@ -8,8 +8,7 @@
 #
 # GG_SCRIPTNAME=<name of originally called script to start GeoGebra> # If unset, name of this script will be used.
 #
-# GG_PATH=<path of directory containing geogebra.jar> # If unset, path of this script will be used.
-# In this case if the path of script does not contain the geogebra.jar file, /usr/share/geogebra will be used.
+# GG_PATH=<path of directory containing geogebra.jar> # Set to ${TRUEPREFIX}/share/java/classes/geogebra
 #
 # GG_SYS_CONFIG_PATH=<path of system directory containing geogebra.conf>
 #
@@ -43,22 +42,9 @@ if [ -z "$GG_SCRIPTNAME" ]; then
 fi
 
 #---------------------------------------------
-# If $GG_PATH not set, use path of this script.
+# Set $GG_PATH
 
-if [ -z "$GG_PATH" ]; then
-	GG_PATH="${BASH_SOURCE[0]}"
-	if [ -h "${GG_PATH}" ]; then
-		while [ -h "${GG_PATH}" ]; do
-			GG_PATH=`readlink "${GG_PATH}"`
-		done
-	fi
-	pushd . > /dev/null
-        DIRNAME=`dirname "${GG_PATH}"`
-	cd "$DIRNAME" > /dev/null
-	GG_PATH=`pwd`
-	popd > /dev/null
-	test -r "${GG_PATH}/geogebra_main.jar" || GG_PATH='/usr/share/geogebra'
-fi
+GG_PATH="${TRUEPREFIX}/share/java/classes/geogebra"
 
 #---------------------------------------------
 # If $GG_CONFIG_PATH not set, use $HOME.
@@ -68,19 +54,10 @@ if [ -z "$GG_CONFIG_PATH" ]; then
 fi
 
 #---------------------------------------------
-# If $JAVACMD not set, use java or (preferred) GeoGebra's Java or Oracle's Java 7.
+# If $JAVACMD not set, use javaPathHelper
 
-ORACLE_JAVA=/usr/lib/jvm/java-7-oracle/jre/bin/java
-GEOGEBRA_JAVA=/usr/lib/jvm/java-geogebra/bin/java
-
 if [ -z "$JAVACMD" ]; then
-	if [ -x $GEOGEBRA_JAVA ]; then
-		JAVACMD="$GEOGEBRA_JAVA"
-	elif [ -x $ORACLE_JAVA ]; then
-		JAVACMD="$ORACLE_JAVA"
-	else
-		JAVACMD='java'
-	fi
+	JAVACMD=$(javaPathHelper -c geogebra)
 fi
 
 #---------------------------------------------
@@ -292,7 +269,7 @@ fi
 #---------------------------------------------
 # Define usage function.
 
-function func_usage()
+func_usage()
 {
 	cat << _USAGE
 Usage: $GG_SCRIPTNAME [Java-options] [GeoGebra-options] [FILE]
@@ -337,8 +314,8 @@ _USAGE
 #---------------------------------------------
 # Check for options --help, --2, and pass Java options to Java, others to GeoGebra.
 
-CLASS=org.geogebra.desktop.GeoGebra3D # by default 3D is used
-GG_OPTS=()
+CLASS=org.geogebra.desktop.GeoGebra # by default 2D
+GG_OPTS=""
 for i in "$@"; do
 	case "$i" in
 	--help | --he | --h )
@@ -346,42 +323,42 @@ for i in "$@"; do
         --2 )
 		CLASS=org.geogebra.desktop.GeoGebra ;;
 	esac
-	if [ $(expr match "$i" '.*--') -ne 0 ]; then
-		if [ $(expr match "$i" '.*--showSplash=') -ne 0 ]; then
+	if [ $(expr -- "$i" : '.*--') -ne 0 ]; then
+		if [ $(expr -- "$i" : '.*--showSplash=') -ne 0 ]; then
 			GG_SHOWSPLASH=${i:13}
 			shift $((1))
-		elif [ $(expr match "$i" '.*--enableUndo=') -ne 0 ]; then
+		elif [ $(expr -- "$i" : '.*--enableUndo=') -ne 0 ]; then
 			GG_ENABLEUNDO=${i:13}
 			shift $((1))
-		elif [ $(expr match "$i" '.*--antiAliasing=') -ne 0 ]; then
+		elif [ $(expr -- "$i" : '.*--antiAliasing=') -ne 0 ]; then
 			GG_ANTIALIASING=${i:15}
 			shift $((1))
-		elif [ $(expr match "$i" '.*--versionCheckAllow=') -ne 0 ]; then
+		elif [ $(expr -- "$i" : '.*--versionCheckAllow=') -ne 0 ]; then
 			GG_VERSIONCHECKALLOW=${i:20}
 			shift $((1))
-		elif [ $(expr match "$i" '.*--settingsfile=') -ne 0 ]; then
+		elif [ $(expr -- "$i" : '.*--settingsfile=') -ne 0 ]; then
 			GG_SETTINGS_FILE=${i:15}
 			shift $((1))
 		else
 			GG_OPTS[${#GG_OPTS[*]}]="$i"
 			shift $((1))
 		fi
-	elif [ $(expr match "$i" '.*-Xms') -ne 0 ]; then
+	elif [ $(expr -- "$i" : '.*-Xms') -ne 0 ]; then
 		GG_XMS=${i:4}
 		shift $((1))
-	elif [ $(expr match "$i" '.*-Xmx') -ne 0 ]; then
+	elif [ $(expr -- "$i" : '.*-Xmx') -ne 0 ]; then
 		GG_XMX=${i:4}
 		shift $((1))
-	elif [ $(expr match "$i" '.*-Djava.library.path=') -ne 0 ]; then
+	elif [ $(expr -- "$i" : '.*-Djava.library.path=') -ne 0 ]; then
 		GG_DJAVA_LIBRARY_PATH=${i:20}
 		shift $((1))
-	elif [ $(expr match "$i" '.*-Dsun.java2d.xrender=') -ne 0 ]; then
+	elif [ $(expr -- "$i" : '.*-Dsun.java2d.xrender=') -ne 0 ]; then
 		GG_DSUN_JAVA2D_XRENDER=${i:21}
 		shift $((1))
-	elif [ $(expr match "$i" '.*-Dsun.java2d.opengl=') -ne 0 ]; then
+	elif [ $(expr -- "$i" : '.*-Dsun.java2d.opengl=') -ne 0 ]; then
 		GG_DSUN_JAVA2D_OPENGL=${i:20}
 		shift $((1))
-	elif [ $(expr match "$i" '.*-JavaCMD=') -ne 0 ]; then
+	elif [ $(expr -- "$i" : '.*-JavaCMD=') -ne 0 ]; then
 		JAVACMD=${i:9}
 		shift $((1))
 	fi
@@ -397,15 +374,15 @@ if [ -n "$GG_VERSIONCHECKALLOW" ]; then
 	GG_OPTS[${#GG_OPTS[*]}]="--versionCheckAllow=$GG_VERSIONCHECKALLOW"
 fi
 GG_OPTS[${#GG_OPTS[*]}]="--settingsfile=$GG_SETTINGS_FILE"
-JAVA_OPTS=("-Xms$GG_XMS" "-Xmx$GG_XMX" "-Dawt.useSystemAAFontSettings=on")
+JAVA_OPTS="-Xms$GG_XMS -Xmx$GG_XMX -Dawt.useSystemAAFontSettings=on"
 if [ -n "$GG_DJAVA_LIBRARY_PATH" ]; then
-	JAVA_OPTS[${#JAVA_OPTS[*]}]="-Djava.library.path=$GG_DJAVA_LIBRARY_PATH"
+	JAVA_OPTS="${JAVA_OPTS} -Djava.library.path=$GG_DJAVA_LIBRARY_PATH"
 fi
 if [ -n "$GG_DSUN_JAVA2D_XRENDER" ]; then
-	JAVA_OPTS[${#JAVA_OPTS[*]}]="-Dsun.java2d.xrender=$GG_DSUN_JAVA2D_XRENDER"
+	JAVA_OPTS="${JAVA_OPTS} -Dsun.java2d.xrender=$GG_DSUN_JAVA2D_XRENDER"
 fi
 if [ -n "$GG_DSUN_JAVA2D_OPENGL" ]; then
-	JAVA_OPTS[${#JAVA_OPTS[*]}]="-Dsun.java2d.opengl=$GG_DSUN_JAVA2D_OPENGL"
+	JAVA_OPTS="${JAVA_OPTS} -Dsun.java2d.opengl=$GG_DSUN_JAVA2D_OPENGL"
 fi
 
 # Reading font size. xdpyinfo returns 96x96 on most screens
@@ -427,10 +404,7 @@ unset JAVA_TOOL_OPTIONS
 #---------------------------------------------
 # Run
 
-JFXRT=`dirname "$JAVACMD"`/../lib/jfxrt.jar
-
-exec "$JAVACMD" "${JAVA_OPTS[@]}" \
- -cp "$GG_PATH/geogebra.jar" \
- "-Xbootclasspath/a:$JFXRT" \
+exec $JAVACMD ${JAVA_OPTS[@]} \
+ -cp $GG_PATH/geogebra.jar \
  $CLASS \
- "${GG_OPTS[@]}" "$@"
+ ${GG_OPTS[@]} "$@"
