1 |
commit: 411585260d9f58b4b088c4ec816eb417a6c5877b |
2 |
Author: André Erdmann <dywi <AT> mailerd <DOT> de> |
3 |
AuthorDate: Wed Jun 26 17:20:05 2013 +0000 |
4 |
Commit: André Erdmann <dywi <AT> mailerd <DOT> de> |
5 |
CommitDate: Wed Jun 26 17:20:05 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=41158526 |
7 |
|
8 |
files/shlib/functions.sh: make $SHLIB PATH-like |
9 |
|
10 |
$SHLIB is now a colon-separated list of directories where function files could |
11 |
be found. |
12 |
|
13 |
--- |
14 |
files/shlib/functions.sh | 19 ++++++++++++++++--- |
15 |
1 file changed, 16 insertions(+), 3 deletions(-) |
16 |
|
17 |
diff --git a/files/shlib/functions.sh b/files/shlib/functions.sh |
18 |
index 05df7fa..03eb28b 100644 |
19 |
--- a/files/shlib/functions.sh |
20 |
+++ b/files/shlib/functions.sh |
21 |
@@ -204,10 +204,23 @@ autodie() { |
22 |
load_functions() { |
23 |
[ -n "${SHLIB-}" ] || die "\$SHLIB is not set." |
24 |
local f |
25 |
+ local sdir |
26 |
+ local IFS="${IFS_DEFAULT}" |
27 |
while [ $# -gt 0 ]; do |
28 |
- f="${SHLIB}/${1%.sh}.sh" |
29 |
- veinfo "Trying to load functions file ${f} ... " |
30 |
- . "${f}" || die "failed to load functions file ${f}." |
31 |
+ f= |
32 |
+ IFS=":" |
33 |
+ for sdir in ${SHLIB}; do |
34 |
+ IFS="${IFS_DEFAULT}" |
35 |
+ f="${sdir}/${1%.sh}.sh" |
36 |
+ if [ -f "${f}" ]; then |
37 |
+ veinfo "Trying to load functions file ${f} ... " |
38 |
+ . "${f}" || die "failed to load functions file ${f}." |
39 |
+ break 1 |
40 |
+ else |
41 |
+ f= |
42 |
+ fi |
43 |
+ done |
44 |
+ [ -n "${f}" ] || die "failed to locate functions file '${1}'." |
45 |
shift |
46 |
done |
47 |
return 0 |