]> SALOME platform Git repositories - tools/install.git/blob - config_files/PYHELLO_BIN.sh
Salome HOME
e4830661d018c9ab8b65da79ef0bcd245cdf3a6b
[tools/install.git] / config_files / PYHELLO_BIN.sh
1 #!/bin/sh
2
3 check_version(){
4 if [ -n "${PYHELLO_ROOT_DIR}" ]; then
5     if [ -f ${PYHELLO_ROOT_DIR}/bin/salome/VERSION ]; then
6         ver=`cat ${PYHELLO_ROOT_DIR}/bin/salome/VERSION | awk -F: '{print $NF}' | tr -d '[:space:]' ` 
7         if [ "$ver" = "3.2.2" ]; then
8             return 0
9         fi
10     fi
11 fi
12 return 1
13 }
14
15 print_env(){
16 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
17 #$DELIM ${PRODUCT_TYPE} $DELIM
18 export PYHELLO_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
19 if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
20   if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
21     export PATH=\${PYHELLO_ROOT_DIR}/bin/salome:\${PATH}
22     export PYTHONPATH=\${PYHELLO_ROOT_DIR}/bin/salome:\${PYHELLO_ROOT_DIR}/lib/python\${PYTHON_VERSION}/site-packages/salome:\${PYTHONPATH}
23   fi
24 fi
25 ##
26 EOF
27 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
28 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
29 }
30
31 # looks for the native product and collects it's environment (used by make_env())
32 try_native(){
33 check_version
34 if [ $? -eq 0 ] ; then
35     cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
36 #$DELIM ${PRODUCT_TYPE} $DELIM
37 export PYHELLO_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
38 if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
39   if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
40     export PATH=\${PYHELLO_ROOT_DIR}/bin/salome:\${PATH}
41     export PYTHONPATH=\${PYHELLO_ROOT_DIR}/bin/salome:\${PYHELLO_ROOT_DIR}/lib/python\${PYTHON_VERSION}/site-packages/salome:\${PYTHONPATH}
42   fi
43 fi
44 ##
45 EOF
46     make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
47     return 0
48 fi
49 return 1;
50 }
51
52 try_preinstalled(){
53 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
54 return $?
55 }
56
57 install_source()
58 {
59 return 1
60 }
61
62 install_binary()
63 {
64 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
65 source ${INSTALL_WORK}/$SHRC
66
67 check_jb tar xfz ${SOURCE_DIR}/PYHELLObinariesV3.2.2.tar.gz -C ${INSTALL_ROOT}
68
69 # modify all *.la files
70 export PYHELLO_ROOT_DIR=${PRODUCT_DIR}
71 modif_la_files ${PRODUCT_DIR}
72
73 cd ${PRODUCT_DIR}/bin/salome
74 sed -e "s%export KERNEL_ROOT_DIR=.*%export KERNEL_ROOT_DIR=${KERNEL_ROOT_DIR}%g"    runAppli > _runAppli
75 sed -e "s%export PYHELLO_ROOT_DIR=.*%export PYHELLO_ROOT_DIR=${PYHELLO_ROOT_DIR}%g" _runAppli > runAppli
76 chmod a+x runAppli
77
78 print_env
79 }
80
81 export PROCEDURE=$1;
82 export INSTALL_WORK=$2;
83 export SOURCE_DIR=$3;
84 export INSTALL_ROOT=$4;
85 export PRODUCT_SEQUENCE=$5;
86 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="PyHelloBin" ; fi
87 export PRODUCT="PYHELLO_3.2.2"
88 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
89 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
90 source ./common.sh
91 $PROCEDURE