From a0daeb0e1691c266bd62722923a5afff1973ff70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mah=C3=A9?= Date: Sat, 16 Feb 2019 10:45:50 +0100 Subject: [PATCH] more robust way to load user-defined variables Tested on a MiSTer --- update.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 293faf7..764e8f5 100644 --- a/update.sh +++ b/update.sh @@ -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=""