@@ -21,7 +21,7 @@ build_and_install()
2121 fi
2222 mkdir -p " ${build_path} "
2323 info " pushd ${build_path} "
24- pushd " ${build_path} "
24+ pushd " ${build_path} " || emergency " build_and_install.sh: pushd failed "
2525
2626 if [[ " ${package_to_build} " != " gcc" ]]; then
2727
@@ -46,7 +46,7 @@ build_and_install()
4646 export cmake_binary_installer=" ${download_path} /cmake-${version_to_build} -Linux-x86_64.sh"
4747 ${SUDO:- } mkdir -p " $install_path "
4848 chmod u+x " ${cmake_binary_installer} "
49- if [[ ! -z " ${SUDO:- } " ]]; then
49+ if [[ -n " ${SUDO:- } " ]]; then
5050 info " You do not have write permissions to the installation path ${install_path} "
5151 info " If you have administrative privileges, enter your password to install ${package_to_build} "
5252 fi
@@ -63,7 +63,7 @@ build_and_install()
6363 info " FC=\" ${FC:- ' gfortran' } \" CC=\" ${CC:- ' gcc' } \" CXX=\" ${CXX:- ' g++' } \" make -j\" ${num_threads} \" "
6464 FC=" ${FC:- ' gfortran' } " CC=" ${CC:- ' gcc' } " CXX=" ${CXX:- ' g++' } " make " -j${num_threads} "
6565 info " Installing ${package_to_build} in ${install_path} "
66- if [[ ! -z " ${SUDO:- } " ]]; then
66+ if [[ -n " ${SUDO:- } " ]]; then
6767 info " You do not have write permissions to the installation path ${install_path} "
6868 info " If you have administrative privileges, enter your password to install ${package_to_build} "
6969 fi
@@ -75,7 +75,7 @@ build_and_install()
7575 elif [[ ${package_to_build} == " gcc" ]]; then
7676
7777 info " pushd ${download_path} /${package_source_directory} "
78- pushd " ${download_path} /${package_source_directory} "
78+ pushd " ${download_path} /${package_source_directory} " || emergency " build_and_install.sh: pushd failed "
7979
8080 # Patch gfortran if necessary
8181 export patches_dir=" ${OPENCOARRAYS_SRC_DIR} /prerequisites/build-functions/patches/${package_to_build} /${version_to_build} "
@@ -96,13 +96,13 @@ build_and_install()
9696 " ${PWD} " /contrib/download_prerequisites
9797
9898 info " popd"
99- popd
99+ popd || emergency " build_and_install.sh: popd failed "
100100 info " Configuring gcc/g++/gfortran builds with the following command:"
101101 info " ${download_path} /${package_source_directory} /configure --prefix=${install_path} --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror ${bootstrap_configure} "
102- " ${download_path} /${package_source_directory} /configure" --prefix=" ${install_path} " --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror ${bootstrap_configure}
102+ " ${download_path} /${package_source_directory} /configure" --prefix=" ${install_path} " --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror " ${bootstrap_configure} "
103103 info " Building with the following command: 'make -j${num_threads} ${bootstrap_build} '"
104- make " -j${num_threads} " ${bootstrap_build}
105- if [[ ! -z " ${SUDO:- } " ]]; then
104+ make " -j${num_threads} " " ${bootstrap_build} "
105+ if [[ -n " ${SUDO:- } " ]]; then
106106 info " You do not have write permissions to the installation path ${install_path} "
107107 info " If you have administrative privileges, enter your password to install ${package_to_build} "
108108 fi
@@ -115,5 +115,5 @@ build_and_install()
115115
116116
117117 info " popd"
118- popd
118+ popd || emergency " build_and_install.sh: popd failed "
119119}
0 commit comments