From 9e7255fa0a3dd80e0884c54a409c6f485aaee43e Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 11 Mar 2015 16:55:52 +0100 Subject: [PATCH] file for csh support added, still not usable --- scripts/Bootstrap/Pmodules/csh | 45 ++++++++++++++ scripts/Bootstrap/Pmodules/environment.csh | 17 ++++++ scripts/Bootstrap/Pmodules/profile.csh | 69 ++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 scripts/Bootstrap/Pmodules/csh create mode 100755 scripts/Bootstrap/Pmodules/environment.csh create mode 100755 scripts/Bootstrap/Pmodules/profile.csh diff --git a/scripts/Bootstrap/Pmodules/csh b/scripts/Bootstrap/Pmodules/csh new file mode 100644 index 0000000..52f3934 --- /dev/null +++ b/scripts/Bootstrap/Pmodules/csh @@ -0,0 +1,45 @@ +if ($?tcsh) then + set modules_shell="tcsh" +else + set modules_shell="csh" +endif +set exec_prefix='/usr/bin' + +set prefix="" +set postfix="" + +if ( $?histchars ) then + set histchar = `echo $histchars | cut -c1` + set _histchars = $histchars + + set prefix = 'unset histchars;' + set postfix = 'set histchars = $_histchars;' +else + set histchar = \! +endif + +if ($?prompt) then + set prefix = "$prefix"'set _prompt="$prompt";set prompt="";' + set postfix = "$postfix"'set prompt="$_prompt";unset _prompt;' +endif + +if ($?noglob) then + set prefix = "$prefix""set noglob;" + set postfix = "$postfix""unset noglob;" +endif +set postfix = "set _exit="'$status'"; $postfix; test 0 = "'$_exit;' + +alias module $prefix'eval `'$exec_prefix'/modulecmd '$modules_shell' '$histchar'*`; '$postfix +unset exec_prefix +unset prefix +unset postfix + +setenv MODULESHOME /usr/share/Modules + +if (! $?MODULEPATH ) then + setenv MODULEPATH `sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' ${MODULESHOME}/init/.modulespath` +endif + +if (! $?LOADEDMODULES ) then + setenv LOADEDMODULES "" +endif diff --git a/scripts/Bootstrap/Pmodules/environment.csh b/scripts/Bootstrap/Pmodules/environment.csh new file mode 100755 index 0000000..14037fb --- /dev/null +++ b/scripts/Bootstrap/Pmodules/environment.csh @@ -0,0 +1,17 @@ +#!/bin/tcsh + +setenv PSI_PREFIX "/opt/psi" + +if ( "$PMODULES_VERSION" == "" ) then + setenv PMODULES_VERSION "0.99.1" +endif +setenv PMODULES_HOME "$PSI_PREFIX/Tools/Pmodules/$PMODULES_VERSION" + +setenv PSI_CONFIG_DIR "config" +setenv PSI_MODULES_ROOT 'modulefiles' +setenv PSI_TEMPLATES_DIR 'templates' + +setenv PSI_DEFAULT_FAMILIES 'Tools Programming' + +setenv PSI_RELEASES ':unstable:stable:deprecated:' +setenv PSI_USED_RELEASES 'stable' diff --git a/scripts/Bootstrap/Pmodules/profile.csh b/scripts/Bootstrap/Pmodules/profile.csh new file mode 100755 index 0000000..683c306 --- /dev/null +++ b/scripts/Bootstrap/Pmodules/profile.csh @@ -0,0 +1,69 @@ +#!/bin/tcsh + +############################################################################# +# read Pmodules configuration +# +set _init_env_file="/opt/psi/config/environment.bash" +if ( ! -r "$_init_env_file" ); then + echo "Oops: cannot initialize Modules!" + echo "$_init_env_file: file does not exist or is not readable." + return 1 +fi +source "$_init_env_file" +unset _init_env_file + +############################################################################ +# check configuration +# +if ( ! $?PSI_PREFIX ) then + echo "Oops: Pmodules prefix not set." + return 1 +endif + +if ( "$PSI_PREFIX" == "" ) then + echo "Oops: Pmodules prefix set to empty string!" +endif +if ( ! -d ${PSI_PREFIX} ) then + echo "Oops: ${PSI_PREFIX}: Set as Pmodules prefix, but this is not a directory!" + return 1 +endif + +if ( ! $?PMODULES_VERSION ) then + echo "Oops: Pmodules version not set!" + return 1 +endif +if ( "$PMODULES_VERSION" == "" ) then + echo "Oops: Pmodules version set to empty string!" + return 1 +endif + +if ( $?PMODULES_HOME ) then + echo "Oops: Pmodules home not set!" + return 1 +endif +if ( "$PMODULES_HOME" == "" ) then + echo "Oops: Pmodules home set to empty string!" + return 1 +fi +if ( ! -d "$PMODULES_HOME" ) then + echo "Oops: $PMODULES_HOME: Set as Pmodules home, but this is not a directory!" + return 1 +endif + +############################################################################ +# inititialize Pmodules for bash +# +set _init_csh="$PMODULES_HOME/init/csh" +if ( ! -r "$_init_csh" ) then + echo "Oops: cannot initialize Modules!" + echo "$_init_csh: File does not exist or is not readable." + return 1 +fi +source "$_init_csh" +unset _init_csh + +# Local Variables: +# mode: csh +# sh-basic-offset: 8 +# tab-width: 8 +# End: