updated on Mon Jan 23 12:00:23 UTC 2012
[aur-mirror.git] / geogebra-prim / geogebra-prim.sh
blob38f4b6bff7477f58772d91539056e513385237e7
1 #!/bin/bash
2 #---------------------------------------------
3 # Script to start GeoGebra
4 #---------------------------------------------
6 #---------------------------------------------
7 # Used environment variables:
9 # GG_XMS=<initial Java heap size> # If unset, 32m will be used.
11 # GG_XMX=<maximum Java heap size> # If unset, 512m will be used.
13 # GG_DJAVA_LIBRARY_PATH=<native library path>
15 #---------------------------------------------
16 # If GG_XMS not set, set to 32m
18 if [ -z "$GG_XMS" ]; then
19 GG_XMS='32m'
22 #---------------------------------------------
23 # If GG_XMX not set, set to 512m
25 if [ -z "$GG_XMX" ]; then
26 GG_XMX='512m'
29 #---------------------------------------------
30 # Set Java default options
32 JAVA_OPTS=("-Xms$GG_XMS" "-Xmx$GG_XMX")
33 if [ -n "$GG_DJAVA_LIBRARY_PATH" ]; then
34 JAVA_OPTS[${#JAVA_OPTS[*]}]="-Djava.library.path=$GG_DJAVA_LIBRARY_PATH"
37 #---------------------------------------------
38 # Set GeoGebra default options
40 GG_OPTS=(--primary=true)
42 #---------------------------------------------
43 # Define usage function
45 func_usage()
47 cat << _USAGE
48 Usage: geogebra [Java-options] [GeoGebra-options] [FILE]
50 GeoGebra - Dynamic mathematics software
52 Java options:
53 -Xms<size> Set initial Java heap size, default $GG_XMS
54 -Xmx<size> Set maximum Java heap size, default $GG_XMX
55 -Djava.library.path=<path> Set native library path`if [ -n "$GG_DJAVA_LIBRARY_PATH" ]; then echo ", default $GG_DJAVA_LIBRARY_PATH"; fi`
57 GeoGebra options:
58 --help Print this help message
59 --v Print version
60 --language=<iso_code> Set language using locale code, e.g. en, de_AT
61 --showAlgebraInput=<boolean> Show/hide algebra input field
62 --showAlgebraInputTop=<boolean> Show algebra input field at top/bottom
63 --showAlgebraWindow=<boolean> Show/hide algebra window
64 --showSpreadsheet=<boolean> Show/hide spreadsheet
65 --showCAS=<boolean> Show/hide CAS window
66 --showSplash=<boolean> Enable/disable the splash screen
67 --enableUndo=<boolean> Enable/disable Undo
68 --fontSize=<number> Set default font size
69 --showAxes=<boolean> Show/hide coordinate axes
70 --showGrid=<boolean> Show/hide grid
71 --settingsfile=[<path>|<filename>] Load/save settings from/in a local file
72 --resetSettings Reset current settings
73 --antiAliasing=<boolean> Turn anti-aliasing on/off
74 --regressionFile=<filename> Export textual representations of dependent objects, then exit
75 _USAGE
78 #---------------------------------------------
79 # Check for option --help and pass Java options to Java, others to GeoGebra
81 for i in "$@"; do
82 case "$i" in
83 --help | --hel | --he | --h )
84 func_usage; exit 0 ;;
85 esac
86 if [ $(expr match "$i" '.*--') -ne 0 ]; then
87 GG_OPTS[${#GG_OPTS[*]}]="$i"
88 shift $((1))
89 elif [ $(expr match "$i" '.*-Xms') -ne 0 -o $(expr match "$i" '.*-Xmx') -ne 0 -o $(expr match "$i" '.*-Djava.library.path') -ne 0 ]; then
90 JAVA_OPTS[${#JAVA_OPTS[*]}]="$i"
91 shift $((1))
93 done
95 #---------------------------------------------
96 # Run
98 exec java "${JAVA_OPTS[@]}" -jar "/usr/share/java/geogebra/geogebra.jar" "${GG_OPTS[@]}" "$@"