| author | wenzelm | 
| Wed, 08 Apr 2020 13:14:05 +0200 | |
| changeset 71733 | 6c470c918aad | 
| parent 69407 | 7742cace5dd9 | 
| child 71736 | a2afc7ed2c68 | 
| permissions | -rw-r--r-- | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
1  | 
# -*- shell-script -*- :mode=shellscript:  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
2  | 
#  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
3  | 
# Author: Makarius  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
4  | 
#  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
5  | 
# Isabelle shell functions, with on-demand re-initialization for  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
6  | 
# non-interactive bash processess. NB: bash shell functions are not portable  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
7  | 
# and may be dropped by aggressively POSIX-conformant versions of /bin/sh.  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
8  | 
|
| 62416 | 9  | 
if type splitarray >/dev/null 2>/dev/null  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
10  | 
then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
11  | 
:  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
12  | 
else  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
13  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
14  | 
if [ "$OSTYPE" = cygwin ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
15  | 
  function platform_path() { cygpath -i -C UTF8 -w -p "$@"; }
 | 
| 69157 | 16  | 
  function standard_path() { cygpath -i -u -p "$@" | tr -d '\r'; }
 | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
17  | 
else  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
18  | 
  function platform_path() { echo "$@"; }
 | 
| 69157 | 19  | 
  function standard_path() { echo "$@"; }
 | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
20  | 
fi  | 
| 69157 | 21  | 
export -f platform_path standard_path  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
22  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
23  | 
#GNU tar (notably on Mac OS X)  | 
| 63994 | 24  | 
if type -p gnutar >/dev/null  | 
25  | 
then  | 
|
26  | 
  function tar() { gnutar "$@"; }
 | 
|
| 62413 | 27  | 
export -f tar  | 
| 69407 | 28  | 
elif type -p gtar >/dev/null  | 
29  | 
then  | 
|
30  | 
  function tar() { gtar "$@"; }
 | 
|
31  | 
export -f tar  | 
|
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
32  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
33  | 
|
| 69134 | 34  | 
#OCaml management via OPAM  | 
35  | 
function isabelle_opam()  | 
|
36  | 
{
 | 
|
37  | 
if [ -z "$ISABELLE_OPAM" ]; then  | 
|
38  | 
echo "Unknown ISABELLE_OPAM -- OCaml management tools unavailable" >&2  | 
|
39  | 
return 127  | 
|
40  | 
else  | 
|
41  | 
env OPAMROOT="$ISABELLE_OPAM_ROOT" "$ISABELLE_OPAM" "$@"  | 
|
42  | 
fi  | 
|
43  | 
}  | 
|
44  | 
export -f isabelle_opam  | 
|
45  | 
||
| 69150 | 46  | 
#GHC management via Stack  | 
| 69147 | 47  | 
function isabelle_stack()  | 
48  | 
{
 | 
|
49  | 
if [ -z "$ISABELLE_STACK" ]; then  | 
|
| 69150 | 50  | 
echo "Unknown ISABELLE_STACK -- GHC management tools unavailable" >&2  | 
| 69147 | 51  | 
return 127  | 
52  | 
else  | 
|
| 
69267
 
517655a528fe
always insist in specified resolver/compiler version;
 
wenzelm 
parents: 
69255 
diff
changeset
 | 
53  | 
env STACK_ROOT="$(platform_path "$ISABELLE_STACK_ROOT")" "$ISABELLE_STACK" --resolver "$ISABELLE_STACK_RESOLVER" --compiler "$ISABELLE_GHC_VERSION" "$@"  | 
| 69147 | 54  | 
fi  | 
55  | 
}  | 
|
56  | 
export -f isabelle_stack  | 
|
57  | 
||
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
58  | 
#robust invocation via ISABELLE_JDK_HOME  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
59  | 
function isabelle_jdk ()  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
60  | 
{
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
61  | 
if [ -z "$ISABELLE_JDK_HOME" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
62  | 
echo "Unknown ISABELLE_JDK_HOME -- Java development tools unavailable" >&2  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
63  | 
return 127  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
64  | 
else  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
65  | 
local PRG="$1"; shift  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
66  | 
"$ISABELLE_JDK_HOME/bin/$PRG" "$@"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
67  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
68  | 
}  | 
| 62413 | 69  | 
export -f isabelle_jdk  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
70  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
71  | 
#robust invocation via JAVA_HOME  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
72  | 
function isabelle_java ()  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
73  | 
{
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
74  | 
if [ -z "$JAVA_HOME" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
75  | 
echo "Unknown JAVA_HOME -- Java unavailable" >&2  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
76  | 
return 127  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
77  | 
else  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
78  | 
local PRG="$1"; shift  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
79  | 
"$JAVA_HOME/bin/$PRG" "$@"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
80  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
81  | 
}  | 
| 62413 | 82  | 
export -f isabelle_java  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
83  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
84  | 
#robust invocation via SCALA_HOME  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
85  | 
function isabelle_scala ()  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
86  | 
{
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
87  | 
if [ -z "$JAVA_HOME" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
88  | 
echo "Unknown JAVA_HOME -- Java unavailable" >&2  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
89  | 
return 127  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
90  | 
elif [ -z "$SCALA_HOME" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
91  | 
echo "Unknown SCALA_HOME -- Scala unavailable" >&2  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
92  | 
return 127  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
93  | 
else  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
94  | 
local PRG="$1"; shift  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
95  | 
"$SCALA_HOME/bin/$PRG" "$@"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
96  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
97  | 
}  | 
| 62413 | 98  | 
export -f isabelle_scala  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
99  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
100  | 
#classpath  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
101  | 
function classpath ()  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
102  | 
{
 | 
| 
66667
 
2e580fcf6522
avoid local shell variables intruding the resulting environment (via "set -o allexport" in getsettings);
 
wenzelm 
parents: 
63994 
diff
changeset
 | 
103  | 
local X=""  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
104  | 
for X in "$@"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
105  | 
do  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
106  | 
if [ -z "$ISABELLE_CLASSPATH" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
107  | 
ISABELLE_CLASSPATH="$X"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
108  | 
else  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
109  | 
ISABELLE_CLASSPATH="$ISABELLE_CLASSPATH:$X"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
110  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
111  | 
done  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
112  | 
export ISABELLE_CLASSPATH  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
113  | 
}  | 
| 62413 | 114  | 
export -f classpath  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
115  | 
|
| 
69277
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
116  | 
#Isabelle/Scala tools  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
117  | 
function isabelle_scala_tools ()  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
118  | 
{
 | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
119  | 
local X=""  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
120  | 
for X in "$@"  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
121  | 
do  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
122  | 
if [ -z "$ISABELLE_SCALA_TOOLS" ]; then  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
123  | 
ISABELLE_SCALA_TOOLS="$X"  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
124  | 
else  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
125  | 
ISABELLE_SCALA_TOOLS="$ISABELLE_SCALA_TOOLS:$X"  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
126  | 
fi  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
127  | 
done  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
128  | 
export ISABELLE_SCALA_TOOLS  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
129  | 
}  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
130  | 
export -f isabelle_scala_tools  | 
| 
 
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
 
wenzelm 
parents: 
69267 
diff
changeset
 | 
131  | 
|
| 69342 | 132  | 
#Isabelle fonts  | 
133  | 
function isabelle_fonts ()  | 
|
134  | 
{
 | 
|
135  | 
local X=""  | 
|
136  | 
for X in "$@"  | 
|
137  | 
do  | 
|
138  | 
if [ -z "$ISABELLE_FONTS" ]; then  | 
|
139  | 
ISABELLE_FONTS="$X"  | 
|
140  | 
else  | 
|
141  | 
ISABELLE_FONTS="$ISABELLE_FONTS:$X"  | 
|
142  | 
fi  | 
|
143  | 
done  | 
|
144  | 
export ISABELLE_FONTS  | 
|
145  | 
}  | 
|
146  | 
export -f isabelle_fonts  | 
|
147  | 
||
| 69374 | 148  | 
function isabelle_fonts_hidden ()  | 
149  | 
{
 | 
|
150  | 
local X=""  | 
|
151  | 
for X in "$@"  | 
|
152  | 
do  | 
|
153  | 
if [ -z "$ISABELLE_FONTS_HIDDEN" ]; then  | 
|
154  | 
ISABELLE_FONTS_HIDDEN="$X"  | 
|
155  | 
else  | 
|
156  | 
ISABELLE_FONTS_HIDDEN="$ISABELLE_FONTS_HIDDEN:$X"  | 
|
157  | 
fi  | 
|
158  | 
done  | 
|
159  | 
export ISABELLE_FONTS_HIDDEN  | 
|
160  | 
}  | 
|
161  | 
export -f isabelle_fonts_hidden  | 
|
162  | 
||
| 71733 | 163  | 
#Isabelle/Scala services  | 
164  | 
function isabelle_scala_service ()  | 
|
| 
69255
 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 
wenzelm 
parents: 
69157 
diff
changeset
 | 
165  | 
{
 | 
| 
 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 
wenzelm 
parents: 
69157 
diff
changeset
 | 
166  | 
local X=""  | 
| 
 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 
wenzelm 
parents: 
69157 
diff
changeset
 | 
167  | 
for X in "$@"  | 
| 
 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 
wenzelm 
parents: 
69157 
diff
changeset
 | 
168  | 
do  | 
| 71733 | 169  | 
if [ -z "$ISABELLE_SCALA_SERVICES" ]; then  | 
170  | 
ISABELLE_SCALA_SERVICES="$X"  | 
|
| 
69255
 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 
wenzelm 
parents: 
69157 
diff
changeset
 | 
171  | 
else  | 
| 71733 | 172  | 
ISABELLE_SCALA_SERVICES="$ISABELLE_SCALA_SERVICES:$X"  | 
| 
69255
 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 
wenzelm 
parents: 
69157 
diff
changeset
 | 
173  | 
fi  | 
| 
 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 
wenzelm 
parents: 
69157 
diff
changeset
 | 
174  | 
done  | 
| 71733 | 175  | 
export ISABELLE_SCALA_SERVICES  | 
| 
69255
 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 
wenzelm 
parents: 
69157 
diff
changeset
 | 
176  | 
}  | 
| 71733 | 177  | 
export -f isabelle_scala_service  | 
| 
69255
 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 
wenzelm 
parents: 
69157 
diff
changeset
 | 
178  | 
|
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
179  | 
#administrative build  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
180  | 
if [ -e "$ISABELLE_HOME/Admin/build" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
181  | 
function isabelle_admin_build ()  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
182  | 
  {
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
183  | 
"$ISABELLE_HOME/Admin/build" "$@"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
184  | 
}  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
185  | 
else  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
186  | 
  function isabelle_admin_build () { return 0; }
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
187  | 
fi  | 
| 62413 | 188  | 
export -f isabelle_admin_build  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
189  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
190  | 
#arrays  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
191  | 
function splitarray ()  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
192  | 
{
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
193  | 
SPLITARRAY=()  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
194  | 
local IFS="$1"; shift  | 
| 
66667
 
2e580fcf6522
avoid local shell variables intruding the resulting environment (via "set -o allexport" in getsettings);
 
wenzelm 
parents: 
63994 
diff
changeset
 | 
195  | 
local X=""  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
196  | 
for X in $*  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
197  | 
do  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
198  | 
    SPLITARRAY["${#SPLITARRAY[@]}"]="$X"
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
199  | 
done  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
200  | 
}  | 
| 62413 | 201  | 
export -f splitarray  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
202  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
203  | 
#init component tree  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
204  | 
function init_component ()  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
205  | 
{
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
206  | 
local COMPONENT="$1"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
207  | 
case "$COMPONENT" in  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
208  | 
/*) ;;  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
209  | 
*)  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
210  | 
echo >&2 "Absolute component path required: \"$COMPONENT\""  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
211  | 
exit 2  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
212  | 
;;  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
213  | 
esac  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
214  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
215  | 
if [ -d "$COMPONENT" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
216  | 
if [ -z "$ISABELLE_COMPONENTS" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
217  | 
ISABELLE_COMPONENTS="$COMPONENT"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
218  | 
else  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
219  | 
ISABELLE_COMPONENTS="$ISABELLE_COMPONENTS:$COMPONENT"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
220  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
221  | 
else  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
222  | 
echo >&2 "### Missing Isabelle component: \"$COMPONENT\""  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
223  | 
if [ -z "$ISABELLE_COMPONENTS_MISSING" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
224  | 
ISABELLE_COMPONENTS_MISSING="$COMPONENT"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
225  | 
else  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
226  | 
ISABELLE_COMPONENTS_MISSING="$ISABELLE_COMPONENTS_MISSING:$COMPONENT"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
227  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
228  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
229  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
230  | 
if [ -f "$COMPONENT/etc/settings" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
231  | 
source "$COMPONENT/etc/settings"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
232  | 
local RC="$?"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
233  | 
if [ "$RC" -ne 0 ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
234  | 
echo >&2 "Return code $RC from bash script: \"$COMPONENT/etc/settings\""  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
235  | 
exit 2  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
236  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
237  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
238  | 
if [ -f "$COMPONENT/etc/components" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
239  | 
init_components "$COMPONENT" "$COMPONENT/etc/components"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
240  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
241  | 
}  | 
| 62413 | 242  | 
export -f init_component  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
243  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
244  | 
#init component forest  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
245  | 
function init_components ()  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
246  | 
{
 | 
| 
66667
 
2e580fcf6522
avoid local shell variables intruding the resulting environment (via "set -o allexport" in getsettings);
 
wenzelm 
parents: 
63994 
diff
changeset
 | 
247  | 
local REPLY=""  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
248  | 
local BASE="$1"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
249  | 
local CATALOG="$2"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
250  | 
local COMPONENT=""  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
251  | 
local -a COMPONENTS=()  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
252  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
253  | 
if [ ! -f "$CATALOG" ]; then  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
254  | 
echo >&2 "Bad component catalog file: \"$CATALOG\""  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
255  | 
exit 2  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
256  | 
fi  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
257  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
258  | 
  {
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
259  | 
    while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; }
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
260  | 
do  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
261  | 
case "$REPLY" in  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
262  | 
\#* | "") ;;  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
263  | 
        /*) COMPONENTS["${#COMPONENTS[@]}"]="$REPLY" ;;
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
264  | 
        *) COMPONENTS["${#COMPONENTS[@]}"]="$BASE/$REPLY" ;;
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
265  | 
esac  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
266  | 
done  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
267  | 
} < "$CATALOG"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
268  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
269  | 
  for COMPONENT in "${COMPONENTS[@]}"
 | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
270  | 
do  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
271  | 
init_component "$COMPONENT"  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
272  | 
done  | 
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
273  | 
}  | 
| 62413 | 274  | 
export -f init_components  | 
| 
62412
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
275  | 
|
| 
 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 
wenzelm 
parents:  
diff
changeset
 | 
276  | 
fi  |