0
|
1 |
#!/bin/bash
|
|
2 |
#
|
|
3 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
# All rights reserved.
|
|
5 |
# This component and the accompanying materials are made available
|
|
6 |
# under the terms of "Eclipse Public License v1.0"
|
|
7 |
# which accompanies this distribution, and is available
|
|
8 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
9 |
#
|
3
|
10 |
# Contributors:
|
0
|
11 |
# Nokia Corporation - initial contribution.
|
|
12 |
#
|
3
|
13 |
# Description:
|
0
|
14 |
# ConE tool wrapper for Unix
|
|
15 |
|
|
16 |
# Check that Python is available
|
|
17 |
# ------------------------------
|
3
|
18 |
python -c None &> /dev/null
|
0
|
19 |
if [ $? -ne 0 ]
|
|
20 |
then
|
|
21 |
echo "Python is required to run ConE!"
|
|
22 |
exit 1
|
|
23 |
fi
|
|
24 |
|
|
25 |
|
|
26 |
# Determine the path where ConE is installed
|
|
27 |
# ------------------------------------------
|
|
28 |
|
3
|
29 |
SCRIPT_FILE=`readlink -f $0`
|
|
30 |
CONE_BASEDIR=`dirname "$SCRIPT_FILE"`/configurationengine/linux
|
|
31 |
|
|
32 |
if [ ! -e "$CONE_BASEDIR" ]
|
0
|
33 |
then
|
3
|
34 |
echo "Cannot run ConE, the ConE base directory does not exist:"
|
|
35 |
echo $CONE_BASEDIR
|
|
36 |
exit 1
|
0
|
37 |
fi
|
|
38 |
|
|
39 |
# Find out the Python version
|
|
40 |
# ---------------------------
|
3
|
41 |
PYTHON_VERSION=`python -c "import sys; sys.stdout.write(sys.version[:3])"`
|
0
|
42 |
#echo "Python version: $PYTHON_VERSION"
|
|
43 |
|
|
44 |
|
|
45 |
# Set the correct lib and scripts directories
|
|
46 |
# to use based on the Python version
|
|
47 |
# -------------------------------------------
|
|
48 |
case $PYTHON_VERSION in
|
|
49 |
"2.5")
|
|
50 |
CONE_BASEDIR="$CONE_BASEDIR/2.5"
|
|
51 |
;;
|
|
52 |
"2.6")
|
|
53 |
CONE_BASEDIR="$CONE_BASEDIR/2.6"
|
|
54 |
;;
|
|
55 |
*)
|
|
56 |
echo "You are using an unsupported Python version ($PYTHON_VERSION)"
|
|
57 |
echo "ConE requires Python 2.5 or 2.6"
|
|
58 |
exit 1
|
|
59 |
;;
|
|
60 |
esac
|
|
61 |
|
|
62 |
#echo "CONE_BASEDIR: $CONE_BASEDIR"
|
|
63 |
|
|
64 |
|
|
65 |
# Check that this ConE installation supports the Python version
|
|
66 |
# -------------------------------------------------------------
|
|
67 |
if [ ! -e "$CONE_BASEDIR" ]
|
|
68 |
then
|
|
69 |
echo "Python version $PYTHON_VERSION is not supported by this ConE installation"
|
|
70 |
exit 1
|
|
71 |
fi
|
|
72 |
|
|
73 |
|
|
74 |
# Override PYTHONPATH so that the libraries in
|
|
75 |
# the standalone installation are used
|
|
76 |
# --------------------------------------------
|
|
77 |
export PYTHONPATH="$CONE_BASEDIR/lib:$PYTHONPATH"
|
|
78 |
|
|
79 |
# Run cone_tool.py
|
|
80 |
# ----------------
|
3
|
81 |
python $CONE_BASEDIR/scripts/cone_tool.py "$@"
|