office-gobmx/bin/get_config_variables
Jan-Marek Glogowski 0bbc213229 cross-compile: fix PATH handling for host
Reading and exporting the PATH variable will result in a bunch of
error, so we have to work with full patch when using the grep and
sed commands. Since we just want the PATH for the rest of the host
config run, we can simply restore it.

Change-Id: I970f3bddece01c1f20ab9db7d55569e5df190675
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102476
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2020-09-11 18:24:13 +02:00

29 lines
638 B
Bash

#!/bin/sh
#set -x
glv_var="$1"
glv_config="config_host.mk"
if [ "$glv_var" = "--build" ] ; then
glv_config="config_build.mk"
shift
elif [ "$glv_var" = "--host" ] ; then
shift
fi
# full path, in case we export a "wrong" PATH
test -n "$GREP" && glv_grep="$GREP" || glv_grep=$(command -v grep)
test -n "$SED" && glv_sed="$SED" || glv_sed=$(command -v sed)
while [ -n "$1" ] ; do
glv_var="$1"
shift
glv_value=$("${glv_grep}" "^ *export ${glv_var}=" ${glv_config} | "${glv_sed}" -e 's/[^=]*=//')
export ${glv_var}="${glv_value}"
done
unset glv_var
unset glv_value
unset glv_config
unset glv_sed
unset glv_grep