Introduce an installation process

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).
This commit is contained in:
Xavier Delaruelle
2017-02-19 18:15:18 +01:00
parent c3284f7fe4
commit 99668416d8
18 changed files with 190 additions and 108 deletions

2
.gitignore vendored
View File

@@ -5,3 +5,5 @@ doc/html/*.html
doc/man
www/tcl
www/docs
.makeinstallpath
doc/.makeinstallpath

View File

@@ -1,13 +1,37 @@
export MODULESHOME = $(shell pwd)
.PHONY: doc www initdir clean
.PHONY: doc www initdir install clean .makeinstallpath
all: initdir doc ChangeLog
# load previously saved install paths if any
-include .makeinstallpath
# set default installation paths if not yet defined
prefix ?= /usr/local/modules-tcl
bindir ?= $(prefix)/bin
libexecdir ?= $(prefix)/libexec
initdir ?= $(prefix)/init
datarootdir ?= $(prefix)/share
mandir ?= $(datarootdir)/man
docdir ?= $(datarootdir)/doc
all: initdir doc ChangeLog .makeinstallpath
# save defined install paths
.makeinstallpath:
@echo "prefix := $(prefix)" >$@
@echo "bindir := $(bindir)" >>$@
@echo "libexecdir := $(libexecdir)" >>$@
@echo "initdir := $(initdir)" >>$@
@echo "datarootdir := $(datarootdir)" >>$@
@echo "mandir := $(mandir)" >>$@
@echo "docdir := $(docdir)" >>$@
initdir:
make -C init all
make -C init all prefix=$(prefix) libexecdir=$(libexecdir) \
initdir=$(initdir)
doc:
make -C doc all
make -C doc all prefix=$(prefix) datarootdir=$(datarootdir) \
mandir=$(mandir) docdir=$(docdir)
www:
make -C www all
@@ -15,10 +39,24 @@ www:
ChangeLog:
contrib/gitlog2changelog.py
install: ChangeLog .makeinstallpath
mkdir -p $(libexecdir)
mkdir -p $(bindir)
mkdir -p $(docdir)
cp modulecmd.tcl $(libexecdir)/
chmod +x $(libexecdir)/modulecmd.tcl
cp contrib/envml $(bindir)/
chmod +x $(bindir)/envml
cp ChangeLog $(docdir)/
cp NEWS $(docdir)/
cp readme.txt $(docdir)/README
make -C init install
make -C doc install
distclean: clean
clean:
rm -f *.log *.sum ChangeLog
rm -f *.log *.sum ChangeLog .makeinstallpath
make -C init clean
make -C doc clean
make -C www clean

View File

@@ -1,4 +1,4 @@
.PHONY: clean
.PHONY: install clean .makeinstallpath
VERSION_FILE := ../modulecmd.tcl
MAN_VERSION := "modules-tcl $(shell grep '^set MODULES_CURRENT_VERSION' \
@@ -11,9 +11,25 @@ MAN1_DIR := $(MAN_DIR)/man1
MAN4_DIR := $(MAN_DIR)/man4
SOURCE_DIR := source
# load previously saved install paths if any
-include .makeinstallpath
# set default installation paths if not yet defined
prefix ?= /usr/local/modules-tcl
datarootdir ?= $(prefix)/share
mandir ?= $(datarootdir)/man
docdir ?= $(datarootdir)/doc
all: $(HTML_DIR)/module.html $(HTML_DIR)/modulefile.html \
$(MAN1_DIR)/module.1 $(MAN4_DIR)/modulefile.4 \
$(HTML_DIR)/diff_with_c-version.html
$(HTML_DIR)/diff_with_c-version.html .makeinstallpath
# save defined install paths
.makeinstallpath:
@echo "prefix := $(prefix)" >$@
@echo "datarootdir := $(datarootdir)" >>$@
@echo "mandir := $(mandir)" >>$@
@echo "docdir := $(docdir)" >>$@
$(HTML_DIR)/%.html: $(SOURCE_DIR)/%.pod $(VERSION_FILE)
mkdir -p $(HTML_DIR)
@@ -28,8 +44,15 @@ $(MAN4_DIR)/%.4: $(SOURCE_DIR)/%.pod $(VERSION_FILE)
mkdir -p $(MAN4_DIR)
pod2man -c $(MAN_HEADER) -r $(MAN_VERSION) -s 4 $< $@
install: all
mkdir -p $(docdir)
mkdir -p $(mandir)/man1 $(mandir)/man4
cp LICENSE.GPL $(docdir)/
cp $(MAN1_DIR)/module.1 $(mandir)/man1/
cp $(MAN4_DIR)/modulefile.4 $(mandir)/man4/
clean:
rm -f $(HTML_DIR)/*.html
rm -f $(MAN1_DIR)/*.1 $(MAN4_DIR)/*.4
rmdir $(MAN1_DIR) $(MAN4_DIR) $(MAN_DIR)
rm -f pod*.tmp
rm -f pod*.tmp .makeinstallpath

2
init/.gitignore vendored
View File

@@ -12,6 +12,6 @@ modulerc
fish
tcsh_completion
.modulespath
ksh-functions
profile.sh
profile.csh
.makeinstallpath

View File

@@ -1,18 +1,34 @@
SH_LIKE = sh ksh bash zsh profile.sh ksh-functions/module
.PHONY: install clean .makeinstallpath
SH_LIKE = sh ksh bash zsh profile.sh
CSH_LIKE = csh tcsh tcsh_completion profile.csh
OTHER = perl python lisp tcl fish
# get MODULESHOME location from this Makefile location
MODULESHOME := $(abspath $(lastword $(MAKEFILE_LIST))/../..)
# load previously saved install paths if any
-include .makeinstallpath
# set default installation paths if not yet defined
prefix ?= /usr/local/modules-tcl
libexecdir ?= $(prefix)/libexec
initdir ?= $(prefix)/init
# get tclsh location from standard PATHs or /usr/local/bin
TCLSH := $(shell PATH=/usr/bin:/bin:/usr/local/bin command -v tclsh)
ALL_SHELLS = $(SH_LIKE) $(CSH_LIKE) $(OTHER)
all: $(ALL_SHELLS) modulerc.fake
all: $(ALL_SHELLS) modulerc.fake .makeinstallpath
# save defined install paths
.makeinstallpath:
@echo "prefix := $(prefix)" >$@
@echo "libexecdir := $(libexecdir)" >>$@
@echo "initdir := $(initdir)" >>$@
define translate-in-script
perl -pe 's|\@MODULESHOME\@|$(MODULESHOME)|g; \
perl -pe 's|\@prefix\@|$(prefix)|g; \
s|\@libexecdir\@|$(libexecdir)|g; \
s|\@initdir\@|$(initdir)|g; \
s|\@SHELLNAME\@|$@|g; \
s|\@TCLSH\@|$(TCLSH)|g' $< > $@
endef
@@ -24,16 +40,19 @@ endef
tcsh: csh.in Makefile
$(translate-in-script)
ksh-functions/module: ksh
mkdir -p ksh-functions
cp $< $@
# this rule is needed for profile.sh to get matched
profile.sh: profile.sh.in Makefile
$(translate-in-script)
install: all
mkdir -p $(initdir)
mkdir -p $(initdir)/ksh-functions
cp $(ALL_SHELLS) $(initdir)/
cp bash_completion $(initdir)/
cp ksh $(initdir)/ksh-functions/module
clean:
rm -f $(ALL_SHELLS)
rm -f $(ALL_SHELLS) .makeinstallpath
modulerc.fake:
ifeq ($(wildcard modulerc),)

View File

@@ -1,34 +1,34 @@
# 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@ @MODULESHOME@/modulecmd.tcl bash $*`; }
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@ @MODULESHOME@/modulecmd.tcl bash $*`; }
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=@MODULESHOME@/init/profile.sh; export ENV
BASH_ENV=@MODULESHOME@/init/bash; export BASH_ENV
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 @MODULESHOME@/init/bash_completion ]; then
source @MODULESHOME@/init/bash_completion
[ -r @initdir@/bash_completion ]; then
source @initdir@/bash_completion
fi
MODULESHOME=@MODULESHOME@; export MODULESHOME
MODULESHOME=@prefix@; export MODULESHOME
if [ "${MODULEPATH:-}" = '' ]; then
if [ -r @MODULESHOME@/init/.modulespath ]; then
if [ -r @initdir@/.modulespath ]; then
MODULEPATH=`sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' \
@MODULESHOME@/init/.modulespath`; export MODULEPATH
@initdir@/.modulespath`; export MODULEPATH
else
MODULEPATH=; export MODULEPATH
fi
@@ -38,6 +38,6 @@ if [ "${LOADEDMODULES:-}" = '' ]; then
LOADEDMODULES=; export LOADEDMODULES
fi
if [ -r @MODULESHOME@/init/modulerc ]; then
source @MODULESHOME@/init/modulerc
if [ -r @initdir@/modulerc ]; then
source @initdir@/modulerc
fi

View File

@@ -21,26 +21,26 @@ endif
set postfix = "set _exit="'$status'"; $postfix; test 0 = "'$_exit;'
alias module $prefix'eval `@TCLSH@ @MODULESHOME@/modulecmd.tcl @SHELLNAME@ '$histchar'*`; '$postfix
alias module $prefix'eval `@TCLSH@ @libexecdir@/modulecmd.tcl @SHELLNAME@ '$histchar'*`; '$postfix
unset _histchar
unset prefix
unset postfix
if ( $?tcsh && $?prompt && -r @MODULESHOME@/init/tcsh_completion ) then
source @MODULESHOME@/init/tcsh_completion
if ( $?tcsh && $?prompt && -r @initdir@/tcsh_completion ) then
source @initdir@/tcsh_completion
endif
# 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.
setenv ENV @MODULESHOME@/init/profile.sh
setenv BASH_ENV @MODULESHOME@/init/bash
setenv ENV @initdir@/profile.sh
setenv BASH_ENV @initdir@/bash
setenv MODULESHOME @MODULESHOME@
setenv MODULESHOME @prefix@
if (! $?MODULEPATH ) then
if ( -r @MODULESHOME@/init/.modulespath ) then
setenv MODULEPATH `sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' @MODULESHOME@/init/.modulespath`
if ( -r @initdir@/.modulespath ) then
setenv MODULEPATH `sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' @initdir@/.modulespath`
else
setenv MODULEPATH ''
endif
@@ -50,6 +50,6 @@ if (! $?LOADEDMODULES ) then
setenv LOADEDMODULES ''
endif
if ( -r @MODULESHOME@/init/modulerc ) then
source @MODULESHOME@/init/modulerc
if ( -r @initdir@/modulerc ) then
source @initdir@/modulerc
endif

View File

@@ -1,6 +1,6 @@
if status -i
if [ -r @MODULESHOME@/init/fish_completion ]
source @MODULESHOME@/init/fish_completion
if [ -r @initdir@/fish_completion ]
source @initdir@/fish_completion
end
# only redirect module from stderr to stdout in interactive mode
@@ -8,29 +8,29 @@ if status -i
function moduleraw
# use "| source -" rather than "eval" to be able
# to redirect stderr after stdout being evaluated
eval @TCLSH@ @MODULESHOME@/modulecmd.tcl fish $argv | source -
eval @TCLSH@ @libexecdir@/modulecmd.tcl fish $argv | source -
end
function module
moduleraw $argv ^&1
end
else
function module
eval @TCLSH@ @MODULESHOME@/modulecmd.tcl fish $argv | source -
eval @TCLSH@ @libexecdir@/modulecmd.tcl fish $argv | source -
end
end
# 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.
set -xg ENV @MODULESHOME@/init/profile.sh
set -xg BASH_ENV @MODULESHOME@/init/bash
set -xg ENV @initdir@/profile.sh
set -xg BASH_ENV @initdir@/bash
set -xg MODULESHOME @MODULESHOME@
set -xg MODULESHOME @prefix@
if not set -q MODULEPATH
if [ -r @MODULESHOME@/init/.modulespath ]
if [ -r @initdir@/.modulespath ]
set -xg MODULEPATH (sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' \
@MODULESHOME@/init/.modulespath)
@initdir@/.modulespath)
else
set -xg MODULEPATH ''
end
@@ -40,6 +40,6 @@ if not set -q LOADEDMODULES
set -xg LOADEDMODULES ''
end
if [ -r @MODULESHOME@/init/modulerc ]
source @MODULESHOME@/init/modulerc
if [ -r @initdir@/modulerc ]
source @initdir@/modulerc
end

View File

@@ -1,31 +1,31 @@
# 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@ @MODULESHOME@/modulecmd.tcl ksh $*`; }
moduleraw() { eval `@TCLSH@ @libexecdir@/modulecmd.tcl ksh $*`; }
module() { moduleraw $* 2>&1 ; }
else
module() { eval `@TCLSH@ @MODULESHOME@/modulecmd.tcl ksh $*`; }
module() { eval `@TCLSH@ @libexecdir@/modulecmd.tcl ksh $*`; }
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=@MODULESHOME@/init/profile.sh; export ENV
BASH_ENV=@MODULESHOME@/init/bash; export BASH_ENV
ENV=@initdir@/profile.sh; export ENV
BASH_ENV=@initdir@/bash; export BASH_ENV
# setup FPATH to get module defined in 'ksh' interactive and non-interactive
# sub-shells. only set in ksh init script to avoid side effect default FPATH
# set for 'zsh' shell when it starts.
if [[ ! ":$FPATH:" =~ ':@MODULESHOME@/init/ksh-functions:' ]]; then
FPATH+="${FPATH:+:}@MODULESHOME@/init/ksh-functions"; export FPATH
if [[ ! ":$FPATH:" =~ ':@initdir@/ksh-functions:' ]]; then
FPATH+="${FPATH:+:}@initdir@/ksh-functions"; export FPATH
fi
MODULESHOME=@MODULESHOME@; export MODULESHOME
MODULESHOME=@prefix@; export MODULESHOME
if [ "${MODULEPATH:-}" = '' ]; then
if [ -r @MODULESHOME@/init/.modulespath ]; then
if [ -r @initdir@/.modulespath ]; then
MODULEPATH=`sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' \
@MODULESHOME@/init/.modulespath`; export MODULEPATH
@initdir@/.modulespath`; export MODULEPATH
else
MODULEPATH=; export MODULEPATH
fi
@@ -35,6 +35,6 @@ if [ "${LOADEDMODULES:-}" = '' ]; then
LOADEDMODULES=; export LOADEDMODULES
fi
if [ -r @MODULESHOME@/init/modulerc ]; then
source @MODULESHOME@/init/modulerc
if [ -r @initdir@/modulerc ]; then
source @initdir@/modulerc
fi

View File

@@ -2,7 +2,7 @@
;; emacs-lisp init code for Modules
;;
(setenv "MODULESHOME" "@MODULESHOME@")
(setenv "MODULESHOME" "@prefix@")
(defvar Modules-history '() "module cmd history list")
@@ -41,7 +41,7 @@ Return value is t on success, nil otherwise."
(apply 'call-process "@TCLSH@" nil
(list cmd-buffer log-scratch-file)
nil ;; don't display stdout
"@MODULESHOME@/modulecmd.tcl"
"@libexecdir@/modulecmd.tcl"
"lisp" (split-string command))
t)
(error nil))

View File

@@ -1,5 +1,5 @@
sub module {
eval `@TCLSH@ @MODULESHOME@/modulecmd.tcl perl @_`;
eval `@TCLSH@ @libexecdir@/modulecmd.tcl perl @_`;
if ($@) {
use Carp;
confess "module-error: $@\n";
@@ -7,11 +7,11 @@ sub module {
return 1;
}
$ENV{MODULESHOME} = '@MODULESHOME@';
$ENV{MODULESHOME} = '@prefix@';
if (!defined $ENV{"MODULEPATH"}) {
if ( -r '@MODULESHOME@/init/.modulespath' ) {
open(F, '@MODULESHOME@/init/.modulespath');
if ( -r '@initdir@/.modulespath' ) {
open(F, '@initdir@/.modulespath');
$ENV{"MODULEPATH"} = join(":", grep(/\S/, map { s/^\s*//g; s/[\s#].*$//g; $_ } <F>));
close F;
} else {
@@ -23,8 +23,8 @@ if (!defined $ENV{LOADEDMODULES}) {
$ENV{LOADEDMODULES} = '';
}
if ( -r '@MODULESHOME@/init/modulerc' ) {
module('source', '@MODULESHOME@/init/modulerc');
if ( -r '@initdir@/modulerc' ) {
module('source', '@initdir@/modulerc');
}
1;

View File

@@ -1,5 +1,5 @@
if ($?tcsh) then
source @MODULESHOME@/init/tcsh
source @initdir@/tcsh
else
source @MODULESHOME@/init/csh
source @initdir@/csh
endif

View File

@@ -1,7 +1,7 @@
shell=$(/bin/basename $(/bin/ps -p $$ -ocomm=))
if [ -f @MODULESHOME@/init/$shell ]; then
source @MODULESHOME@/init/$shell
if [ -f @initdir@/$shell ]; then
source @initdir@/$shell
else
source @MODULESHOME@/init/sh
source @initdir@/sh
fi

View File

@@ -1,14 +1,14 @@
import os, re, subprocess
def module(command, *arguments):
exec(subprocess.Popen(['@TCLSH@', '@MODULESHOME@/modulecmd.tcl', 'python', command] + list(arguments), stdout=subprocess.PIPE).communicate()[0])
exec(subprocess.Popen(['@TCLSH@', '@libexecdir@/modulecmd.tcl', 'python', command] + list(arguments), stdout=subprocess.PIPE).communicate()[0])
os.environ['MODULESHOME'] = '@MODULESHOME@'
os.environ['MODULESHOME'] = '@prefix@'
if not 'MODULEPATH' in os.environ:
if os.access('@MODULESHOME@/init/.modulespath', os.R_OK):
if os.access('@initdir@/.modulespath', os.R_OK):
pathlist = []
for fline in open('@MODULESHOME@/init/.modulespath', 'r').read().splitlines():
for fline in open('@initdir@/.modulespath', 'r').read().splitlines():
patharg = re.match('^\s*(.*?)[\s#].*$', fline)
if patharg and patharg.group(1):
pathlist.append(patharg.group(1))
@@ -19,5 +19,5 @@ if not 'MODULEPATH' in os.environ:
if not 'LOADEDMODULES' in os.environ:
os.environ['LOADEDMODULES'] = ''
if os.access('@MODULESHOME@/init/modulerc', os.R_OK):
module('source', '@MODULESHOME@/init/modulerc')
if os.access('@initdir@/modulerc', os.R_OK):
module('source', '@initdir@/modulerc')

View File

@@ -1,7 +1,7 @@
# only redirect module from stderr to stdout in interactive mode
# to avoid breaking non interactive session (scp, sftp, etc)
if [ -z "$PS1" ]; then
moduleraw() { eval `@TCLSH@ @MODULESHOME@/modulecmd.tcl sh $*`; }
moduleraw() { eval `@TCLSH@ @libexecdir@/modulecmd.tcl sh $*`; }
module() { moduleraw $* 2>&1 ; }
# if sh is bash, export functions to get them defined in sub-shells
if [ "${BASH:-}" != '' ]; then
@@ -9,7 +9,7 @@ if [ -z "$PS1" ]; then
export -f module
fi
else
module() { eval `@TCLSH@ @MODULESHOME@/modulecmd.tcl sh $*`; }
module() { eval `@TCLSH@ @libexecdir@/modulecmd.tcl sh $*`; }
if [ "${BASH:-}" != '' ]; then
export -f module
fi
@@ -18,15 +18,15 @@ 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=@MODULESHOME@/init/profile.sh; export ENV
BASH_ENV=@MODULESHOME@/init/bash; export BASH_ENV
ENV=@initdir@/profile.sh; export ENV
BASH_ENV=@initdir@/bash; export BASH_ENV
MODULESHOME=@MODULESHOME@; export MODULESHOME
MODULESHOME=@prefix@; export MODULESHOME
if [ "${MODULEPATH:-}" = '' ]; then
if [ -r @MODULESHOME@/init/.modulespath ]; then
if [ -r @initdir@/.modulespath ]; then
MODULEPATH=`sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' \
@MODULESHOME@/init/.modulespath`; export MODULEPATH
@initdir@/.modulespath`; export MODULEPATH
else
MODULEPATH=; export MODULEPATH
fi
@@ -36,6 +36,6 @@ if [ "${LOADEDMODULES:-}" = '' ]; then
LOADEDMODULES=; export LOADEDMODULES
fi
if [ -r @MODULESHOME@/init/modulerc ]; then
source @MODULESHOME@/init/modulerc
if [ -r @initdir@/modulerc ]; then
source @initdir@/modulerc
fi

View File

@@ -1,17 +1,17 @@
proc module {args} {
global env;
set script {};
if {[catch { set script [eval exec "@TCLSH@" "@MODULESHOME@/modulecmd.tcl" "tcl" $args] } msg]} {
if {[catch { set script [eval exec "@TCLSH@" "@libexecdir@/modulecmd.tcl" "tcl" $args] } msg]} {
puts $msg
};
uplevel $script;
}
set env(MODULESHOME) @MODULESHOME@
set env(MODULESHOME) @prefix@
if {![info exists env(MODULEPATH)]} {
if {[file readable @MODULESHOME@/init/.modulespath]} {
set fid [open "@MODULESHOME@/init/.modulespath" r]
if {[file readable @initdir@/.modulespath]} {
set fid [open "@initdir@/.modulespath" r]
set fdata [split [read $fid] "\n"]
close $fid
set pathlist {}
@@ -32,6 +32,6 @@ if {![info exists env(LOADEDMODULES)]} {
set env(LOADEDMODULES) ""
}
if {[file readable @MODULESHOME@/init/modulerc]} {
source @MODULESHOME@/init/modulerc
if {[file readable @initdir@/modulerc]} {
source @initdir@/modulerc
}

View File

@@ -3,7 +3,7 @@
#
alias _module_avail '\\
@TCLSH@ @MODULESHOME@/modulecmd.tcl tcsh avail -t |& sed '"'"'\\
@TCLSH@ @libexecdir@/modulecmd.tcl tcsh avail -t |& sed '"'"'\\
/^-\+/d; /^\s*$/d; \\
/->.*$/d; \\
/:$/d; \\
@@ -14,7 +14,7 @@ alias _module_avail '\\
s#/*$##g; '"'"
alias _module_loaded '\\
@TCLSH@ @MODULESHOME@/modulecmd.tcl tcsh list -t |& sed '"'"'\\
@TCLSH@ @libexecdir@/modulecmd.tcl tcsh list -t |& sed '"'"'\\
/^-\+/d; /^\s*$/d; \\
/->.*$/d; \\
/:$/d; \\
@@ -24,7 +24,7 @@ alias _module_loaded '\\
s#/*$##g; '"'"
alias _module_savelist '\\
@TCLSH@ @MODULESHOME@/modulecmd.tcl tcsh savelist -t |& sed '"'"'\\
@TCLSH@ @libexecdir@/modulecmd.tcl tcsh savelist -t |& sed '"'"'\\
/Named collection list$/d; \\
/:$/d; \\
/:ERROR:/d; '"'"

View File

@@ -1,27 +1,27 @@
# 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@ @MODULESHOME@/modulecmd.tcl zsh $*`; }
moduleraw() { eval `@TCLSH@ @libexecdir@/modulecmd.tcl zsh $*`; }
module() { moduleraw $* 2>&1 ; }
else
module() { eval `@TCLSH@ @MODULESHOME@/modulecmd.tcl zsh $*`; }
module() { eval `@TCLSH@ @libexecdir@/modulecmd.tcl zsh $*`; }
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=@MODULESHOME@/init/profile.sh; export ENV
BASH_ENV=@MODULESHOME@/init/bash; export BASH_ENV
ENV=@initdir@/profile.sh; export ENV
BASH_ENV=@initdir@/bash; export BASH_ENV
# no FPATH setup as zsh requires to 'autoload' functions put in FPATH dir
# (no gain compared to a bare source of this init script)
MODULESHOME=@MODULESHOME@; export MODULESHOME
MODULESHOME=@prefix@; export MODULESHOME
if [ "${MODULEPATH:-}" = '' ]; then
if [ -r @MODULESHOME@/init/.modulespath ]; then
if [ -r @initdir@/.modulespath ]; then
MODULEPATH=`sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' \
@MODULESHOME@/init/.modulespath`; export MODULEPATH
@initdir@/.modulespath`; export MODULEPATH
else
MODULEPATH=; export MODULEPATH
fi
@@ -31,6 +31,6 @@ if [ "${LOADEDMODULES:-}" = '' ]; then
LOADEDMODULES=; export LOADEDMODULES
fi
if [ -r @MODULESHOME@/init/modulerc ]; then
source @MODULESHOME@/init/modulerc
if [ -r @initdir@/modulerc ]; then
source @initdir@/modulerc
fi