mirror of
https://github.com/envmodules/modules.git
synced 2026-05-30 00:12:31 +08:00
Introduce an 'install' target in makefiles to provide an installation process for modules-tcl. Defines installation paths with Makefile variables in order to avoid having a ./configure step. Install paths are set during the 'make' step by passing 'prefix', 'libexecdir', 'mandir', etc arguments to the make command. If no path definitions are passed to the 'make' command, installation will be made in '/usr/local/modules-tcl' by default. Installation paths provided (or set from the default value found in Makefile) are saved at the 'make' step in a .makeinstallpath file. Then at the 'make install' step, this .makeinstallpath file is read and make knows where to install modules-tcl. These paths definitions are also used to translate *.in init script to their installed version. modulecmd.tcl script is by default set to be installed in the libexec directory to follow FHS specification (as this script is an executable but not directly accessed by users).
44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
Plaintext
# only redirect module from stderr to stdout in interactive mode
|
|
# to avoid breaking non interactive session (scp, sftp, etc)
|
|
if [[ $- =~ i ]]; then
|
|
moduleraw() { eval `@TCLSH@ @libexecdir@/modulecmd.tcl bash $*`; }
|
|
module() { moduleraw $* 2>&1 ; }
|
|
# export functions to get them defined in sub-shells
|
|
export -f moduleraw
|
|
export -f module
|
|
else
|
|
module() { eval `@TCLSH@ @libexecdir@/modulecmd.tcl bash $*`; }
|
|
export -f module
|
|
fi
|
|
|
|
# setup ENV variables to get module defined in sub-shells (works for 'sh'
|
|
# and 'ksh' in interactive mode and 'sh' (zsh-compat), 'bash' and 'ksh'
|
|
# (zsh-compat) in non-interactive mode.
|
|
ENV=@initdir@/profile.sh; export ENV
|
|
BASH_ENV=@initdir@/bash; export BASH_ENV
|
|
|
|
# enable completion only in interactive mode
|
|
if [ ${BASH_VERSINFO:-0} -ge 3 ] && [[ $- =~ i ]] &&
|
|
[ -r @initdir@/bash_completion ]; then
|
|
source @initdir@/bash_completion
|
|
fi
|
|
|
|
MODULESHOME=@prefix@; export MODULESHOME
|
|
|
|
if [ "${MODULEPATH:-}" = '' ]; then
|
|
if [ -r @initdir@/.modulespath ]; then
|
|
MODULEPATH=`sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' \
|
|
@initdir@/.modulespath`; export MODULEPATH
|
|
else
|
|
MODULEPATH=; export MODULEPATH
|
|
fi
|
|
fi
|
|
|
|
if [ "${LOADEDMODULES:-}" = '' ]; then
|
|
LOADEDMODULES=; export LOADEDMODULES
|
|
fi
|
|
|
|
if [ -r @initdir@/modulerc ]; then
|
|
source @initdir@/modulerc
|
|
fi
|