1
1
# shellcheck shell=bash disable=SC2154,SC2129,SC2148
2
2
report_results ()
3
3
{
4
- type_FC=` type ${FC} `
5
- fully_qualified_FC=" /${type_FC#*/ } "
4
+ fully_qualified_FC=" $( type -P " ${FC} " ) "
6
5
if [[ ${fully_qualified_FC} != * gfortran* ]]; then
7
6
emergency " report_results.sh: non-gfortran compiler: \$ {fully_qualified_FC}=${fully_qualified_FC} "
8
- fi
7
+ fi
9
8
# 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* } "
11
10
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* } "
15
13
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* } "
19
16
20
17
# Report installation success or failure and record locations for software stack:
21
18
if [[ -x " ${install_path%/ } /bin/caf" && -x " ${install_path%/ } /bin/cafrun" ]]; then
@@ -35,51 +32,51 @@ report_results()
35
32
${SUDO:- } rm setup.csh
36
33
fi
37
34
# 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
40
37
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
43
40
done < " ${opencoarrays_src_dir} /LICENSE"
44
41
echo " # " | tee -a setup.csh setup.sh
45
42
echo " # Execute this script via the following command: " | tee -a setup.csh setup.sh
46
43
echo " # source ${install_path%/ } /setup.sh " | tee -a setup.csh setup.sh
47
44
echo " " | tee -a setup.csh setup.sh
48
- if [[ -x " $cmake_install_path /cmake" ]]; then
45
+ if [[ -x " ${ cmake_install_path} /cmake" ]]; then
49
46
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
51
48
echo " export PATH=\" ${cmake_install_path%/ } /\" " >> setup.sh
52
49
echo " else " >> setup.sh
53
- echo " export PATH=\" ${cmake_install_path%/ } /\" :\$ PATH " >> setup.sh
50
+ echo " export PATH=\" ${cmake_install_path%/ } /\" :\$ { PATH} " >> setup.sh
54
51
echo " fi " >> setup.sh
55
52
echo " set path = (\" ${cmake_install_path%/ } \" /\"\$ path\" ) " >> setup.csh
56
53
fi
57
- if [[ -x " $fully_qualified_FC " ]]; then
54
+ if [[ -x " ${ fully_qualified_FC} " ]]; then
58
55
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
60
57
echo " export PATH=\" ${compiler_install_root%/ } /bin\" " >> setup.sh
61
58
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
63
60
echo " fi " >> setup.sh
64
61
echo " set path = (\" ${compiler_install_root%/ } \" /bin \"\$ path\" ) " >> setup.csh
65
62
fi
66
63
if [[ -d " ${compiler_install_root%/ } /lib" || -d " ${compiler_install_root%/ } /lib64" ]]; then
67
64
echo " # Prepend the compiler library paths to the LD_LIBRARY_PATH environment variable:" | tee -a setup.sh setup.csh
68
65
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
70
67
echo " export LD_LIBRARY_PATH=\" ${compiler_lib_paths%/ } \" " >> setup.sh
71
68
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
73
70
echo " fi " >> setup.sh
74
71
echo " set LD_LIBRARY_PATH = (\" ${compiler_lib_paths%/ } \" /bin \"\$ LD_LIBRARY_PATH\" ) " >> setup.csh
75
72
fi
76
73
echo " " >> setup.sh
77
- if [[ -x " $mpi_install_root /bin/mpif90" ]]; then
74
+ if [[ -x " ${ mpi_install_root} /bin/mpif90" ]]; then
78
75
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
80
77
echo " export PATH=\" ${mpi_install_root%/ } /bin\" " >> setup.sh
81
78
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
83
80
echo " fi " >> setup.sh
84
81
echo " set path = (\" ${mpi_install_root%/ } \" /bin \"\$ path\" ) " >> setup.csh
85
82
fi
@@ -91,52 +88,52 @@ report_results()
91
88
# the system versions of these packages are present and in the user's path or that the
92
89
# user doesn't need them at all (e.g. there was no need to build gfortran from source).
93
90
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
95
92
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
98
95
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
100
97
echo " set path = (\" $flex_install_path \" /bin \"\$ path\" ) " >> setup.csh
101
98
echo " fi " >> setup.sh
102
99
fi
103
100
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
105
102
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
108
105
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
110
107
echo " fi " >> setup.sh
111
108
echo " set path = (\" $bison_install_path \" /bin \"\$ path\" ) " >> setup.csh
112
109
fi
113
110
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
115
112
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
118
115
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
120
117
echo " fi " >> setup.sh
121
118
echo " set path = (\" $m4_install_path \" /bin \"\$ path\" ) " >> setup.csh
122
119
fi
123
120
opencoarrays_install_path=" ${install_path} "
124
- if [[ -x " $opencoarrays_install_path /bin/caf" ]]; then
121
+ if [[ -x " ${ opencoarrays_install_path} /bin/caf" ]]; then
125
122
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
127
124
echo " export PATH=\" ${opencoarrays_install_path%/ } /bin\" " >> setup.sh
128
125
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
130
127
echo " fi " >> setup.sh
131
128
echo " set path = (\" ${opencoarrays_install_path%/ } \" /bin \"\$ path\" ) " >> setup.csh
132
129
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}
135
132
else
136
133
setup_sh_location=${PWD}
137
134
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}
140
137
else
141
138
setup_csh_location=${PWD}
142
139
fi
@@ -156,10 +153,10 @@ report_results()
156
153
echo " OpenCoarrays compiler wrapper (caf), program launcher (cafrun), or prerequisite"
157
154
echo " package installer (build), or these programs are not in the following, expected"
158
155
echo " location:"
159
- echo " $install_path /bin."
156
+ echo " ${ install_path} /bin."
160
157
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 "
163
160
echo " [exit 100]"
164
161
exit 100
165
162
0 commit comments