Salome HOME
SALOME 7.3.0 preparation
[tools/install.git] / config_files / release_notes.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : release_notes.sh
5 #  Created   : Tue Oct 30 11:11:23 2006
6 #  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
7 #  Project   : SALOME
8 #  Module    : Installation Wizard
9 #  Copyright : 2002-2013 CEA
10 #
11 #  This script is the part of the SALOME installation procedure.
12 #
13 ####################################################################################
14
15 # This procedure checks if the Release Notes file can be shown.
16 # Returns 0 in success and 1 if any error occurs.
17
18 VIEWER_PROGRAMS="acroread kpdf kghostview xpdf evince"
19
20 check_enabled()
21 {
22     ROOT_DIR=`(cd ${SCRIPT_DIR}/.. ; pwd)`;
23     # 1. check if there is appropriate PDF files viewer
24     for r in ${VIEWER_PROGRAMS} ; do
25         reader=`which ${r} 2>/dev/null`
26         if [ "$?" = "0" ] ; then
27             break;
28         fi
29     done
30     # 2. check if Release Notes file is available
31     if [ "${ROOT_DIR}" != "" ] ; then 
32         rn_files=`find ${ROOT_DIR} -maxdepth 1 -name "*Release_Notes.pdf"`
33         if [ "$?" = "0" ] && [ "${rn_files}" != "" ] && [ "${reader}" != "" ] ; then
34             return 0;
35         fi
36     fi
37     return 1;
38 }
39
40 # This procedure is used to show Release Notes file.
41 # Returns 0 in success and 1 if any error occurs.
42 execute()
43 {
44     ROOT_DIR=`(cd ${SCRIPT_DIR}/.. ; pwd)`;
45     # 1. find appropriate PDF files viewer
46     for r in ${VIEWER_PROGRAMS} ; do
47         reader=`which ${r} 2> /dev/null`
48         if [ "$?" = "0" ] ; then
49             break;
50         fi
51     done
52     # 2. find Release Notes file and open it in the viewer
53     if [ "${ROOT_DIR}" != "" ] ; then 
54         rn_file=`find ${ROOT_DIR} -maxdepth 1 -name "*Release_Notes.pdf"`
55         if [ "$?" = "0" ] && [ "${rn_file}" != "" ] && [ "${reader}" != "" ] ; then
56             ${reader} ${rn_file} &
57             return 0;
58         fi
59     fi
60     return 1;
61 }
62
63 # Set general usage variables from the command line parameters:
64 #     $0 is the path to this script itself
65 #     $1 is the name of the procedure to be run
66 #     $2 is the installation directory path
67 #     $3 is the temporary directory path
68 SCRIPT_DIR=`dirname $0`
69 PROCEDURE=$1;
70 INST_ROOT=$2;
71 INSTALL_WORK=$3;
72
73 # Run the procedure
74 ${PROCEDURE}