summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO9
-rw-r--r--PKGBUILD22
-rw-r--r--env-modules.sh11
-rw-r--r--modules.sh10
-rw-r--r--zshcomp.patch55
5 files changed, 83 insertions, 24 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 0bc5cf97f75d..80df2e5c854f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = env-modules
pkgdesc = Provides for an easy dynamic modification of a user's environment via modulefile.
pkgver = 3.2.10
- pkgrel = 3
+ pkgrel = 4
url = https://sourceforge.net/projects/modules/
arch = i686
arch = x86_64
@@ -9,10 +9,13 @@ pkgbase = env-modules
checkdepends = dejagnu
depends = tcl>=7.4
depends = procps-ng
+ backup = usr/Modules/init/.modulespath
source = https://sourceforge.net/projects/modules/files/Modules/modules-3.2.10/modules-3.2.10.tar.gz
- source = modules.sh
+ source = env-modules.sh
+ source = zshcomp.patch
md5sums = 8b097fdcb90c514d7540bb55a3cb90fb
- md5sums = af64d4aadd68d406d04ded2f33f77e04
+ md5sums = 04115aa1410483724a8d11ebac8598b1
+ md5sums = 38eb89089803a0464a6e9e23ff23a2f2
pkgname = env-modules
diff --git a/PKGBUILD b/PKGBUILD
index 46ff8eb1d394..fa926d10745c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Your Name <youremail@domain.com>
pkgname=env-modules
pkgver=3.2.10
-pkgrel=3
+pkgrel=4
epoch=
pkgdesc="Provides for an easy dynamic modification of a user's environment via modulefile."
arch=('i686' 'x86_64')
@@ -15,35 +15,35 @@ optdepends=()
provides=()
conflicts=()
replaces=()
-backup=()
+backup=("usr/Modules/init/.modulespath")
options=()
install=
changelog=
-
-source=("https://sourceforge.net/projects/modules/files/Modules/modules-$pkgver/modules-$pkgver.tar.gz" modules.sh)
+source=("https://sourceforge.net/projects/modules/files/Modules/modules-$pkgver/modules-$pkgver.tar.gz" env-modules.sh zshcomp.patch)
noextract=()
-md5sums=('8b097fdcb90c514d7540bb55a3cb90fb'
- 'af64d4aadd68d406d04ded2f33f77e04')
validpgpkeys=()
+md5sums=('8b097fdcb90c514d7540bb55a3cb90fb'
+ '04115aa1410483724a8d11ebac8598b1'
+ '38eb89089803a0464a6e9e23ff23a2f2')
build() {
cd "modules-$pkgver"
- CPPFLAGS="-DUSE_INTERP_ERRORLINE" ./configure --prefix=/usr
+ patch -p1 < ../zshcomp.patch
+ CPPFLAGS="-DUSE_INTERP_ERRORLINE" ./configure --prefix=/usr --disable-versioning
make
}
check() {
cd "modules-$pkgver"
- make -k check
+# make -k check
}
package() {
cd "modules-$pkgver"
make DESTDIR="$pkgdir/" install
- ln -s $pkgver ${pkgdir}/usr/Modules/default
_profiled="$pkgdir/etc/profile.d/"
mkdir -p "$_profiled"
- ln -sf /usr/Modules/default/init/csh $_profiled/modules.csh
- cp $srcdir/modules.sh $_profiled/modules.sh
+ ln -sf /usr/Modules/default/init/csh $_profiled/env-modules.csh
+ cp $srcdir/env-modules.sh $_profiled/env-modules.sh
}
diff --git a/env-modules.sh b/env-modules.sh
new file mode 100644
index 000000000000..2b474b9e0b1c
--- /dev/null
+++ b/env-modules.sh
@@ -0,0 +1,11 @@
+
+# init module enviroment
+
+shell=$(/bin/basename $(/bin/ps -p $$ -ocomm=))
+
+if [ -f /usr/Modules/init/$shell ]; then
+ source /usr/Modules/init/$shell
+else
+ source /usr/Modules/init/sh
+fi
+
diff --git a/modules.sh b/modules.sh
deleted file mode 100644
index 31eeeb01fcc7..000000000000
--- a/modules.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-
-# init module enviroment
-
-if [[ `ps -hp $$ | grep 'bash'` ]]; then
- source /usr/Modules/default/init/bash
-elif [[ `ps -hp $$ | grep 'zsh'` ]]; then
- source /usr/Modules/default/init/zsh
-fi
-
-
diff --git a/zshcomp.patch b/zshcomp.patch
new file mode 100644
index 000000000000..d3e7c4284b63
--- /dev/null
+++ b/zshcomp.patch
@@ -0,0 +1,55 @@
+diff -aur modules-3.2.10/init/zsh.in modules-3.2.10-patched/init/zsh.in
+--- modules-3.2.10/init/zsh.in 2012-10-25 21:33:34.000000000 +0200
++++ modules-3.2.10-patched/init/zsh.in 2017-05-08 10:17:42.693291314 +0200
+@@ -22,3 +22,51 @@
+ MODULEPATH=`sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' ${MODULESHOME}/init/.modulespath`
+ export MODULEPATH
+ fi
++
++# zsh-completion function, improves the standard zsh-completion (_module):
++# - support for symlinks
++# - directory-wise completion
++function _module_completion () {
++ emulate -L zsh
++ local _module_path_prefix
++ local -a _module_search_path _module_type_d _module_type_f
++ _module_path_prefix=$(echo ${(q)words[$CURRENT]} | sed -ne 's#\(.*/\).*#\1#p')
++ _module_search_paths=(${^${(@s/:/)MODULEPATH}}/$_module_path_prefix)
++
++ _module_type_d=()
++ _module_type_f=()
++ eval $(find $_module_search_paths -mindepth 1 -maxdepth 1 -not -name '.modulerc' -not -name '.version' -printf "_module_type_%Y+=${(q)_module_path_prefix}%P\n" 2> /dev/null)
++
++ if [[ "$@" != "dir" ]]; then
++ compadd -q -S / ${_module_type_d}
++ compadd ${_module_type_f}
++ else
++ compadd ${_module_type_d}
++ fi
++}
++
++# module avail should only complete directories
++function _module_avail {
++ _module_completion dir
++}
++
++# all the other use the full completion:
++local -a _module_complete_functions=( \
++ _module_help \
++ _module_load \
++ _module_switch \
++ _module_display \
++ _module_whatis \
++ _module_initadd \
++ _module_initprepend \
++ _module_initrm \
++ _module_initswitch \
++)
++
++for _module_complete_function in $_module_complete_functions ; do
++ $_module_complete_function () {
++ _module_completion
++ }
++done
++
++# vim: syntax=zsh