forked from Bright-Computing/bic
-
Notifications
You must be signed in to change notification settings - Fork 1
/
z00_lmod.sh
75 lines (65 loc) · 2.22 KB
/
z00_lmod.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# -*- shell-script -*-
########################################################################
# This is the system wide source file for setting up
# modules:
#
########################################################################
# Skip Lmod initialization if USER_IS_ROOT or LMOD_DISABLE is set
([ -n "$USER_IS_ROOT" ] || [ -n "$LMOD_DISABLE" ]) && return
if [ -z "${MODULEPATH_ROOT:-}" ]; then
export USER=${USER-${LOGNAME}} # make sure $USER is set
export LMOD_sys=`uname`
LMOD_arch=`uname -m`
if [ "x$LMOD_sys" = xAIX ]; then
LMOD_arch=rs6k
fi
export LMOD_arch
export MODULEPATH_ROOT="/usr/share/modulefiles"
export LMOD_SETTARG_CMD=":"
export LMOD_COLORIZE=yes
export LMOD_PREPEND_BLOCK=normal
# export MODULEPATH=$(/usr/share/lmod/lmod/libexec/addto --append MODULEPATH $MODULEPATH_ROOT/$LMOD_sys $MODULEPATH_ROOT/Core)
# export MODULEPATH=$(/usr/share/lmod/lmod/libexec/addto --append MODULEPATH /usr/share/lmod/lmod/modulefiles/Core)
export MODULESHOME=/usr/share/lmod/lmod
export BASH_ENV=$MODULESHOME/init/bash
#
# If MANPATH is empty, Lmod is adding a trailing ":" so that
# the system MANPATH will be found
if [ -z "${MANPATH:-}" ]; then
export MANPATH=:
fi
export MANPATH=$(/usr/share/lmod/lmod/libexec/addto MANPATH /usr/share/lmod/lmod/share/man)
fi
PS_CMD=/usr/bin/ps
if [ ! -x $PS_CMD ]; then
if [ -x /bin/ps ]; then
PS_CMD=/bin/ps
elif [ -x /usr/bin/ps ]; then
PS_CMD=/usr/bin/ps
fi
fi
EXPR_CMD=/usr/bin/expr
if [ ! -x $EXPR_CMD ]; then
if [ -x /usr/bin/expr ]; then
EXPR_CMD=/usr/bin/expr
elif [ -x /bin/expr ]; then
EXPR_CMD=/bin/expr
fi
fi
BASENAME_CMD=/usr/bin/basename
if [ ! -x $BASENAME_CMD ]; then
if [ -x /bin/basename ]; then
BASENAME_CMD=/bin/basename
elif [ -x /usr/bin/basename ]; then
BASENAME_CMD=/usr/bin/basename
fi
fi
my_shell=$($PS_CMD -p $$ -ocomm=)
my_shell=$($EXPR_CMD "$my_shell" : '-*\(.*\)')
my_shell=$($BASENAME_CMD $my_shell)
if [ -f /usr/share/lmod/lmod/init/$my_shell ]; then
. /usr/share/lmod/lmod/init/$my_shell >/dev/null # Module Support
else
. /usr/share/lmod/lmod/init/sh >/dev/null # Module Support
fi
unset my_shell PS_CMD EXPR_CMD BASENAME_CMD