Commit 14f03567 authored by stadler_h's avatar stadler_h
Browse files

Merge branch 'master' of gitorious.psi.ch:pmodules/src

Conflicts:
	scripts/Bootstrap/Pmodules/libpmodules.bash
parents a519acda 6e7025ca
......@@ -52,12 +52,13 @@ module() {
if [[ ${subcommand} == '' ]]; then
subcommand='help'
fi
if (( ${#args} == 0 )); then
args+=( '' )
if (( ${#args[@]} == 0 )); then
eval $( "${modulecmd}" bash ${switches[@]} "${subcommand}" "${sub_switches[@]}" )
else
for arg in "${args[@]}"; do
eval $( "${modulecmd}" bash ${switches[@]} "${subcommand}" "${sub_switches[@]}" "${arg}" )
done
fi
for arg in "${args[@]}"; do
eval $( "${modulecmd}" bash ${switches[@]} "${subcommand}" "${sub_switches[@]}" "${arg}" )
done
}
export -f module
......
#!/bin/bash
if [[ -z ${bindir} ]]; then
local bindir=$(dirname "${BASH_SOURCE}")
bindir=$(cd "${bindir}"/.. && pwd)"/bin"
fi
log() {
local -ri fd=$1
local -r fmt="$2\n"
......@@ -8,11 +13,11 @@ log() {
}
info() {
log 2 "$1\n" "${@:2}"
log 2 "$1" "${@:2}"
}
error() {
log 2 "$1\n" "${@:2}"
log 2 "$1" "${@:2}"
}
debug() {
......@@ -32,7 +37,7 @@ die() {
if [[ -n $@ ]]; then
local -r fmt=$1
shift
log $cout "$fmt" "$@"
log 2 "$fmt" "$@"
fi
exit $ec
}
......@@ -54,6 +59,20 @@ get_YN_answer() {
esac
}
#
# return normalized abolute pathname
# $1: filename
get_abspath() {
local -r fname=$1
[[ -r "${fname}" ]] || return 1
if [[ -d ${fname} ]]; then
echo $(cd "${fname}" && pwd)
else
local -r dname=$(dirname "${fname}")
echo $(cd "${dname}" && pwd)/$(basename "${fname}")
fi
}
get_options() {
"${bindir}/getopt" "$@"
}
......@@ -84,6 +103,45 @@ check_pmodules_env() {
check_pmodules_directories "${PSI_PREFIX}"
}
append_path () {
local -r P=$1
local -r d=$2
if ! echo ${!P} | egrep -q "(^|:)${d}($|:)" ; then
if [[ -z ${!P} ]]; then
eval $P=${d}
else
eval $P=${!P}:${d}
fi
fi
}
prepend_path () {
local -r P=$1
local -r d=$2
if ! echo ${!P} | egrep -q "(^|:)${d}($|:)" ; then
if [[ -z ${!P} ]]; then
eval $P=${d}
else
eval $P=${d}:${!P}
fi
fi
}
remove_path() {
local -r P=$1
local -r d=$2
local new_path=''
local -r _P=( ${!P//:/ } )
# loop over all entries in path
for entry in "${_P[@]}"; do
[[ "${entry}" != "${d}" ]] && new_path+=":${entry}"
done
# remove leading ':'
eval ${P}="${new_path:1}"
}
# Local Variables:
# mode: sh
......
This diff is collapsed.
declare -x PMODULES_VERSION=0.99.1
declare -x PMODULES_VERSION=0.99.2
declare -x MODULES_VERSION=3.2.10
declare -a COMPILER_VERSIONS=( 'gcc/4.7.4' 'gcc/4.8.3' 'gcc/4.8.4' 'gcc/4.9.2' )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment