From b80f27d2e3444902831dc492df0a4af2b7367278 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 31 May 2017 15:22:48 +0200 Subject: [PATCH] - merge scripts 'configure', 'compile_pmodules' and 'install_pmodules' into new script 'build' - merge 'environment.{bash,csh}.in' into 'profile.{bash,csh}.in' - set version to 0.99.12 --- Pmodules/environment.bash.in | 30 --- Pmodules/environment.csh.in | 17 -- Pmodules/profile.bash | 59 ----- Pmodules/profile.bash.in | 62 +++++ Pmodules/{profile.csh => profile.csh.in} | 26 +- bootstrap.sh | 39 --- build | 300 +++++++++++++++++++++++ compile_pmodules.sh | 92 ------- config/versions.conf | 2 +- configure | 50 ---- install_pmodules.sh | 127 ---------- 11 files changed, 378 insertions(+), 426 deletions(-) delete mode 100644 Pmodules/environment.bash.in delete mode 100755 Pmodules/environment.csh.in delete mode 100644 Pmodules/profile.bash create mode 100644 Pmodules/profile.bash.in rename Pmodules/{profile.csh => profile.csh.in} (72%) delete mode 100755 bootstrap.sh create mode 100755 build delete mode 100755 compile_pmodules.sh delete mode 100755 configure delete mode 100755 install_pmodules.sh diff --git a/Pmodules/environment.bash.in b/Pmodules/environment.bash.in deleted file mode 100644 index bb06aad..0000000 --- a/Pmodules/environment.bash.in +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# Notes: -# - PMODULES_ROOT is derived from the location of this file. -# - Some for PMODULES_CONFIG_DIR. -# - The Pmodules software must be installed in -# ${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION} -# - -declare -x PMODULES_MODULEFILES_DIR='modulefiles' -declare -x PMODULES_TEMPLATES_DIR='templates' - -declare -x PMODULES_DEFAULT_GROUPS='Tools Programming' -declare -x PMODULES_DEFINED_RELEASES=':unstable:stable:deprecated:' -declare -x PMODULES_DEFAULT_RELEASES='stable' - -if [[ -z ${PMODULES_VERSION} ]]; then - declare -x PMODULES_VERSION="@PMODULES_VERSION@" -fi - -# -# DO NOT CHANGE THE FOLLOWING LINES! - -declare -x PMODULES_ROOT=$(cd $(dirname "${BASH_SOURCE}")/.. && pwd) -declare -x PMODULES_CONFIG_DIR=$(basename $(cd $(dirname "${BASH_SOURCE}") && pwd)) -declare -x PMODULES_HOME="${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION}" -declare -x PMODULES_DIR="${PMODULES_HOME}" - -declare -x PMODULES_DISTFILESDIR="@PMODULES_DISTFILESDIR@" -declare -x PMODULES_TMPDIR="@PMODULES_TMPDIR@" diff --git a/Pmodules/environment.csh.in b/Pmodules/environment.csh.in deleted file mode 100755 index 937771c..0000000 --- a/Pmodules/environment.csh.in +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/tcsh - -setenv PMODULES_ROOT "/opt/psi" - -if ( ! $?PMODULES_VERSION ) then - setenv PMODULES_VERSION "@PMODULES_VERSION@" -endif -setenv PMODULES_HOME "$PMODULES_ROOT/Tools/Pmodules/$PMODULES_VERSION" -setenv PMODULES_DIR "${PMODULES_HOME}" - -setenv PMODULES_CONFIG_DIR 'config' -setenv PMODULES_MODULEFILES_DIR 'modulefiles' -setenv PMODULES_TEMPLATES_DIR 'templates' - -setenv PMODULES_DEFAULT_GROUPS 'Tools Programming' -setenv PMODULES_DEFINED_RELEASES ':unstable:stable:deprecated:' -setenv PMODULES_DEFAULT_RELEASES 'stable' diff --git a/Pmodules/profile.bash b/Pmodules/profile.bash deleted file mode 100644 index 77e4b6e..0000000 --- a/Pmodules/profile.bash +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -############################################################################# -# D O N O T C H A N G E T H I S F I L E ! # -############################################################################# - -############################################################################# -# read Pmodules configuration -# -_init_env_file="$(dirname ${BASH_SOURCE})/environment.bash" -if [[ ! -r "${_init_env_file}" ]]; then - echo "Oops: cannot initialize Modules!" - echo "${_init_env_file}: file does not exist or is not readable." - return 1 -fi -source "${_init_env_file}" -unset _init_env_file - -############################################################################ -# check configuration -# -if [[ -z ${PMODULES_ROOT} ]]; then - echo "Oops: Pmodules root not set." 1>&2 - return 1 -fi -if [[ ! -d ${PMODULES_ROOT} ]]; then - echo "Oops: ${PMODULES_ROOT}: Set as Pmodules root, but this is not a directory." 1>&2 - return 1 -fi -if [[ -z ${PMODULES_VERSION} ]]; then - echo "Oops: ${PMODULES_VERSION}: Pmodules version not set." 1>&2 - return 1 -fi -if [[ -z ${PMODULES_HOME} ]]; then - echo "Oops: Pmodules home not set." 1>&2 - return 1 -fi -if [[ ! -d ${PMODULES_HOME} ]]; then - echo "Oops: ${PMODULES_HOME}: Set as Pmodules home, but this is not a directory." 1>&2 - return 1 -fi - -############################################################################ -# inititialize Pmodules for bash -# -_init_bash="${PMODULES_HOME}/init/bash" -if [[ ! -r "${_init_bash}" ]]; then - echo "Oops: cannot initialize Modules!" - echo "${_init_bash}: File does not exist or is not readable." - return 1 -fi -source "${_init_bash}" -unset _init_bash - -# Local Variables: -# mode: sh -# sh-basic-offset: 8 -# tab-width: 8 -# End: diff --git a/Pmodules/profile.bash.in b/Pmodules/profile.bash.in new file mode 100644 index 0000000..9d1df2d --- /dev/null +++ b/Pmodules/profile.bash.in @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Notes: +# - PMODULES_ROOT is derived from the location of this file. +# - Some for PMODULES_CONFIG_DIR. +# - The Pmodules software must be installed in +# ${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION} +# + +: ${PMODULES_DEFAULT_GROUPS:='Tools Programming'} +: ${PMODULES_DEFAULT_RELEASES:='stable'} +: ${PMODULES_VERSION:="@PMODULES_VERSION@}" + +############################################################################# +# N O C H A N G E S B E L O W T H I S L I N E ! # +############################################################################# + +declare -x PMODULES_DEFAULT_GROUPS +declare -x PMODULES_DEFAULT_RELEASES +declare -x PMODULES_VERSION + +declare -x PMODULES_MODULEFILES_DIR='modulefiles' +declare -x PMODULES_DEFINED_RELEASES=':unstable:stable:deprecated:' + +declare -x PMODULES_ROOT=$(cd $(dirname "${BASH_SOURCE}")/.. && pwd) +declare -x PMODULES_CONFIG_DIR=$(basename $(cd $(dirname "${BASH_SOURCE}") && pwd)) +declare -x PMODULES_HOME="${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION}" +declare -x PMODULES_DIR="${PMODULES_HOME}" + +declare -x PMODULES_TEMPLATES_DIR='templates' +declare -x PMODULES_DISTFILESDIR="@PMODULES_DISTFILESDIR@" +declare -x PMODULES_TMPDIR="@PMODULES_TMPDIR@" + +############################################################################ +# some sanity checks +# +if [[ ! -d ${PMODULES_ROOT} ]]; then + echo "Oops: ${PMODULES_ROOT}: Set as Pmodules root, but this is not a directory." 1>&2 + return 1 +fi +if [[ ! -d ${PMODULES_HOME} ]]; then + echo "Oops: ${PMODULES_HOME}: Set as Pmodules home, but this is not a directory." 1>&2 + return 1 +fi + +############################################################################ +# inititialize Pmodules for bash +# +_init_bash="${PMODULES_HOME}/init/bash" +if [[ ! -r "${_init_bash}" ]]; then + echo "Oops: cannot initialize Modules!" + echo "${_init_bash}: File does not exist or is not readable." + return 1 +fi +source "${_init_bash}" +unset _init_bash + +# Local Variables: +# mode: sh +# sh-basic-offset: 8 +# tab-width: 8 +# End: diff --git a/Pmodules/profile.csh b/Pmodules/profile.csh.in similarity index 72% rename from Pmodules/profile.csh rename to Pmodules/profile.csh.in index 0aee6f5..a50d29e 100755 --- a/Pmodules/profile.csh +++ b/Pmodules/profile.csh.in @@ -1,16 +1,20 @@ #!/bin/tcsh -############################################################################# -# read Pmodules configuration -# -set _init_env_file="/opt/psi/config/environment.bash" -if ( ! -r "$_init_env_file" ); then - echo "Oops: cannot initialize Modules!" - echo "$_init_env_file: file does not exist or is not readable." - return 1 -fi -source "$_init_env_file" -unset _init_env_file +setenv PMODULES_ROOT "/opt/psi" + +if ( ! $?PMODULES_VERSION ) then + setenv PMODULES_VERSION "@PMODULES_VERSION@" +endif +setenv PMODULES_HOME "$PMODULES_ROOT/Tools/Pmodules/$PMODULES_VERSION" +setenv PMODULES_DIR "${PMODULES_HOME}" + +setenv PMODULES_CONFIG_DIR 'config' +setenv PMODULES_MODULEFILES_DIR 'modulefiles' +setenv PMODULES_TEMPLATES_DIR 'templates' + +setenv PMODULES_DEFAULT_GROUPS 'Tools Programming' +setenv PMODULES_DEFINED_RELEASES ':unstable:stable:deprecated:' +setenv PMODULES_DEFAULT_RELEASES 'stable' ############################################################################ # check configuration diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index 84915a0..0000000 --- a/bootstrap.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -declare -a opts=() - -while (( $# > 0 )); do - case $1 in - --debug ) - opts+=( "$1" ) - ;; - --config ) - opts+=( "$1=$2" ) - shift 1 - ;; - --config=* ) - opts+=( "$1" ) - ;; - --install-root ) - opts+=( "$1=$2" ) - shift 1 - ;; - --install-root=* ) - opts+=( "$1" ) - ;; - -f | --force ) - opts+=( "$1" ) - ;; - -* ) - std::die 1 "$1: illegal option" - ;; - * ) - std::die 1 "No arguments are allowed." - ;; - esac - shift 1 -done - -${BASE_DIR}/compile_pmodules.sh "${opts[@]}" || exit 1 -${BASE_DIR}/install_pmodules.sh "${opts[@]}" || exit 1 - diff --git a/build b/build new file mode 100755 index 0000000..c3721f7 --- /dev/null +++ b/build @@ -0,0 +1,300 @@ +#!/bin/bash + +declare BOOTSTRAP_DIR=$(dirname "$0") + +unset PMODULES_HOME +unset PMODULES_VERSION + +source "${BOOTSTRAP_DIR}/Pmodules/libstd.bash" + +declare -r BOOTSTRAP_DIR=$(std::get_abspath "${BOOTSTRAP_DIR}") +declare -r SRC_DIR="${BOOTSTRAP_DIR}/Pmodules" + +declare config_file="${BOOTSTRAP_DIR}/config/environment.bash" + +declare -a build_opts=() +build_opts+=( '--bootstrap' ) + +declare subcmd='' + +usage() { + echo "build [OPTIONS] SUB-COMMAND" + std:die 1 "" +} + +declare -rx DEFAULT_PMODULES_ROOT='/opt/psi' +declare -rx DEFAULT_PMODULES_DISTFILESDIR='/afs/psi.ch/software/Pmodules/distfiles' +declare -rx DEFAULT_CONFIG_FILE='config/environment.bash' + +#----------------------------------------------------------------------------- +# +pmodules::configure() { + local PMODULES_ROOT + local PMODULES_DISTFILESDIR + local config_file + + while (( $# > 0 )); do + case "$1" in + --config ) + config_file="$2" + shift 1 + ;; + --config=* ) + config_file="${1#*=}" + ;; + --install-root ) + PMODULES_ROOT="$2" + shift 1 + ;; + --install-root=* ) + PMODULES_ROOT="${1#*=}" + ;; + -* ) + std::die 1 "$1: illegal option" + ;; + * ) + std::die 1 "$1: illegal argument to sub-command 'configure'." + ;; + esac + shift 1 + done + + : ${PMODULES_ROOT:=${DEFAULT_PMODULES_ROOT}} + : ${PMODULES_DISTFILESDIR:=${DEFAULT_PMODULES_DISTFILESDIR}} + : ${config_file:=${DEFAULT_CONFIG_FILE}} + + echo "PMODULES_ROOT=$prefix" + echo "PMODULES_DISTFILESDIR=$distfiles" + + sed_cmd="s:@PMODULES_ROOT@:${prefix}:g;" + sed_cmd+="s:@PMODULES_DISTFILESDIR@:${distfiles}:g;" + + sed "${sed_cmd}" "config/environment.bash.in" > "${config_file}" +} + +#----------------------------------------------------------------------------- +# +pmodules::compile() { + build () { + local -r name="$1" + local -r version="$2" + shift 2 + + "${BOOTSTRAP_DIR}/Pmodules/modbuild" \ + "${BOOTSTRAP_DIR}/${name}/build" \ + "${build_opts[@]}" "$@" "${version}" || \ + std::die 3 "Compiling '${name}' failed!" + } + + local force='no' + local config_file="${BOOTSTRAP_DIR}/config/environment.bash" + + local opts='--bootstrap' + while (( $# > 0 )); do + case $1 in + --disable-cleanup ) + build_opts+=( "$1" ) + ;; + --debug ) + build_opts+=( "$1" ) + ;; + --config ) + config_file="$2" + shift 1 + ;; + --config=* ) + config_file="${1#*=}" + ;; + --install-root ) + PMODULES_ROOT="$2" + shift 1 + ;; + --install-root=* ) + PMODULES_ROOT="${1#*=}" + ;; + -f | --force ) + force='yes' + ;; + -* ) + std::die 1 "$1: illegal option" + ;; + * ) + std::die 1 "$1: illegal argument for sub-command 'compile'." + ;; + esac + shift 1 + done + + std::read_versions "${BOOTSTRAP_DIR}/config/versions.conf" + source "${config_file}" + + if [[ ! -f "${PMODULES_HOME}/sbin/base64" ]] || [[ ${force} == 'yes' ]]; then + build coreutils "${COREUTILS_VERSION}" + fi + + if [[ ! -f "${PMODULES_HOME}/sbin/xgettext" ]] || [[ ${force} == 'yes' ]]; then + build gettext "${GETTEXT_VERSION}" + fi + + if [[ ! -f "${PMODULES_HOME}/sbin/getopt" ]] || [[ ${force} == 'yes' ]]; then + build getopt "${GETOPT_VERSION}" + fi + + if [[ ! -f "${PMODULES_HOME}/sbin/bash" ]] || [[ ${force} == 'yes' ]]; then + build bash "4.3.30" + fi + + if [[ ! -e "${PMODULES_HOME}/sbin/tclsh" ]] || [[ ${force} == 'yes' ]]; then + build Tcl "${TCL_VERSION}" + fi + + if [[ ! -e "${PMODULES_HOME}/libexec/modulecmd.bin" ]] || [[ ${force} == 'yes' ]]; then + build Modules "${MODULES_VERSION}" --compile + fi + echo "Done..." +} + +#----------------------------------------------------------------------------- +# +pmodules::install() { + local opt_force='no' + + while (( $# > 0 )); do + case $1 in + --config ) + config_file="$2" + shift 1 + ;; + --config=* ) + config_file="${1#*=}" + ;; + --install-root ) + PMODULES_ROOT="$2" + shift 1 + ;; + --install-root=* ) + PMODULES_ROOT="${1#*=}" + ;; + -f | --force ) + opt_force='yes' + ;; + -* ) + std::die 1 "$1: illegal option" + ;; + * ) + std::die 1 "$1: illegal argument to sub-command 'install'." + ;; + esac + shift 1 + done + + std::read_versions "${BOOTSTRAP_DIR}/config/versions.conf" + source "${config_file}" + + if [[ ! -d "${PMODULES_ROOT}" ]]; then + read -p "The requested root directory does not exist. Create it? [y|N] " -n 1 ans + case ${ans} in + y | Y ) + mkdir -p "${PMODULES_ROOT}" + ;; + * ) + echo "Aborting ..." 1>&2 + exit 2 + ;; + esac + fi + + ### + # + # begin installation + # + echo "Installing to ${PMODULES_HOME} ..." + sed_cmd="s:@PMODULES_HOME@:${PMODULES_HOME}:g;" + sed_cmd+="s:@PMODULES_VERSION@:${PMODULES_VERSION}:g;" + sed_cmd+="s:@MODULES_VERSION@:${MODULES_VERSION}:g;" + sed_cmd+="s:@PMODULES_DISTFILESDIR@:${PMODULES_DISTFILESDIR}:g;" + sed_cmd+="s:@PMODULES_TMPDIR@:${PMODULES_TMPDIR}:g;" + + sed "${sed_cmd}" "${SRC_DIR}/modulecmd.bash.in" > "${SRC_DIR}/modulecmd.bash" + sed "${sed_cmd}" "${SRC_DIR}/modulecmd.tcl.in" > "${SRC_DIR}/modulecmd.tcl" + sed "${sed_cmd}" "${SRC_DIR}/modmanage.bash.in" > "${SRC_DIR}/modmanage.bash" + sed "${sed_cmd}" "${SRC_DIR}/profile.bash.in" > "${SRC_DIR}/profile.bash" + sed "${sed_cmd}" "${SRC_DIR}/profile.csh.in" > "${SRC_DIR}/profile.csh" + + install -d -m 0755 "${PMODULES_HOME}/bin" + install -d -m 0755 "${PMODULES_HOME}/config" + install -d -m 0755 "${PMODULES_HOME}/init" + install -d -m 0755 "${PMODULES_HOME}/lib" + install -d -m 0755 "${PMODULES_HOME}/libexec" + install -d -m 0755 "${PMODULES_HOME}/sbin" + + install -m 0755 "${SRC_DIR}/modulecmd" "${PMODULES_HOME}/bin" + install -m 0755 "${SRC_DIR}/modulecmd.bash" "${PMODULES_HOME}/libexec" + install -m 0755 "${SRC_DIR}/modulecmd.tcl" "${PMODULES_HOME}/libexec" + install -m 0755 "${SRC_DIR}/modmanage" "${PMODULES_HOME}/bin" + install -m 0755 "${SRC_DIR}/modmanage.bash" "${PMODULES_HOME}/libexec" + install -m 0755 "${SRC_DIR}/modbuild" "${PMODULES_HOME}/bin" + + install -m 0755 "${SRC_DIR}/profile.bash" "${PMODULES_HOME}/config/profile.bash.sample" + install -m 0755 "${SRC_DIR}/profile.csh" "${PMODULES_HOME}/config/profile.csh.sample" + + if [[ ! -e "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}" ]]; then + mkdir -p "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}" + fi + + if [[ ! -e "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/profile.bash" ]]; then + install -m 0755 "${SRC_DIR}/profile.bash" "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/profile.bash" + fi + + if [[ ! -e "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/modbuild.conf" ]]; then + install -m 0755 "${BOOTSTRAP_DIR}/config/modbuild.conf" "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/modbuild.conf" + fi + + mkdir -p "${PMODULES_ROOT}/Tools/modulefiles" + mkdir -p "${PMODULES_ROOT}/Libraries/modulefiles" + + install -m 0644 "${SRC_DIR}/bash" "${PMODULES_HOME}/init" + install -m 0644 "${SRC_DIR}/bash_completion" "${PMODULES_HOME}/init" + + install -m 0644 "${SRC_DIR}/libpmodules.bash" "${PMODULES_HOME}/lib" + install -m 0644 "${SRC_DIR}/libpbuild.bash" "${PMODULES_HOME}/lib" + install -m 0644 "${SRC_DIR}/libstd.bash" "${PMODULES_HOME}/lib" + install -m 0755 -d "${PMODULES_HOME}/lib/Pmodules" + install -m 0644 "${SRC_DIR}/libmodules.tcl" "${PMODULES_HOME}/lib/Pmodules" + + { + cd "${PMODULES_HOME}/lib/Pmodules" + "${BOOTSTRAP_DIR}/mkindex.tcl" + } +} + +#============================================================================= +# +declare -a subcmd_args=() + +while (( $# > 0 )); do + case "$1" in + --help | -h | -\? ) + usage + ;; + -* ) + std::die 1 "$1: illegal option" + ;; + configure | compile | install ) + subcmd="$1" + shift 1 + subcmd_args=( "$@" ) + shift $# + ;; + * ) + std::die 1 "$1: Unknown sub-command." + ;; + esac + shift 1 +done + +[[ -n "${subcmd}" ]] || std::die 1 "Missing sub-command." + + +pmodules::${subcmd} "${subcmd_args[@]}" + diff --git a/compile_pmodules.sh b/compile_pmodules.sh deleted file mode 100755 index b040b9c..0000000 --- a/compile_pmodules.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash - -declare -r BOOTSTRAP_DIR=$(dirname "$0") - -unset PMODULES_HOME -unset PMODULES_VERSION - -source "${BOOTSTRAP_DIR}/Pmodules/libstd.bash" - -declare force='no' -declare config_file="${BOOTSTRAP_DIR}/config/environment.bash" - -declare opts='--bootstrap' -while (( $# > 0 )); do - case $1 in - --disable-cleanup ) - opts+=" $1" - ;; - --debug ) - opts+=" $1" - ;; - --config ) - config_file="$2" - shift 1 - ;; - --config=* ) - config_file="${1#*=}" - ;; - --install-root ) - PMODULES_ROOT="$2" - shift 1 - ;; - --install-root=* ) - PMODULES_ROOT="${1#*=}" - ;; - -f | --force ) - force='yes' - ;; - -* ) - std::die 1 "$1: illegal option" - ;; - * ) - std::die 1 "No arguments are allowed." - ;; - esac - shift 1 -done - -std::read_versions "${BOOTSTRAP_DIR}/config/versions.conf" -source "${config_file}" - -PMODULES_VERSION='' -declare -x PMODULES_VERSION -echo $PMODULES_VERSION - -#if [[ -n ${PMODULES_DIR} ]] && [[ "${PMODULES_DIR}" != "/" ]] && [[ -d "${PMODULES_DIR}" ]]; then -# rm -rf "${PMODULES_DIR}" -#fi - -build () { - local -r name="$1" - local -r version="$2" - shift 2 - - "${BOOTSTRAP_DIR}/Pmodules/modbuild" "${BOOTSTRAP_DIR}/${name}/build" ${opts} "$@" "${version}" || \ - std::die 3 "Compiling '${name}' failed!" -} - -if [[ ! -f "${PMODULES_HOME}/sbin/base64" ]] || [[ ${force} == 'yes' ]]; then - build coreutils "${COREUTILS_VERSION}" -fi - -if [[ ! -f "${PMODULES_HOME}/sbin/xgettext" ]] || [[ ${force} == 'yes' ]]; then - build gettext "${GETTEXT_VERSION}" -fi - -if [[ ! -f "${PMODULES_HOME}/sbin/getopt" ]] || [[ ${force} == 'yes' ]]; then - build getopt "${GETOPT_VERSION}" -fi - -if [[ ! -f "${PMODULES_HOME}/sbin/bash" ]] || [[ ${force} == 'yes' ]]; then - build bash "4.3.30" -fi - -if [[ ! -e "${PMODULES_HOME}/sbin/tclsh" ]] || [[ ${force} == 'yes' ]]; then - build Tcl "${TCL_VERSION}" -fi - -if [[ ! -e "${PMODULES_HOME}/libexec/modulecmd.bin" ]] || [[ ${force} == 'yes' ]]; then - build Modules "${MODULES_VERSION}" --compile -fi -echo "Done..." diff --git a/config/versions.conf b/config/versions.conf index b315cc1..850f073 100644 --- a/config/versions.conf +++ b/config/versions.conf @@ -3,5 +3,5 @@ coreutils 8.23 getopt 1.1.6 gettext 0.19.4 Modules 3.2.10 -Pmodules 0.99.11 +Pmodules 0.99.12 Tcl 8.6.6 diff --git a/configure b/configure deleted file mode 100755 index 3dfbfb6..0000000 --- a/configure +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -declare prefix='/opt/psi' -declare distfiles='/afs/psi.ch/software/Pmodules/distfiles' - -print_usage() { - echo "${0##*/} [OPTS] - -OPTS ---prefix=PREFIX - Installation prefix - ---distfiles=DISTFILES - Directory with sources -" 1>&2 - exit 1 -} - -while (( $# > 0 )); do - case $1 in - --prefix=* ) - prefix=${1#*=} - ;; - --distfiles=* ) - distfiles=${1#*=} - ;; - --help | -h | -\? ) - print_usage - exit 1 - ;; - -* ) - echo "$1: invalid option." 1>&2 - exit 1 - ;; - * ) - echo "$1: invalid argument." 1>&2 - exit 1 - ;; - esac - shift -done - -echo "PMODULES_ROOT=$prefix" -echo "PMODULES_DISTFILESDIR=$distfiles" - -sed_cmd="s:@PMODULES_ROOT@:${prefix}:g;" -sed_cmd+="s:@PMODULES_DISTFILESDIR@:${distfiles}:g;" - -sed "${sed_cmd}" "config/environment.bash.in" > "config/environment.bash" - diff --git a/install_pmodules.sh b/install_pmodules.sh deleted file mode 100755 index 3ce2ea1..0000000 --- a/install_pmodules.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash -declare BOOTSTRAP_DIR=$(dirname "$0") - -unset PMODULES_HOME -unset PMODULES_VERSION - -source "${BOOTSTRAP_DIR}/Pmodules/libstd.bash" - -declare -r BOOTSTRAP_DIR=$(std::get_abspath "${BOOTSTRAP_DIR}") -declare -r SRC_DIR="${BOOTSTRAP_DIR}/Pmodules" - -declare config_file="${BOOTSTRAP_DIR}/config/environment.bash" - -declare opt_force='no' - -while (( $# > 0 )); do - case $1 in - --config ) - config_file="$2" - shift 1 - ;; - --config=* ) - config_file="${1#*=}" - ;; - --install-root ) - PMODULES_ROOT="$2" - shift 1 - ;; - --install-root=* ) - PMODULES_ROOT="${1#*=}" - ;; - -f | --force ) - opt_force='yes' - ;; - -* ) - echo "Unknown option: $1" 1>&2 - exit 1 - ;; - * ) - echo "Invalid argument: $1" 1>&2 - exit 1 - ;; - esac - shift 1 -done - -std::read_versions "${BOOTSTRAP_DIR}/config/versions.conf" -source "${config_file}" - -if [[ ! -d "${PMODULES_ROOT}" ]]; then - read -p "The requested root directory does not exist. Create it? [y|N] " -n 1 ans - case ${ans} in - y | Y ) - mkdir -p "${PMODULES_ROOT}" - ;; - * ) - echo "Aborting ..." 1>&2 - exit 2 - ;; - esac -fi - -### -# -# begin installation -# -echo "Installing to ${PMODULES_HOME} ..." -sed_cmd="s:@PMODULES_HOME@:${PMODULES_HOME}:g;" -sed_cmd+="s:@PMODULES_VERSION@:${PMODULES_VERSION}:g;" -sed_cmd+="s:@MODULES_VERSION@:${MODULES_VERSION}:g;" -sed_cmd+="s:@PMODULES_DISTFILESDIR@:${PMODULES_DISTFILESDIR}:g;" -sed_cmd+="s:@PMODULES_TMPDIR@:${PMODULES_TMPDIR}:g;" - -sed "${sed_cmd}" "${SRC_DIR}/modulecmd.bash.in" > "${SRC_DIR}/modulecmd.bash" -sed "${sed_cmd}" "${SRC_DIR}/modulecmd.tcl.in" > "${SRC_DIR}/modulecmd.tcl" -sed "${sed_cmd}" "${SRC_DIR}/modmanage.bash.in" > "${SRC_DIR}/modmanage.bash" -sed "${sed_cmd}" "${SRC_DIR}/environment.bash.in" > "${SRC_DIR}/environment.bash" - -install -d -m 0755 "${PMODULES_HOME}/bin" -install -d -m 0755 "${PMODULES_HOME}/config" -install -d -m 0755 "${PMODULES_HOME}/init" -install -d -m 0755 "${PMODULES_HOME}/lib" -install -d -m 0755 "${PMODULES_HOME}/libexec" -install -d -m 0755 "${PMODULES_HOME}/sbin" - -install -m 0755 "${SRC_DIR}/modulecmd" "${PMODULES_HOME}/bin" -install -m 0755 "${SRC_DIR}/modulecmd.bash" "${PMODULES_HOME}/libexec" -install -m 0755 "${SRC_DIR}/modulecmd.tcl" "${PMODULES_HOME}/libexec" -install -m 0755 "${SRC_DIR}/modmanage" "${PMODULES_HOME}/bin" -install -m 0755 "${SRC_DIR}/modmanage.bash" "${PMODULES_HOME}/libexec" -install -m 0755 "${SRC_DIR}/modbuild" "${PMODULES_HOME}/bin" - -install -m 0755 "${SRC_DIR}/environment.bash" "${PMODULES_HOME}/config/environment.bash.sample" -install -m 0755 "${SRC_DIR}/profile.bash" "${PMODULES_HOME}/config/profile.bash.sample" - -if [[ ! -e "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}" ]]; then - mkdir -p "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}" -fi - -if [[ ! -e "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/environment.bash" ]]; then - install -m 0755 "${SRC_DIR}/environment.bash" "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/environment.bash" -fi - -if [[ ! -e "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/profile.bash" ]]; then - install -m 0755 "${SRC_DIR}/profile.bash" "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/profile.bash" -fi - -if [[ ! -e "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/modbuild.conf" ]]; then - install -m 0755 "${BOOTSTRAP_DIR}/config/modbuild.conf" "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/modbuild.conf" -fi - -mkdir -p "${PMODULES_ROOT}/Tools/modulefiles" -mkdir -p "${PMODULES_ROOT}/Libraries/modulefiles" - -install -m 0644 "${SRC_DIR}/bash" "${PMODULES_HOME}/init" -install -m 0644 "${SRC_DIR}/bash_completion" "${PMODULES_HOME}/init" - -install -m 0644 "${SRC_DIR}/libpmodules.bash" "${PMODULES_HOME}/lib" -install -m 0644 "${SRC_DIR}/libpbuild.bash" "${PMODULES_HOME}/lib" -install -m 0644 "${SRC_DIR}/libstd.bash" "${PMODULES_HOME}/lib" -install -m 0755 -d "${PMODULES_HOME}/lib/Pmodules" -install -m 0644 "${SRC_DIR}/libmodules.tcl" "${PMODULES_HOME}/lib/Pmodules" - -{ - cd "${PMODULES_HOME}/lib/Pmodules" - "${BOOTSTRAP_DIR}/mkindex.tcl" -}