11# shellcheck shell=bash disable=SC2154,SC2129,SC2148
22report_results ()
33{
4- type_FC=` type ${FC} `
5- fully_qualified_FC=" /${type_FC#*/ } "
4+ fully_qualified_FC=" $( type -P " ${FC} " ) "
65 if [[ ${fully_qualified_FC} != * gfortran* ]]; then
76 emergency " report_results.sh: non-gfortran compiler: \$ {fully_qualified_FC}=${fully_qualified_FC} "
8- fi
7+ fi
98 # Set path_to_FC fully-qualified gfortran location
10- compiler_install_root=" ${fully_qualified_FC%% bin/ gfortran* } "
9+ compiler_install_root=" ${fully_qualified_FC% bin/ gfortran* } "
1110
12- type_MPIFC=` type ${MPIFC} `
13- fully_qualified_MPIFC=" /${type_MPIFC#*/ } "
14- mpi_install_root=" ${fully_qualified_MPIFC%% bin/ mpif90* } "
11+ fully_qualified_MPIFC=" $( type -P " ${MPIFC} " ) "
12+ mpi_install_root=" ${fully_qualified_MPIFC% bin/ mpif90* } "
1513
16- type_CMAKE=` type ${CMAKE} `
17- fully_qualified_CMAKE=" /${type_CMAKE#*/ } "
18- cmake_install_path=" ${fully_qualified_CMAKE%%/ cmake* } "
14+ fully_qualified_CMAKE=" $( type -P " ${CMAKE} " ) "
15+ cmake_install_path=" ${fully_qualified_CMAKE%/ cmake* } "
1916
2017 # Report installation success or failure and record locations for software stack:
2118 if [[ -x " ${install_path%/ } /bin/caf" && -x " ${install_path%/ } /bin/cafrun" ]]; then
@@ -35,51 +32,51 @@ report_results()
3532 ${SUDO:- } rm setup.csh
3633 fi
3734 # Prepend the OpenCoarrays license to the setup.sh script:
38- while IFS=' ' read -r line || [[ -n " $line " ]]; do
39- echo " # $line " >> setup.sh
35+ while IFS=' ' read -r line || [[ -n " ${ line} " ]]; do
36+ echo " # ${ line} " >> setup.sh
4037 done < " ${opencoarrays_src_dir} /LICENSE"
41- while IFS=' ' read -r line || [[ -n " $line " ]]; do
42- echo " # $line " >> setup.csh
38+ while IFS=' ' read -r line || [[ -n " ${ line} " ]]; do
39+ echo " # ${ line} " >> setup.csh
4340 done < " ${opencoarrays_src_dir} /LICENSE"
4441 echo " # " | tee -a setup.csh setup.sh
4542 echo " # Execute this script via the following command: " | tee -a setup.csh setup.sh
4643 echo " # source ${install_path%/ } /setup.sh " | tee -a setup.csh setup.sh
4744 echo " " | tee -a setup.csh setup.sh
48- if [[ -x " $cmake_install_path /cmake" ]]; then
45+ if [[ -x " ${ cmake_install_path} /cmake" ]]; then
4946 echo " # Prepend the CMake path to the PATH environment variable:" | tee -a setup.sh setup.csh
50- echo " if [[ -z \"\$ PATH\" ]]; then " >> setup.sh
47+ echo " if [[ -z \"\$ { PATH} \" ]]; then " >> setup.sh
5148 echo " export PATH=\" ${cmake_install_path%/ } /\" " >> setup.sh
5249 echo " else " >> setup.sh
53- echo " export PATH=\" ${cmake_install_path%/ } /\" :\$ PATH " >> setup.sh
50+ echo " export PATH=\" ${cmake_install_path%/ } /\" :\$ { PATH} " >> setup.sh
5451 echo " fi " >> setup.sh
5552 echo " set path = (\" ${cmake_install_path%/ } \" /\"\$ path\" ) " >> setup.csh
5653 fi
57- if [[ -x " $fully_qualified_FC " ]]; then
54+ if [[ -x " ${ fully_qualified_FC} " ]]; then
5855 echo " # Prepend the compiler path to the PATH environment variable:" | tee -a setup.sh setup.csh
59- echo " if [[ -z \"\$ PATH\" ]]; then " >> setup.sh
56+ echo " if [[ -z \"\$ { PATH} \" ]]; then " >> setup.sh
6057 echo " export PATH=\" ${compiler_install_root%/ } /bin\" " >> setup.sh
6158 echo " else " >> setup.sh
62- echo " export PATH=\" ${compiler_install_root%/ } /bin:\$ PATH\" " >> setup.sh
59+ echo " export PATH=\" ${compiler_install_root%/ } /bin:\$ { PATH} \" " >> setup.sh
6360 echo " fi " >> setup.sh
6461 echo " set path = (\" ${compiler_install_root%/ } \" /bin \"\$ path\" ) " >> setup.csh
6562 fi
6663 if [[ -d " ${compiler_install_root%/ } /lib" || -d " ${compiler_install_root%/ } /lib64" ]]; then
6764 echo " # Prepend the compiler library paths to the LD_LIBRARY_PATH environment variable:" | tee -a setup.sh setup.csh
6865 compiler_lib_paths=" ${compiler_install_root%/ } /lib64/:${compiler_install_root%/ } /lib"
69- echo " if [[ -z \"\$ LD_LIBRARY_PATH\" ]]; then " >> setup.sh
66+ echo " if [[ -z \"\$ { LD_LIBRARY_PATH} \" ]]; then " >> setup.sh
7067 echo " export LD_LIBRARY_PATH=\" ${compiler_lib_paths%/ } \" " >> setup.sh
7168 echo " else " >> setup.sh
72- echo " export LD_LIBRARY_PATH=\" ${compiler_lib_paths%/ } :\$ LD_LIBRARY_PATH\" " >> setup.sh
69+ echo " export LD_LIBRARY_PATH=\" ${compiler_lib_paths%/ } :\$ { LD_LIBRARY_PATH} \" " >> setup.sh
7370 echo " fi " >> setup.sh
7471 echo " set LD_LIBRARY_PATH = (\" ${compiler_lib_paths%/ } \" /bin \"\$ LD_LIBRARY_PATH\" ) " >> setup.csh
7572 fi
7673 echo " " >> setup.sh
77- if [[ -x " $mpi_install_root /bin/mpif90" ]]; then
74+ if [[ -x " ${ mpi_install_root} /bin/mpif90" ]]; then
7875 echo " # Prepend the MPI path to the PATH environment variable:" | tee -a setup.sh setup.csh
79- echo " if [[ -z \"\$ PATH\" ]]; then " >> setup.sh
76+ echo " if [[ -z \"\$ { PATH} \" ]]; then " >> setup.sh
8077 echo " export PATH=\" ${mpi_install_root%/ } /bin\" " >> setup.sh
8178 echo " else " >> setup.sh
82- echo " export PATH=\" ${mpi_install_root%/ } /bin\" :\$ PATH " >> setup.sh
79+ echo " export PATH=\" ${mpi_install_root%/ } /bin\" :\$ { PATH} " >> setup.sh
8380 echo " fi " >> setup.sh
8481 echo " set path = (\" ${mpi_install_root%/ } \" /bin \"\$ path\" ) " >> setup.csh
8582 fi
@@ -91,52 +88,52 @@ report_results()
9188 # the system versions of these packages are present and in the user's path or that the
9289 # user doesn't need them at all (e.g. there was no need to build gfortran from source).
9390 flex_install_path=$( " ${build_script} " -P flex)
94- if [[ -x " $flex_install_path /bin/flex" ]]; then
91+ if [[ -x " ${ flex_install_path} /bin/flex" ]]; then
9592 echo " # Prepend the flex path to the PATH environment variable:" | tee -a setup.sh setup.csh
96- echo " if [[ -z \"\$ PATH\" ]]; then " >> setup.sh
97- echo " export PATH=\" $flex_install_path /bin\" " >> setup.sh
93+ echo " if [[ -z \"\$ { PATH} \" ]]; then " >> setup.sh
94+ echo " export PATH=\" ${ flex_install_path} /bin\" " >> setup.sh
9895 echo " else " >> setup.sh
99- echo " export PATH=\" $flex_install_path /bin\" :\$ PATH " >> setup.sh
96+ echo " export PATH=\" ${ flex_install_path} /bin\" :\$ { PATH} " >> setup.sh
10097 echo " set path = (\" $flex_install_path \" /bin \"\$ path\" ) " >> setup.csh
10198 echo " fi " >> setup.sh
10299 fi
103100 bison_install_path=$( " ${build_script} " -P bison)
104- if [[ -x " $bison_install_path /bin/yacc" ]]; then
101+ if [[ -x " ${ bison_install_path} /bin/yacc" ]]; then
105102 echo " # Prepend the bison path to the PATH environment variable:" | tee -a setup.sh setup.csh
106- echo " if [[ -z \"\$ PATH\" ]]; then " >> setup.sh
107- echo " export PATH=\" $bison_install_path /bin\" " >> setup.sh
103+ echo " if [[ -z \"\$ { PATH} \" ]]; then " >> setup.sh
104+ echo " export PATH=\" ${ bison_install_path} /bin\" " >> setup.sh
108105 echo " else " >> setup.sh
109- echo " export PATH=\" $bison_install_path /bin\" :\$ PATH " >> setup.sh
106+ echo " export PATH=\" ${ bison_install_path} /bin\" :\$ { PATH} " >> setup.sh
110107 echo " fi " >> setup.sh
111108 echo " set path = (\" $bison_install_path \" /bin \"\$ path\" ) " >> setup.csh
112109 fi
113110 m4_install_path=$( " ${build_script} " -P m4)
114- if [[ -x " $m4_install_path /bin/m4" ]]; then
111+ if [[ -x " ${ m4_install_path} /bin/m4" ]]; then
115112 echo " # Prepend the m4 path to the PATH environment variable:" | tee -a setup.sh setup.csh
116- echo " if [[ -z \"\$ PATH\" ]]; then " >> setup.sh
117- echo " export PATH=\" $m4_install_path /bin\" " >> setup.sh
113+ echo " if [[ -z \"\$ { PATH} \" ]]; then " >> setup.sh
114+ echo " export PATH=\" ${ m4_install_path} /bin\" " >> setup.sh
118115 echo " else " >> setup.sh
119- echo " export PATH=\" $m4_install_path /bin\" :\$ PATH " >> setup.sh
116+ echo " export PATH=\" ${ m4_install_path} /bin\" :\$ { PATH} " >> setup.sh
120117 echo " fi " >> setup.sh
121118 echo " set path = (\" $m4_install_path \" /bin \"\$ path\" ) " >> setup.csh
122119 fi
123120 opencoarrays_install_path=" ${install_path} "
124- if [[ -x " $opencoarrays_install_path /bin/caf" ]]; then
121+ if [[ -x " ${ opencoarrays_install_path} /bin/caf" ]]; then
125122 echo " # Prepend the OpenCoarrays path to the PATH environment variable:" | tee -a setup.sh setup.csh
126- echo " if [[ -z \"\$ PATH\" ]]; then " >> setup.sh
123+ echo " if [[ -z \"\$ { PATH} \" ]]; then " >> setup.sh
127124 echo " export PATH=\" ${opencoarrays_install_path%/ } /bin\" " >> setup.sh
128125 echo " else " >> setup.sh
129- echo " export PATH=\" ${opencoarrays_install_path%/ } /bin\" :\$ PATH " >> setup.sh
126+ echo " export PATH=\" ${opencoarrays_install_path%/ } /bin\" :\$ { PATH} " >> setup.sh
130127 echo " fi " >> setup.sh
131128 echo " set path = (\" ${opencoarrays_install_path%/ } \" /bin \"\$ path\" ) " >> setup.csh
132129 fi
133- if ${SUDO:- } mv setup.sh " $opencoarrays_install_path " ; then
134- setup_sh_location=$opencoarrays_install_path
130+ if ${SUDO:- } mv setup.sh " ${ opencoarrays_install_path} " ; then
131+ setup_sh_location=${ opencoarrays_install_path}
135132 else
136133 setup_sh_location=${PWD}
137134 fi
138- if ${SUDO:- } mv setup.csh " $opencoarrays_install_path " ; then
139- setup_csh_location=$opencoarrays_install_path
135+ if ${SUDO:- } mv setup.csh " ${ opencoarrays_install_path} " ; then
136+ setup_csh_location=${ opencoarrays_install_path}
140137 else
141138 setup_csh_location=${PWD}
142139 fi
@@ -156,10 +153,10 @@ report_results()
156153 echo " OpenCoarrays compiler wrapper (caf), program launcher (cafrun), or prerequisite"
157154 echo " package installer (build), or these programs are not in the following, expected"
158155 echo " location:"
159- echo " $install_path /bin."
156+ echo " ${ install_path} /bin."
160157 echo " Please review the following file for more information:"
161- echo " $install_path / $ installation_record"
162- echo " and submit an bug report at https://github.com/sourceryinstitute/opencoarrays/issues"
158+ echo " ${ install_path} / ${ installation_record} "
159+ echo " and submit an bug report at https://github.com/sourceryinstitute/opencoarrays/issues/new "
163160 echo " [exit 100]"
164161 exit 100
165162
0 commit comments