aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin André <martin.andre@kvhasia.com>2015-07-02 10:26:20 +0900
committerMartin André <martin.andre@kvhasia.com>2015-07-05 08:48:41 +0900
commita082d38b97bef781c116e0520397f9d049737e0a (patch)
treeb8545e0aa2b2e3482d2824c266d759f586a6ae67
parent97e8dc5e2037d0d4715c7c2c7fdcceb9aef39faa (diff)
downloadkolla-a082d38b97bef781c116e0520397f9d049737e0a.tar.gz
kolla-a082d38b97bef781c116e0520397f9d049737e0a.zip
Make tools/min-env.sh portable
We had different issues here. First, sort command used to sort variables and services names is dependent on the local, so fix it to C to have consistent results. C local is available on all systems. Second, awk doesn't recognize \s escape char for space on OSX. This resulted in indented check_required_vars calls being ignored. In fact, all variables checked via indented check_required_vars calls (i.e. in a fuction or conditional block) are actually *optional* variables, so I changed the behavior to ignore those. Change-Id: I6fc4cca9567cb712609d0fe0a20dfe21ed6df151 Closes-Bug: #1470683
-rwxr-xr-xtools/min-env.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/min-env.sh b/tools/min-env.sh
index 403a43c34..f5fecec45 100755
--- a/tools/min-env.sh
+++ b/tools/min-env.sh
@@ -6,6 +6,9 @@
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
cd "$(dirname "$REAL_PATH")/.."
+# Make sure sort produces the same output on all systems
+export LC_ALL=C
+
DOC=docs/minimal-environment-vars.md
DOCKERDIR="docker"
# BASE and TYPE can be hard coded to centos and rdo since the required vars will always be the same
@@ -35,7 +38,7 @@ function find_vars {
scripts=$(find ${img_location} -name *.sh | sort -t / -k 4)
for script in $scripts; do
- local vars=$(awk '/^\s*check_required_vars/,/([^\\]\s*$)/' $script)
+ local vars=$(awk '/^check_required_vars/,/([^\\] *$)/' $script)
vars=$(echo "$vars" | sed 's/check_required_vars//' | sed 's/\\//g')
if [ ! -z "$vars" ]; then