sit/sit

313 lines
8.2 KiB
Text
Raw Normal View History

2016-05-03 06:52:23 +00:00
#!/bin/bash
#
# Install script inspired by the ebuild system of Gentoo Linux
#
# Copyright (c) 2011-2022 Christoph Niethammer <niethammer@hlrs.de>
#
set -e
2022-08-04 09:06:44 +00:00
#set -x
#source colors.sh
#echo -e "${RED}DEBUGME: $MPI_VERSION${ENDCOLOR}"
function show_help() {
echo "Usage: $0 [options] [action] <sit package name>"
echo "Options:"
echo " -h,--help"
echo " -v,--verbose"
echo " --debug"
echo
echo "Valid actions:"
echo " sitinfo"
echo " unpack"
echo " prepare"
echo " configure"
echo " build"
echo " pretest"
echo " install"
echo " posttest"
echo " postinst"
echo " copy_logs"
echo " setperms"
echo " all"
}
2016-05-18 14:02:54 +00:00
declare -i verbose=0
declare -i debug=0
sit_classfile="" # sit class file to be installed
sit_action="all" # sit action to be performed
while [ "$1" != "" ] ; do
case $1 in
-h|-\?|--help)
show_help
exit
;;
--debug)
echo "Debug mode enabled"
set -x
debug=1
;;
-v|--verbose)
verbose=$((verbose + 1))
;;
sitinfo| \
all| \
unpack| \
prepare| \
configure| \
build| \
pretest| \
install| \
posttest| \
postinst| \
copy_logs| \
setperms)
sit_action=$1
;;
*)
sit_classfile=$1
;;
esac
shift
done
SIT_PATH=$(cd $(dirname $PWD/$0); pwd)
SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf
SIT_USER_CONFIG_FILE=$HOME/.sit
source "$SIT_PATH/functions.sh"
# Reading in user configuration file if it exists
if [[ -e $SIT_USER_CONFIG_FILE ]] ; then
source $SIT_USER_CONFIG_FILE
fi
# Reading in global configuration file
if [[ -e $SIT_CONFIG_FILE ]] ; then
source $SIT_CONFIG_FILE
fi
# identify platform manually if no environment variable was set
PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME}
2011-11-30 21:55:01 +00:00
if [ -z $PLATFORM ]; then
2016-05-03 06:52:22 +00:00
sit_warn "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration"
PLATFORM="${DEFAULT_PLATFORM}"
fi
sit_info "Platform: $PLATFORM"
sit_info "Action(s) to perform: $sit_action"
sit_info "Sit class file(s): $sit_classfile"
# compiler to use
# (gnu|intel|pgi)
COMPILER=${COMPILER:=${DEFAULT_COMPILER}}
2016-05-18 14:02:54 +00:00
sit_info_verbose "Compiler: $COMPILER"
# use specific compiler version
COMPILER_VERSION=${COMPILER_VERSION:=}
2016-05-18 14:02:54 +00:00
sit_info_verbose "Compiler version: $COMPILER_VERSION"
# Compiler specifications
COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}"
if [ -e $COMPILER_CONFIG_FILE ] ; then
source $COMPILER_CONFIG_FILE
else
sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'."
fi
sit_info_verbose "COMPILER: $COMPILER"
sit_info_verbose "COMPILER version: $COMPILER_VERSION"
sit_info_verbose "MPI: $MPI"
sit_info_verbose "MPI version: $MPI_VERSION"
case $PLATFORM in
hawk|vulcan)
COMPILER_MODULE=${COMPILER}${COMPILER_VERSION:+"/${COMPILER_VERSION}"}
MPI_MODULE=${MPI}${MPI_VERSION:+"/${MPI_VERSION}"}
MPI_VERSION_NUM=${MPI_VERSION%%-*}
sit_info_verbose "MPI version num: $MPI_VERSION_NUM"
;;
system)
echo "Using system default compiler and MPI"
COMPILER="" # prevent any compiler specs in the prefix
MPI=""
;;
*)
sit_fail "Unknown or unsupported system"
;;
esac
echo "Loading modules: ${COMPILER_MODULE} ${MPI_MODULE}"
module load "${COMPILER_MODULE}" "${MPI_MODULE}"
if [ ! -z "${COMPILER}" ] ; then
2011-11-30 21:55:01 +00:00
# reevaluate compiler version
COMPILER_VERSION_FULL=$(eval "$COMPILER_VERSION_CMD")
fi
# make the compiler variables CC, CXX, FC and F77 available
2016-05-03 06:52:24 +00:00
if [ ! -z "$COMPILER_OPTS" ] ; then
2011-11-30 21:55:01 +00:00
echo "Compiler env: ${COMPILER_OPTS}"
export ${COMPILER_OPTS}
fi
if [ ! -z $COMPILER ] ; then
echo "Using compiler: $COMPILER version: $COMPILER_VERSION_FULL"
fi
2019-01-30 15:34:17 +00:00
2016-05-03 06:52:24 +00:00
if [ ! -z "$MPI" ] ; then
case $COMPILER in
intel)
2013-06-19 09:38:34 +00:00
if [[ $MPI == "impi" ]] ; then
MPICC="mpiicc"
MPICXX="mpiicpc"
MPIFC="mpiifort"
else
MPICC="mpicc"
MPICXX="mpicxx"
MPIFC="mpif90"
fi
;;
*)
MPICC="mpicc"
MPICXX="mpicxx"
MPIFC="mpif90"
;;
esac
2016-05-18 14:05:00 +00:00
sit_info "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC"
MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))}
fi
if [ -f $SCLASS_DIR/$sit_classfile ] ; then
source $SCLASS_DIR/$sit_classfile
else
sit_fail "Could not find file $SCLASS_DIR/$sit_classfile"
fi
PACKAGENAME=${PACKAGENAME:=$PACKAGE}
# construct the final installation directory path
if [ -z $PREFIX ] ; then
2016-05-02 08:55:20 +00:00
PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}"
PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"}
PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"}
PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR}
PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"}
fi
# final working directory path
WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX
# path to the source code directory
SRCDIR=${WORKDIR}/${P}
# build directory (should be different from source directory):
BUILDDIR=${WORKDIR}/build
# logfile directory
LOGDIR=${WORKDIR}
2011-03-04 15:53:49 +00:00
2016-05-03 06:52:24 +00:00
# source the package class file a second time, so we can modify variables
# using their default values. (Defaults depend on other vairables in
2011-03-04 15:53:49 +00:00
# the class file like CATEGORY or PACKAGE)
source $SCLASS_DIR/$sit_classfile
2011-03-04 15:53:49 +00:00
2016-05-18 14:05:00 +00:00
sit_info "Package name: $PACKAGENAME"
sit_info "Installation PREFIX: $PREFIX"
sit_info "Working dir: $WORKDIR"
sit_info "Source dir: $SRCDIR"
sit_info "Build dir: $BUILDDIR"
sit_info "Logfile dir: $LOGDIR"
sit_countdown 3
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
# if working dir already exists and execution option is Default then remove
# previous working directory and create new
if [[ -d ${WORKDIR} && $sit_action == "all" ]] ; then
sit_info "Removing existing working directory ${WORKDIR}"
sit_countdown 5
rm -rf ${WORKDIR}
fi
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
if [ ! -d ${WORKDIR} ] ; then
2016-05-02 08:55:20 +00:00
mkdir -p ${WORKDIR}
mkdir -p ${BUILDDIR}
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
fi
if [ ! -z ${LOGDIR} ] ; then
mkdir -p ${LOGDIR}
else
# TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR!
LOGDIR="/tmp"
fi
2011-03-04 15:53:49 +00:00
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
case $sit_action in
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
"sitinfo")
sit_sitinfo >> "$LOGDIR/sit_cmd.log"
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"unpack")
sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} )
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"prepare")
sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} )
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"configure")
sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} )
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"build")
sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} )
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"pretest")
sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} )
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"install")
sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} )
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"posttest")
sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} )
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"postinst")
sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} )
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"copy_logs")
sit_copy_logs
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"setperms")
sit_setperms
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
"all")
sit_sitinfo >> "$LOGDIR/sit_cmd.log"
sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} )
sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} )
sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} )
sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} )
sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} )
sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} )
sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} )
sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} )
sit_copy_logs
sit_setperms
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
;;
*)
echo "Unknown action $sit_action"
usage
#!/bin/bash -l # # Install script inspired by the ebuild system of Gentoo Linux # # Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013 # # exit on any error! set -e # for debugging: # set -x # Reading in execution option SIT_RUN_OPTION=$2 if [[ -n $SIT_RUN_OPTION ]] ; then echo "Executing with option: $SIT_RUN_OPTION" else echo "Default execution" fi SIT_PATH=$(dirname $PWD/$0) SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_USER_CONFIG_FILE=$HOME/.sit # Reading in user configuration file if it exists if [[ -e $SIT_USER_CONFIG_FILE ]] ; then source $SIT_USER_CONFIG_FILE fi # Reading in global configuration file if [[ -e $SIT_CONFIG_FILE ]] ; then source $SIT_CONFIG_FILE fi source "$SIT_PATH/functions.sh" sit_countdown 1 # identify platform manually if no environment variable was set PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME} if [ -z $PLATFORM ]; then sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration" PLATFORM="${DEFAULT_PLATFORM}" fi sit_info "Platform: $PLATFORM" # compiler to use # (gnu|intel|pgi) COMPILER=${COMPILER:=${DEFAULT_COMPILER}} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} # add a descriptor at the end of the installation path e.g. for special config options etc. PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} # Compiler specifications COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}" if [ -e $COMPILER_CONFIG_FILE ] ; then source $COMPILER_CONFIG_FILE else sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'." fi if [ "$COMPILER" == "system" ] ; then echo "Using system default compiler" COMPILER="" # prevent any compiler specs in the prefix else case $PLATFORM in hermit|hermit1) module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER} if [ ! -z "$COMPILER_VERSION" ] ; then if [ "${COMPILER}" == "gnu" ] ; then module swap gcc gcc/$COMPILER_VERSION else module swap $COMPILER $COMPILER/$COMPILER_VERSION fi fi ;; laki|*) if [ -z "$COMPILER_VERSION" ] ; then COMPILER_MODULE=compiler/${COMPILER} else COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} fi echo "Loading compiler module ${COMPILER_MODULE}" module load ${COMPILER_MODULE} ;; esac fi if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD") fi # make the compiler variables CC, CXX, FC and F77 available if [ ! -z "$COMPILER_OPTS" ] ; then echo "Compiler env: ${COMPILER_OPTS}" export ${COMPILER_OPTS} fi if [ ! -z $COMPILER ] ; then echo "Using compiler: $COMPILER version: $COMPILER_VERSION" fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI" if [ ! -z "$MPI_VERSION" ] ; then MPI_VERSION_NUM=${MPI_VERSION%%-*} case $MPI in impi) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} ;; *) MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} ;; esac fi echo "Loading MPI module ${MPI_MODULE}" module load $MPI_MODULE case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then MPICC="mpiicc" MPICXX="mpiicpc" MPIFC="mpiifort" else MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" fi ;; gnu|*) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90" ;; esac echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC" MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))} fi SCLASSFILE=$1 ACTION=$2 if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then source $SCLASS_DIR/$SCLASSFILE else sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE" fi PACKAGENAME=${PACKAGENAME:=$PACKAGE} # construct the final installation directory path if [ -z $PREFIX ] ; then PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}" PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"} PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"} PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR} PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"} fi # final working directory path WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX # path to the source code directory SRCDIR=${WORKDIR}/${P} # build directory (should be different from source directory): BUILDDIR=${WORKDIR}/build # logfile directory LOGDIR=${WORKDIR} # source the package class file a second time, so we can modify variables # using their default values. (Defaults depend on other vairables in # the class file like CATEGORY or PACKAGE) source $SCLASS_DIR/$SCLASSFILE echo "Package name: $PACKAGENAME" echo "Installation PREFIX: $PREFIX" echo "Working dir: $WORKDIR" echo "Source dir: $SRCDIR" echo "Build dir: $BUILDDIR" echo "Logfile dir: $LOGDIR" sit_countdown 3 # if working dir already exists and execution option is Default then remove # previous working directory and create new if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then sit_info "Removing existing working directory ${WORKDIR}" sit_countdown 5 rm -rf ${WORKDIR} fi if [ ! -d ${WORKDIR} ] ; then mkdir -p ${WORKDIR} mkdir -p ${BUILDDIR} fi if [ ! -z ${LOGDIR} ] ; then mkdir -p ${LOGDIR} else # TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR! LOGDIR="/tmp" fi case $SIT_RUN_OPTION in "sitinfo") sit_sitinfo >> "$LOGDIR/sit_cmd.log" ;; "unpack") sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) ;; "prepare") sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) ;; "configure") sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) ;; "build") sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) ;; "pretest") sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) ;; "install") sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) ;; "posttest") sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) ;; "postinst") sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) ;; "copy_logs") sit_copy_logs ;; "setperms") sit_setperms ;; "") sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) sit_copy_logs sit_setperms ;; *) echo "Argument $SIT_RUN_OPTION unrecognized." esac #sit_sitinfo >> "$LOGDIR/sit_cmd.log" #sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) #sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} ) #sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} ) #sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} ) #sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} ) #sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} ) #sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} ) #sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} ) #sit_copy_logs #sit_setperms cat <<EOF ############################################################################## # IMPORTANT! ############################################################################## # Do not forget to provide a module file! ############################################################################## EOF exit 0
2014-06-16 22:13:33 +00:00
esac
cat <<EOF
##############################################################################
# IMPORTANT!
##############################################################################
# Do not forget to provide a module file!
##############################################################################
EOF
exit 0