Salome HOME
Merge branch 'SALOME_7' of salome:tools/install into SALOME_7
authorvsr <vsr@opencascade.com>
Mon, 26 May 2014 07:00:40 +0000 (11:00 +0400)
committervsr <vsr@opencascade.com>
Mon, 26 May 2014 07:00:40 +0000 (11:00 +0400)
config_files/KERNEL.sh
config_files/common.sh
config_files/create_application.sh [new file with mode: 0755]
config_files/create_config.sh [deleted file]

index a57de851bb809c819853d5055000d1006fd2a5e2..8f9b84ec482c82e67601485a874b3fb6f1c200ac 100755 (executable)
@@ -127,20 +127,6 @@ try_preinstalled
 pickup_env()
 {
 make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE} ${PRODUCT_DIR}
-if [ -f ${PRODUCT_DIR}/bin/salome/createAppli.sh ] ; then
-    pushd ${PRODUCT_DIR} > /dev/null
-    version=`cat bin/salome/VERSION | awk -F: '{print $2}' | tr -d '[:space:]'`
-    dir="${HOME}/salome_appli_${version}"
-    ./bin/salome/createAppli.sh ${dir}
-    if [ -d ${dir}/env.d ] ; then
-       rm -rf ${dir}/env.d/*.sh
-    fi
-    if [ ! -e ${dir}/env.d ] ; then
-       mkdir -p ${dir}/env.d
-    fi
-    cp -f ${PRODUCT_DIR}/salome.sh ${dir}/env.d
-    popd > /dev/null
-fi
 ./create_config.sh ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_DIR}
 make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src ${PRODUCT_SRC_DIR}
 }
index 1687a64b830a4f7d884ba89e598485c7cc1f5fab..f33e2aaa92cf5252953fc747de13fe4fd74bb416 100755 (executable)
@@ -15,6 +15,7 @@
 export DELIM="------"
 export SHRC="salome.sh"
 export CSHRC="salome.csh"
+export CFGRC="salome.cfg"
 
 #####################################################
 # !WARNING! This is current SALOME version number
@@ -115,7 +116,7 @@ make_env()
 install_root=$1;  shift
 install_work=$1;
 
-for i in ${SHRC} ${CSHRC} ; do
+for i in ${SHRC} ${CSHRC} ${CFGRC} ; do
     if [ -e ${install_work}/${i} ]; then
        rm ${install_work}/${i}
     fi
@@ -127,6 +128,7 @@ if [ $# -eq 4 ] ; then
     product_env=${install_work}/env_${product_name}.sh
     (test -e ${product_env} && rm ${product_env} )
 fi
+
 ### !!! writing salome.sh file !!!  -> define INST_ROOT
 cat >> ${install_work}/${SHRC} <<EOF
 #${DELIM} Setting products installation directory ${DELIM}
@@ -139,17 +141,7 @@ export ENV_FOR_LAUNCH=1
 export LC_NUMERIC=C
 
 EOF
-### !!! The next is for RedHat 9 only !!!
-if [ -f /etc/redhat-release ] ; then
-  grep -e "Red Hat Linux release 9" /etc/redhat-release > /dev/null
-  if [ $? -eq 0 ] ; then
-    cat >> ${install_work}/${SHRC} <<EOF
-#${DELIM} Force RH9 to use old implementation of threads ${DELIM}
-export LD_ASSUME_KERNEL=2.4.18
 
-EOF
-  fi
-fi
 ### !!! writing salome.csh file !!! -> set inital variables
 pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH"
 for i in ${pre_vars} ; do
@@ -162,6 +154,12 @@ endif
 EOF
 done
 
+### !!! writing salome.cfs file !!! -> set inital variables
+cat >> ${install_work}/${CFGRC} <<EOF
+[SALOME Configuration]
+
+EOF
+
 ### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|p)' where necessary
 ### Note, that for performance reasons temporary environment files used during installation procedure itself
 ### are created without using setenv(a|p) aliases.
@@ -386,13 +384,24 @@ cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_${CSHRC} 2>/dev/null
 
 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
 
+# 7. Create a salome.cfg file from salome.sh
+cat ${install_work}/${SHRC} | grep -v -e "^## " | grep -v "PV_PLUGIN_PATH" | awk 'BEGIN {v=1} /if / {v=0;} /fi/ {v=1;} {if (match($0, "KERNEL")) exit 0; else if(v==1 && match($0, "^ *fi *$")==0) print $0;}' >> ${install_work}/${CFGRC}
+sed -i "s%export PATH=\(.*\):\${\?PATH}\?%ADD_TO_PATH: \1%g" ${install_work}/${CFGRC}
+sed -i "s%export LD_LIBRARY_PATH=\(.*\):\${\?LD_LIBRARY_PATH}\?%ADD_TO_LD_LIBRARY_PATH: \1%g" ${install_work}/${CFGRC}
+sed -i "s%export PYTHONPATH=\(.*\):\${\?PYTHONPATH}\?%ADD_TO_PYTHONPATH: \1%g" ${install_work}/${CFGRC}
+sed -i "s%export %%g" ${install_work}/${CFGRC}
+sed -i "s%INST_ROOT%ROOT_SALOME%g" ${install_work}/${CFGRC}
+sed -i "s%\${\?\([A-Za-z0-9_]\+\)}\?%\%(\1)s%g" ${install_work}/${CFGRC}
+
 if [ $# -eq 5 ] ; then
     product_dir=$5
-    if [ -e ${product_dir} ] ; then
+    if [ -d ${product_dir} ] ; then
        test -e ${product_dir}/${SHRC} && mv ${product_dir}/${SHRC} ${product_dir}/${SHRC}_`date +%F_%T`
        cp ${install_work}/_${SHRC}  ${product_dir}/${SHRC}
        test -e ${product_dir}/${CSHRC} && mv ${product_dir}/${CSHRC} ${product_dir}/${CSHRC}_`date +%F_%T`
        cp ${install_work}/_${CSHRC} ${product_dir}/${CSHRC}
+       test -e ${product_dir}/${CFGRC} && mv ${product_dir}/${CFGRC} ${product_dir}/${CFGRC}_`date +%F_%T`
+       cp ${install_work}/${CFGRC} ${product_dir}/${CFGRC}
     fi
 fi
 sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_${CSHRC} > ${install_root}/env_build.csh
@@ -402,6 +411,7 @@ cp -f ${install_work}/_${CSHRC} ${install_root}/env_products.csh
 cp -f ${install_work}/_${SHRC}  ${install_root}/env_products.sh
 
 rm -f ${install_work}/_${SHRC} ${install_work}/_${CSHRC}
+
 ### !!! copying build.csh and build.sh scripts
 if [ -e ./build.csh ] && [ ! -e ${install_root}/build.csh ]; then
     cp -f ./build.csh ${install_root}
@@ -409,6 +419,7 @@ fi
 if [ -e ./build.sh ] && [ ! -e ${install_root}/build.sh ]; then
     cp -f ./build.sh ${install_root}
 fi
+
 ### !!! copying release notes
 for p in `ls ../` ; do
     export pdf=`echo ${p} | sed s/[.]/" "/g | awk '{print $2}'`
diff --git a/config_files/create_application.sh b/config_files/create_application.sh
new file mode 100755 (executable)
index 0000000..3681346
--- /dev/null
@@ -0,0 +1,101 @@
+#!/bin/bash -noprofile
+
+####################################################################################
+#  File      : create_application.sh
+#  Created   : Fri May 30 10:40:01 2008
+#  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
+#  Project   : SALOME
+#  Module    : Installation Wizard
+#  Copyright : 2002-2014 CEA
+#
+#  This script is the part of the SALOME installation procedure.
+#
+####################################################################################
+
+source ./common.sh
+
+export INST_ROOT=$1
+export INSTALL_WORK=$2
+export PRODUCT_SEQUENCE=$3
+export INSTALL_PRODUCTS=$4
+export PRODUCT_DIR=$5
+
+# --- configuration file ---
+CONFIG_FILE=${INSTALL_WORK}/config_appli.xml
+
+# -- spacing for configuration file ---
+SPACING="  "
+
+# ----------------------------------
+# create and source environment file
+# ----------------------------------
+
+make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
+source ${INSTALL_WORK}/${SHRC}
+
+# ----------------------------------
+# create config file
+# ----------------------------------
+
+# remove previous config file
+if [ -e ${CONFIG_FILE} ] ; then
+    rm -f ${CONFIG_FILE}
+fi
+
+# create empty config file
+touch ${CONFIG_FILE}
+
+# begin <application> tag
+echo "<application>" >> ${CONFIG_FILE}
+
+# <prerequisites> tag : path to the environment script
+echo "${SPACING}<prerequisites path=\"${PRODUCT_DIR}/salome.sh\"/>" >> ${CONFIG_FILE}
+
+# <context> tag : path to the context file
+echo "${SPACING}<context path=\"${PRODUCT_DIR}/salome.cfg\"/>" >> ${CONFIG_FILE}
+
+# <resources> tag
+echo "${SPACING}<resources path=\"CatalogResources.xml\"/>" >> ${CONFIG_FILE}
+
+# begin <modules> tag
+echo "${SPACING}<modules>" >> ${CONFIG_FILE}
+
+# for each module create <module> tag
+ALL_ENV="KERNEL GUI `env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }' | grep -v -E '^(SALOME|KERNEL|GUI)$' | sort -u`"
+
+for p in ${ALL_ENV} ; do
+    pvar=${p}_ROOT_DIR
+    pdir=${!pvar}
+    # if it's a SALOME module, it should have share/salome/resources sub-directory
+    if [ -d ${pdir}/share/salome/resources ] ; then
+       case ${p} in
+           KERNEL | GUI | COMPONENT | *CALCULATOR | RANDOMIZER | DSCCODE | *PLUGIN ) echo "${SPACING}${SPACING}<module name=\"${p}\" gui=\"no\" path=\"${pdir}\"/>" >> ${CONFIG_FILE} ;;
+           * ) echo "${SPACING}${SPACING}<module name=\"${p}\" gui=\"yes\" path=\"${pdir}\"/>" >> ${CONFIG_FILE} ;;
+       esac
+    fi
+done
+
+# end <modules> tag
+echo "${SPACING}</modules>" >> ${CONFIG_FILE}
+
+# <samples> tag : path to the samples directory
+if [ -n ${DATA_DIR} ] && [ -d ${DATA_DIR} ] ; then
+    echo "${SPACING}<samples path=\"${DATA_DIR}\"/>" >> ${CONFIG_FILE}
+fi
+
+# end <application> tag
+echo "</application>" >> ${CONFIG_FILE}
+
+# copy resulting confuguration file to the KERNEL module
+if [ -n "${PRODUCT_DIR}" ] && [ -d ${PRODUCT_DIR} ] ; then
+    cp -f ${CONFIG_FILE} ${PRODUCT_DIR}
+fi
+
+# ----------------------------------
+# generate application
+# ----------------------------------
+
+if [ -f ${PRODUCT_DIR}/bin/salome/appli_gen.py ] ; then
+    version=`head -n1 ${PRODUCT_DIR}/bin/salome/VERSION | awk -F: '{print $2}' | tr -d '[:space:]'`
+    ${PRODUCT_DIR}/bin/salome/appli_gen.py --prefix=${INST_ROOT}/salome_appli_${version} --config=${PRODUCT_DIR}/config_appli.xml >& /dev/null
+fi
diff --git a/config_files/create_config.sh b/config_files/create_config.sh
deleted file mode 100755 (executable)
index 2facfd8..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash -noprofile
-
-####################################################################################
-#  File      : create_config.sh
-#  Created   : Fri May 30 10:40:01 2008
-#  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
-#  Project   : SALOME
-#  Module    : Installation Wizard
-#  Copyright : 2002-2014 CEA
-#
-#  This script is the part of the SALOME installation procedure.
-#
-####################################################################################
-
-source ./common.sh
-
-export INST_ROOT=$1
-export INSTALL_WORK=$2
-export PRODUCT_SEQUENCE=$3
-export INSTALL_PRODUCTS=$4
-export PRODUCT_DIR=$5
-
-# --- configuration file ---
-CONFIG_FILE=${INSTALL_WORK}/config_appli.xml
-
-# create and source environment file
-make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
-source ${INSTALL_WORK}/${SHRC}
-
-# remove config file
-if [ -e ${CONFIG_FILE} ] ; then
-    rm ${CONFIG_FILE}
-fi
-# create empty config file
-touch ${CONFIG_FILE}
-
-# begin <application> tag
-echo "<application>" >> ${CONFIG_FILE}
-
-# <prerequisites> tag : path to the environment script
-echo "  <prerequisites path=\"${INST_ROOT}/env_products.sh\"/>" >> ${CONFIG_FILE}
-
-# begin <modules> tag
-echo "  <modules>" >> ${CONFIG_FILE}
-
-# for each module create <module> tag
-ALL_ENV="`env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }' | grep -v -E '^SALOME$'`"
-
-for p in ${ALL_ENV} ; do
-    pvar=${p}_ROOT_DIR
-    pdir=${!pvar}
-    if [ -d ${pdir}/share/salome/resources ] ; then
-       case ${p} in
-           KERNEL | GUI | *PLUGIN ) echo "    <module name=\"${p}\" gui=\"no\" path=\"${pdir}\"/>" >> ${CONFIG_FILE} ;;
-           * ) echo "    <module name=\"${p}\" gui=\"yes\" path=\"${pdir}\"/>" >> ${CONFIG_FILE} ;;
-       esac
-    fi
-done
-
-# end <modules> tag
-echo "  </modules>" >> ${CONFIG_FILE}
-
-# <samples> tag : path to the samples directory
-if [ -n ${DATA_DIR} ] && [ -d ${DATA_DIR} ] ; then
-    echo "  <samples path=\"${DATA_DIR}\"/>" >> ${CONFIG_FILE}
-fi
-
-# end <application> tag
-echo "</application>" >> ${CONFIG_FILE}
-
-# copy resulting confuguration file to the KERNEL module
-if [ -n "${PRODUCT_DIR}" ] && [ -d ${PRODUCT_DIR} ] ; then
-    cp -f ${CONFIG_FILE} ${PRODUCT_DIR}/bin/salome
-fi