Salome HOME
Process PV_PLUGIN_PATH envvar properly in the generated context file
[tools/install.git] / config_files / release_notes.sh
index cc2c064d58a36385f42ca6f858a6adf37366cebb..4bab28754264659e0c1080d8fb4f78eb93e8aaf0 100755 (executable)
@@ -1,54 +1,76 @@
-#!/bin/sh 
+#!/bin/bash -noprofile
 
 ####################################################################################
-# 
-# The script is the part of the SALOME installation procedure.
-# This script is used to show SALOME Release Notes.
+#  File      : release_notes.sh
+#  Created   : Tue Oct 30 11:11:23 2006
+#  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.
 #
-# Copyright : 2006 CEA/DEN, EDF R&D
 ####################################################################################
 
 # This procedure checks if the Release Notes file can be shown.
 # Returns 0 in success and 1 if any error occurs.
+
+VIEWER_PROGRAMS="acroread kpdf kghostview xpdf evince"
+
 check_enabled()
 {
-    ROOT_DIR=`(cd ${SRC_DIR}\.. ; pwd)`;
-    if [ "${ROOT_DIR}" != "" ] ; then 
-       rn_files=`find ${ROOT_DIR} -name "*Release_Notes.pdf"`
-       if [ "$?" == "0" ] && [ "$rn_files" != "" ] ; then
-           return 0;
+    ROOT_DIR=`(cd ${SCRIPT_DIR}/.. ; pwd)`;
+    # 1. check if there is appropriate PDF files viewer
+    for r in ${VIEWER_PROGRAMS} ; do
+       reader=`which ${r} 2>/dev/null`
+       if [ "$?" = "0" ] ; then
+           break;
        fi
+    done
+    # 2. check if Release Notes file is available
+    VER=`echo ${SALOME_VERSION} | tr "." "_"`
+    rn_file=${ROOT_DIR}/SALOME_${VER}_Release_Notes.pdf
+    if [ -f "${rn_file}" ] && [ "${reader}" != "" ] ; then
+       return 0
     fi
-    return 1;
+    return 1
 }
 
 # This procedure is used to show Release Notes file.
 # Returns 0 in success and 1 if any error occurs.
 execute()
 {
-    ROOT_DIR=`(cd ${SRC_DIR}\.. ; pwd)`;
-    if [ "${ROOT_DIR}" != "" ] ; then 
-       rn_file=`find ${ROOT_DIR} -name "*Release_Notes.pdf"`
-       if [ "$?" == "0" ] && [ "$rn_file" != "" ] ; then
-           xpdf=`which xpdf >& /dev/null`
-           if [ "$?" == "0" ] ; then
-               xpdf ${rn_file} &
-               return 0;
-           fi
+    ROOT_DIR=`(cd ${SCRIPT_DIR}/.. ; pwd)`;
+    # 1. find appropriate PDF files viewer
+    for r in ${VIEWER_PROGRAMS} ; do
+       reader=`which ${r} 2>/dev/null`
+       if [ "$?" = "0" ] ; then
+           break;
        fi
+    done
+    # 2. find Release Notes file and open it in the viewer
+    VER=`echo ${SALOME_VERSION} | tr "." "_"`
+    rn_file=${ROOT_DIR}/SALOME_${VER}_Release_Notes.pdf
+    if [ -f "${rn_file}" ] && [ "${reader}" != "" ] ; then
+       ${reader} ${rn_file} &
+       return 0;
     fi
     return 1;
 }
 
+SCRIPT_DIR=`dirname $0`
+
+source ${SCRIPT_DIR}/common.sh
+
 # Set general usage variables from the command line parameters:
 #     $0 is the path to this script itself
 #     $1 is the name of the procedure to be run
-#     $2 is the installation directory path
-#     $3 is the temporary directory path
-SCRIPT_DIR=`dirname $0`
+#     $2 is the installation directory path (not currently used)
+#     $3 is the temporary directory path (not currently used)
+
 PROCEDURE=$1;
-INSTALL_ROOT=$2;
+INST_ROOT=$2;
 INSTALL_WORK=$3;
 
 # Run the procedure
-$PROCEDURE
+${PROCEDURE}