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
This commit is contained in:
parent
97e8dc5e20
commit
a082d38b97
@ -6,6 +6,9 @@
|
|||||||
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
|
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
|
||||||
cd "$(dirname "$REAL_PATH")/.."
|
cd "$(dirname "$REAL_PATH")/.."
|
||||||
|
|
||||||
|
# Make sure sort produces the same output on all systems
|
||||||
|
export LC_ALL=C
|
||||||
|
|
||||||
DOC=docs/minimal-environment-vars.md
|
DOC=docs/minimal-environment-vars.md
|
||||||
DOCKERDIR="docker"
|
DOCKERDIR="docker"
|
||||||
# BASE and TYPE can be hard coded to centos and rdo since the required vars will always be the same
|
# 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)
|
scripts=$(find ${img_location} -name *.sh | sort -t / -k 4)
|
||||||
|
|
||||||
for script in $scripts; do
|
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')
|
vars=$(echo "$vars" | sed 's/check_required_vars//' | sed 's/\\//g')
|
||||||
|
|
||||||
if [ ! -z "$vars" ]; then
|
if [ ! -z "$vars" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user