run.sh 1.11 KB
Newer Older
1
2
3
4
#!/bin/sh
lib="lib"
ant="mindmapping_to_hdoc.ant"
antparam="-Dprogram.param=$1"
5
inputPath="$2"
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#Recherche de java et controle que se soit une version SUN
vJavaCmd="java"
xCheckJava () {
	vInputVarName=\$"$1"
	vInputVarVal=`eval "expr \"$vInputVarName\" "`
	if [ -z "$vInputVarVal" ];then
		eval "$1=false"
		return
	fi
	vSunJavaFound=`$vInputVarVal -version 2>&1 | grep -Eo -m 1 "(HotSpot)|(OpenJDK)"`
	if [ "$vSunJavaFound" != "HotSpot" ] && [ "$vSunJavaFound" != "OpenJDK" ] ; then
		eval "$1=false"
		return
	fi
}
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
	vJavaCmd="$JAVA_HOME/bin/java"
	xCheckJava vJavaCmd
	if [ "$vJavaCmd" = "false" ]; then
		echo "ERREUR: JRE de SUN introuvable. Veuillez déclarer la variable d'environnement JAVA_HOME."
		exit 1
	fi
fi

#Lancer la commande
scJarList="$lib/*"

35
if [ -z "$inputPath" ]; then
36
37
38
39
40
	echo "Appel sans paramètre"
	$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam
else
	echo "Appel avec paramètre"
	$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam -DinputPath $inputPath
41
fi