From fee09479786323e7688b8bb5e7b11331bf24e049 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 9 Jul 2015 13:40:27 +0200 Subject: [PATCH] scripts/Bootstrap/compile_pmodules.sh - adapted to new format of Pmodules_version.conf - conditional compiling --- scripts/Bootstrap/compile_pmodules.sh | 51 +++++++++++++++++++++------ 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/scripts/Bootstrap/compile_pmodules.sh b/scripts/Bootstrap/compile_pmodules.sh index 20c642e..7b5ff11 100755 --- a/scripts/Bootstrap/compile_pmodules.sh +++ b/scripts/Bootstrap/compile_pmodules.sh @@ -3,22 +3,51 @@ declare -r BASE_DIR=$(cd "$(dirname $0)/../.." && pwd) declare -r BOOTSTRAP_DIR="${BASE_DIR}/scripts/Bootstrap" -source "${BOOTSTRAP_DIR}/Pmodules_version.conf" +source "${BASE_DIR}/lib/lib.bash" + +read_versions "${BOOTSTRAP_DIR}/Pmodules_version.conf" unset PMODULES_HOME source "/opt/psi/config/environment.bash" -if [[ -n ${PMODULES_DIR} ]] && [[ "${PMODULES_DIR}" != "/" ]] && [[ -d "${PMODULES_DIR}" ]]; then - rm -rf "${PMODULES_DIR}" +#if [[ -n ${PMODULES_DIR} ]] && [[ "${PMODULES_DIR}" != "/" ]] && [[ -d "${PMODULES_DIR}" ]]; then +# rm -rf "${PMODULES_DIR}" +#fi + +build () { + local -r name="$1" + local -r version="$2" + + "${BOOTSTRAP_DIR}/${name}/build" --bootstrap --disable-cleanup "${version}" || \ + die 3 "Compiling '${name}' failed!" +} + +if [[ ! -f "${PMODULES_HOME}/bin/base64" ]]; then + build coreutils "${COREUTILS_VERSION}" fi -${BOOTSTRAP_DIR}/coreutils/build --bootstrap --disable-cleanup || { echo "compiling 'coreutils' failed!"; exit 1; } -${BOOTSTRAP_DIR}/gettext/build --bootstrap --disable-cleanup || { echo "compiling 'gettext' failed!"; exit 1; } -${BOOTSTRAP_DIR}/getopt/build --bootstrap --disable-cleanup || { echo "compiling 'getopt' failed!"; exit 1; } -${BOOTSTRAP_DIR}/dialog/build --bootstrap --disable-cleanup || { echo "compiling 'dialog' failed!"; exit 1; } -${BOOTSTRAP_DIR}/bash/build --bootstrap --disable-cleanup 4.3.30 || { echo "compiling 'bash' failed!"; exit 1; } -${BOOTSTRAP_DIR}/Tcl/build --bootstrap --disable-cleanup || { echo "compiling 'Tcl' failed!"; exit 1; } -${BOOTSTRAP_DIR}/Modules/build --bootstrap || { echo "compiling 'Modules' failed!"; exit 1; } +if [[ ! -f "${PMODULES_HOME}/bin/xgettext" ]]; then + build gettext "${GETTEXT_VERSION}" +fi -mv -v "${PMODULES_HOME}/bin/modulecmd" "${PMODULES_HOME}/bin/modulecmd.tcl" +if [[ ! -f "${PMODULES_HOME}/bin/getopt" ]]; then + build getopt "${GETOPT_VERSION}" +fi + +if [[ ! -f "${PMODULES_HOME}/bin/dialog" ]]; then + build dialog "${DIALOG_VERSION}" +fi + +if [[ ! -f "${PMODULES_HOME}/bin/bash" ]]; then + build bash "4.3.30" +fi + +if [[ ! -e "${PMODULES_HOME}/bin/tclsh" ]]; then + build Tcl "${TCL_VERSION}" +fi + +if [[ ! -e "${PMODULES_HOME}/bin/modulecmd.tcl" ]]; then + build Modules "${MODULES_VERSION}" + mv -v "${PMODULES_HOME}/bin/modulecmd" "${PMODULES_HOME}/bin/modulecmd.tcl" +fi echo "Done..."