Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcawood committed Nov 8, 2024
1 parent a1d7772 commit a814b72
Show file tree
Hide file tree
Showing 1,639 changed files with 76,810 additions and 856 deletions.
1 change: 0 additions & 1 deletion init/ksh.in

This file was deleted.

205 changes: 205 additions & 0 deletions init/ksh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
#!/bin/bash
# -*- shell-script -*-
#
########################################################################
# Start Lmod BASHENV
########################################################################

if [ -z "${LMOD_SH_DBG_ON+x}" ]; then
case "$-" in
*v*x*) __lmod_vx='vx' ;;
*v*) __lmod_vx='v' ;;
*x*) __lmod_vx='x' ;;
esac;
fi

[ -n "${__lmod_vx:-}" ] && set +$__lmod_vx

if [ -n "${__lmod_vx:-}" ]; then
echo "Shell debugging temporarily silenced: export LMOD_SH_DBG_ON=1 for this output (@PKGV@/init/@my_shell@)" 1>&2
fi

#
# Prepend the FPATH variable for ksh functions when ssh is being used,
# except for zsh as it breaks things there.


if [ -n "${ZSH_VERSION+x}" -a -z "${__LMOD_SET_ZSH_FPATH+x}" ]; then
export __LMOD_SET_ZSH_FPATH=1
zv=${ZSH_VERSION}
orig_zsh_version=@orig_zsh_version@
zsh_fpath=@zsh_fpath@
zsh_fpath=$(echo $zsh_fpath | sed -e "s|/$orig_zsh_version/|/$zv/|g" )
export FPATH=$(@PKGV@/libexec/addto --append FPATH $zsh_fpath @PKGV@/init/ksh_funcs)
unset zv
unset orig_zsh_version
unset zsh_fpath
fi

if [ -n "${KSH_VERSION+x}" -o -n "${BASH_VERSION+x}" ]; then
if [ -z "${__LMOD_SET_KSH_FPATH:-}" ]; then
export __LMOD_SET_KSH_FPATH=1
export FPATH=$(@PKGV@/libexec/addto --append FPATH $FPATH @PKGV@/init/ksh_funcs)
fi
fi

export LMOD_ROOT=@lmod_root@
export LMOD_PKG=@PKGV@
export LMOD_DIR=$LMOD_PKG/libexec
export LMOD_CMD=$LMOD_PKG/libexec/lmod
export MODULESHOME=$LMOD_PKG
export LMOD_SETTARG_FULL_SUPPORT=@lmod_settarg_full_support@

########################################################################
# Define the module command: The first line runs the "lmod" command
# to generate text:
# export PATH="..."
# then the "eval" converts the text into changes in the current shell.
#
# The second command is the settarg command. Normally LMOD_SETTARG_CMD
# is undefined or is ":". Either way the eval does nothing. When the
# settarg module is loaded, it defines LMOD_SETTARG_CMD. The settarg
# command knows how to read the ModuleTable that Lmod maintains and
# generates a series of env. vars that describe the current state of
# loaded modules. So if one is on a x86_64 linux computer with gcc/4.7.2
# and openmpi/1.6.3 loaded, then settarg will assign:
#
# TARG=_x86_64_gcc-4.7.2_openmpi-1.6.3
# TARG_COMPILER=gcc-4.7.2
# TARG_COMPILER_FAMILY=gcc
# TARG_MACH=x86_64
# TARG_MPI=openmpi-1.6.3
# TARG_MPI_FAMILY=openmpi
# TARG_SUMMARY=x86_64_gcc-4.7.2_openmpi-1.6.3
# TARG_TITLE_BAR=gcc-4.7.2 O-1.6.3
# TARG_TITLE_BAR_PAREN=(gcc-4.7.2 O-1.6.3)
#
# unloading openmpi/1.6.3 automatically changes these vars to be:
#
# TARG=_x86_64_gcc-4.6.3
# TARG_COMPILER=gcc-4.6.3
# TARG_COMPILER_FAMILY=gcc
# TARG_MACH=x86_64
# TARG_SUMMARY=x86_64_gcc-4.6.3
# TARG_TITLE_BAR=gcc-4.6.3
# TARG_TITLE_BAR_PAREN=(gcc-4.6.3)
#
# See Lmod web site for more details.


if [ "@silence_shell_debugging@" = "no" ]; then
module()
{
############################################################
# Run Lmod and eval results
eval "$($LMOD_CMD @my_shell@ "$@")" && eval $(${LMOD_SETTARG_CMD:-:} -s sh)
}
else
module()
{
############################################################
# Silence shell debug UNLESS $LMOD_SH_DBG_ON has a value
if [ -z "${LMOD_SH_DBG_ON+x}" ]; then
case "$-" in
*v*x*) __lmod_sh_dbg='vx' ;;
*v*) __lmod_sh_dbg='v' ;;
*x*) __lmod_sh_dbg='x' ;;
esac;
fi

if [ -n "${__lmod_sh_dbg:-}" ]; then
set +$__lmod_sh_dbg
echo "Shell debugging temporarily silenced: export LMOD_SH_DBG_ON=1 for Lmod's output" 1>&2
fi

############################################################
# Run Lmod and eval results
eval "$($LMOD_CMD shell "$@")" && eval "$(${LMOD_SETTARG_CMD:-:} -s sh)"
__lmod_my_status=$?

############################################################
# Un-silence shell debug after module command
if [ -n "${__lmod_sh_dbg:-}" ]; then
echo "Shell debugging restarted" 1>&2
set -$__lmod_sh_dbg;
fi;
unset __lmod_sh_dbg
return $__lmod_my_status
}
fi


LMOD_VERSION="@lmod_version@"
export LMOD_VERSION

if [ "${LMOD_SETTARG_CMD:-:}" != ":" ]; then
settarg () {
eval $(${LMOD_SETTARG_CMD:-:} -s sh "$@" )
}
fi


########################################################################
# ml is a shorthand tool for people who can't type moduel, err, module
# It is also a combination command:
# ml -> module list
# ml gcc -> module load gcc
# ml -gcc intel -> module unload gcc; module load intel
# It does much more. Do: "ml --help" for more information.


unalias ml 2> /dev/null || true
ml()
{
eval "$($LMOD_DIR/ml_cmd "$@")"
}

if [ -n "${BASH_VERSION:-}" -a "@export_module@" != no ]; then
export -f module
export -f ml
fi
unset export_module

########################################################################
# clearMT removes the ModuleTable from your environment. It is rarely
# needed but it useful sometimes.

clearMT()
{
eval $($LMOD_DIR/clearLMOD_cmd --shell bash --simple)
}

clearLmod()
{
module --force purge
eval $($LMOD_DIR/clearLMOD_cmd --shell bash --full "$@")
}

xSetTitleLmod()
{
builtin echo -n -e "\033]2;$1\007";
}

########################################################################
# Make tab completions available to bash users.

if [ ${BASH_VERSINFO:-0} -ge 3 ] && [ -r @PKGV@/init/lmod_bash_completions ] && [ -n "${PS1:-}" ] && [ -z "${POSIXLY_CORRECT:-}" ]; then
. @PKGV@/init/lmod_bash_completions
fi


# Restoring XTRACE and VERBOSE states.
if [ -n "${__lmod_vx:-}" ]; then
echo "Shell debugging restarted" 1>&2
set -$__lmod_vx;
unset __lmod_vx;
fi;

########################################################################
# End Lmod BASHENV
########################################################################
#
# Local Variables:
# mode: shell-script
# indent-tabs-mode: nil
# End:
1 change: 0 additions & 1 deletion init/tcsh.in

This file was deleted.

62 changes: 62 additions & 0 deletions init/tcsh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/csh
setenv LMOD_ROOT "@lmod_root@"
setenv LMOD_PKG "@PKGV@"
setenv LMOD_CMD "$LMOD_PKG/libexec/lmod"
setenv LMOD_DIR "$LMOD_PKG/libexec"
setenv MODULESHOME "$LMOD_PKG"
setenv TARG_TITLE_BAR_PAREN " "
setenv LMOD_SETTARG_FULL_SUPPORT @lmod_settarg_full_support@

if ( ! $?LMOD_SETTARG_CMD ) then
setenv LMOD_SETTARG_CMD :
endif

set SUPPORT_KSH = "@support_ksh@"

if ( $SUPPORT_KSH == yes && ! $?__LMOD_SET_FPATH ) then
setenv __LMOD_SET_FPATH 1
setenv FPATH `@PKGV@/libexec/addto FPATH @PKGV@/init/ksh_funcs`
endif


set prefix = ""
set midfix = ""
set postfix = ""
set merge = "&&"

set histchar = \!
if ( $?histchars) then
set histchar = `echo $histchars | cut -c1`
if ( "$histchar" != '\!' ) then
set _histchars = $histchars
set prefix = 'set _histchars = $histchars; unset histchars;'
set midfix = '--localvar histchars=$_histchars'
set postfix = '&& set histchars = $_histchars'
endif
endif

if ($?tcsh) then
alias module $prefix'eval `$LMOD_CMD tcsh '$midfix $histchar'*` '$postfix $merge' eval `$LMOD_SETTARG_CMD -s csh`'
else
alias module $prefix'eval `$LMOD_CMD csh '$midfix $histchar'*` '$postfix
endif
alias clearMT 'eval `'$LMOD_DIR/clearLMOD_cmd --shell csh --simple'`'
alias clearLmod module --force purge $merge 'eval `'$LMOD_DIR/clearLMOD_cmd --shell csh --full $histchar'*' '`'

alias ml 'eval `'$LMOD_DIR/ml_cmd' '$histchar'*`'

setenv LMOD_VERSION '@lmod_version@'

unset SUPPORT_KSH
unset prefix
unset midfix
unset postfix
unset histchar
unset merge
set echo_style=both # this variable must be set for precmd in the settarg module to work!

# Local Variables:
# mode: shell-script
# indent-tabs-mode: nil
# end:

1 change: 0 additions & 1 deletion init/zsh.in

This file was deleted.

Loading

0 comments on commit a814b72

Please sign in to comment.