Browse code

XenAPI: workaround for unsupp. associative arrays

Dom0's bash does not support associative arrays, however we source
`functions` and therefore our scripts fail. This change breaks the
dependency of dom0 tools on domU functions.

Fixes bug: 1379804

Change-Id: I229e2d5f07070a9236ec612d4032c94c4361a9f6

Mate Lakat authored on 2014/10/17 20:14:49
Showing 5 changed files
... ...
@@ -21,19 +21,12 @@ set -o xtrace
21 21
 # This directory
22 22
 TOP_DIR=$(cd $(dirname "$0") && pwd)
23 23
 
24
-# Source lower level functions
25
-. $TOP_DIR/../../functions
26
-
27 24
 # Include onexit commands
28 25
 . $TOP_DIR/scripts/on_exit.sh
29 26
 
30 27
 # xapi functions
31 28
 . $TOP_DIR/functions
32 29
 
33
-# Determine what system we are running on.
34
-# Might not be XenServer if we're using xenserver-core
35
-GetDistro
36
-
37 30
 # Source params - override xenrc params in your localrc to suite your taste
38 31
 source xenrc
39 32
 
... ...
@@ -22,19 +22,12 @@ fi
22 22
 # This directory
23 23
 THIS_DIR=$(cd $(dirname "$0") && pwd)
24 24
 
25
-# Source lower level functions
26
-. $THIS_DIR/../../functions
27
-
28 25
 # Include onexit commands
29 26
 . $THIS_DIR/scripts/on_exit.sh
30 27
 
31 28
 # xapi functions
32 29
 . $THIS_DIR/functions
33 30
 
34
-# Determine what system we are running on.
35
-# Might not be XenServer if we're using xenserver-core
36
-GetDistro
37
-
38 31
 #
39 32
 # Get Settings
40 33
 #
... ...
@@ -22,19 +22,12 @@ set -o xtrace
22 22
 # This directory
23 23
 TOP_DIR=$(cd $(dirname "$0") && pwd)
24 24
 
25
-# Source lower level functions
26
-. $TOP_DIR/../../functions
27
-
28 25
 # Include onexit commands
29 26
 . $TOP_DIR/scripts/on_exit.sh
30 27
 
31 28
 # xapi functions
32 29
 . $TOP_DIR/functions
33 30
 
34
-# Determine what system we are running on.
35
-# Might not be XenServer if we're using xenserver-core
36
-GetDistro
37
-
38 31
 # Source params - override xenrc params in your localrc to suite your taste
39 32
 source xenrc
40 33
 
... ...
@@ -14,9 +14,6 @@ set -o xtrace
14 14
 # This directory
15 15
 BASE_DIR=$(cd $(dirname "$0") && pwd)
16 16
 
17
-# Source the top level functions
18
-source $BASE_DIR/../../../functions
19
-
20 17
 # For default setings see xenrc
21 18
 source $BASE_DIR/../xenrc
22 19
 
... ...
@@ -91,7 +91,24 @@ UBUNTU_INST_GATEWAY=""
91 91
 # Set the size to 0 to avoid creation of additional disk.
92 92
 XEN_XVDB_SIZE_GB=0
93 93
 
94
-restore_nounset=`set +o | grep nounset`
94
+STACK_USER=stack
95
+DOMZERO_USER=domzero
96
+
97
+RC_DIR="../.."
98
+
99
+restore_nounset=$(set +o | grep nounset)
95 100
 set +u
96
-source ../../stackrc
101
+
102
+## Note that the lines below are coming from stackrc to support
103
+## new-style config files
104
+
105
+# allow local overrides of env variables, including repo config
106
+if [[ -f $RC_DIR/localrc ]]; then
107
+    # Old-style user-supplied config
108
+    source $RC_DIR/localrc
109
+elif [[ -f $RC_DIR/.localrc.auto ]]; then
110
+    # New-style user-supplied config extracted from local.conf
111
+    source $RC_DIR/.localrc.auto
112
+fi
113
+
97 114
 $restore_nounset