changeset 20:4a42266b1c65

tools/ika: Launch wrapper for ika to be used from users path. * tools/ika: Launch wrapper for ika to be used from users path.
author Xerxes R?nby <xerxes@zafena.se>
date Wed, 06 Apr 2011 12:26:03 +0200
parents bd66068b1c3f
children 096237a7473d
files tools/ika
diffstat 1 files changed, 53 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ika	Wed Apr 06 12:26:03 2011 +0200
@@ -0,0 +1,53 @@
+#! /bin/sh
+##
+ # IKA - IcedRobot Kiosk Application
+ # Copyright (C) 2011  IcedRobot team
+ # 
+ # This program is free software: you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation, either version 3 of the License, or
+ # (at your option) any later version.
+ # 
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ ##
+
+ika_exec_args="$@"
+
+if [ -z "$IKA_HOME" -o ! -d "$IKA_HOME" ] ; then
+    if [ -d /usr/share/ika ] ; then
+        IKA_HOME=/usr/share/ika
+    fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+    if [ -n "$JAVA_HOME"  ] ; then
+        JAVACMD="$JAVA_HOME/bin/java"
+    else
+        JAVACMD=`which java 2> /dev/null `
+        if [ -z "$JAVACMD" ] ; then
+            JAVACMD=java
+        fi
+    fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+    echo "Error: JAVA_HOME is not defined correctly."
+    echo "  We cannot execute $JAVACMD"
+    exit 1
+fi
+
+if [ ! -x "$IKA_HOME" ] ; then
+    echo "Error: IKA_HOME is not defined correctly."
+    echo "  We cannot find $IKA_HOME"
+    exit 1
+fi
+
+ika_exec_command="exec \"$JAVACMD\" \
+    -jar \"$IKA_HOME\"/target/ika-0.0.1-SNAPSHOT-jar-with-dependencies.jar"
+eval $ika_exec_command "$ika_exec_args"