more robust way to load user-defined variables

Tested on a MiSTer
This commit is contained in:
Frédéric Mahé
2019-02-16 10:45:50 +01:00
committed by GitHub
parent 5720fac0a5
commit a0daeb0e16

View File

@@ -43,7 +43,13 @@ ORIGINAL_SCRIPT_PATH="${0}"
# ini file can contain user defined variables (as bash commands)
# Load and execute the content of the ini file, if there is one
INI_PATH="${ORIGINAL_SCRIPT_PATH%.*}.ini"
[[ -f "${INI_PATH}" ]] && source <(dos2unix < "${INI_PATH}")
if [[ -f "${INI_PATH}" ]] ; then
TMP=$(mktemp)
# preventively eliminate exit command and DOS-specific format
grep -v "^exit" "${INI_PATH}" | dos2unix > ${TMP} 2> /dev/null
source ${TMP}
rm -f ${TMP}
fi
# test network and https by pinging the most available website
SSL_SECURITY_OPTION=""