Salome HOME
Minor fix
[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 check_enabled()
18 {
19     ROOT_DIR=`(cd ${SCRIPT_DIR}/.. ; pwd)`;
20     # 1. check if there is appropriate PDF files viewer
21     for r in acroread kpdf kghostview xpdf ; do
22         reader=`which ${r} 2>/dev/null`
23         if [ "$?" = "0" ] ; then
24             break;
25         fi
26     done
27     # 2. check if Release Notes file is available
28     if [ "${ROOT_DIR}" != "" ] ; then 
29         rn_files=`find ${ROOT_DIR} -maxdepth 1 -name "*Release_Notes.pdf"`
30         if [ "$?" = "0" ] && [ "${rn_files}" != "" ] && [ "${reader}" != "" ] ; then
31             return 0;
32         fi
33     fi
34     return 1;
35 }
36
37 # This procedure is used to show Release Notes file.
38 # Returns 0 in success and 1 if any error occurs.
39 execute()
40 {
41     ROOT_DIR=`(cd ${SCRIPT_DIR}/.. ; pwd)`;
42     # 1. find appropriate PDF files viewer
43     for r in acroread kpdf kghostview xpdf ; do
44         reader=`which ${r} 2> /dev/null`
45         if [ "$?" = "0" ] ; then
46             break;
47         fi
48     done
49     # 2. find Release Notes file and open it in the viewer
50     if [ "${ROOT_DIR}" != "" ] ; then 
51         rn_file=`find ${ROOT_DIR} -maxdepth 1 -name "*Release_Notes.pdf"`
52         if [ "$?" = "0" ] && [ "${rn_file}" != "" ] && [ "${reader}" != "" ] ; then
53             ${reader} ${rn_file} &
54             return 0;
55         fi
56     fi
57     return 1;
58 }
59
60 # Set general usage variables from the command line parameters:
61 #     $0 is the path to this script itself
62 #     $1 is the name of the procedure to be run
63 #     $2 is the installation directory path
64 #     $3 is the temporary directory path
65 SCRIPT_DIR=`dirname $0`
66 PROCEDURE=$1;
67 INST_ROOT=$2;
68 INSTALL_WORK=$3;
69
70 # Run the procedure
71 ${PROCEDURE}