mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2025-12-31 19:47:25 +01:00
Fix wrong evaluation of env vars
This commit is contained in:
@@ -12,16 +12,9 @@ in_error() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this clunkiness here.
|
# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this "magic" here.
|
||||||
ie_gv() {
|
ie_gv() {
|
||||||
local line name value
|
eval "echo \$$1"
|
||||||
set | \
|
|
||||||
while read line; do
|
|
||||||
name=${line%=*} value=${line#*=\'}
|
|
||||||
if [ "$name" = "$1" ]; then
|
|
||||||
echo ${value%\'}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# usage: file_env VAR [DEFAULT]
|
# usage: file_env VAR [DEFAULT]
|
||||||
@@ -37,7 +30,7 @@ file_env() {
|
|||||||
in_error "Both $var and $fileVar are set (but are exclusive)"
|
in_error "Both $var and $fileVar are set (but are exclusive)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local val="$def"
|
local val="$def"
|
||||||
if [ "$(ie_gv ${var})" != "" ]; then
|
if [ "$(ie_gv ${var})" != "" ]; then
|
||||||
val=$(ie_gv ${var})
|
val=$(ie_gv ${var})
|
||||||
elif [ "$(ie_gv ${fileVar})" != "" ]; then
|
elif [ "$(ie_gv ${fileVar})" != "" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user