Skip to content
Snippets Groups Projects
Commit b68f2da0 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

TEST: shellcheck

parent 3b153124
No related branches found
No related tags found
No related merge requests found
...@@ -53,14 +53,14 @@ mkdir -p "${DOWNLOAD_DIR}" ...@@ -53,14 +53,14 @@ mkdir -p "${DOWNLOAD_DIR}"
cd "${DOWNLOAD_DIR}" || echo "cannot cd to DOWNLOAD_DIR" cd "${DOWNLOAD_DIR}" || echo "cannot cd to DOWNLOAD_DIR"
echo "Downloading files to ${DOWNLOAD_DIR}/" echo "Downloading files to ${DOWNLOAD_DIR}/"
for cmake in ${CMAKE_FILES}; do for cmake in ${CMAKE_FILES}; do
download_links=$(grep -h -E '^[^#]*\"(ftp|http|https)://.*(\.tar\.gz|\.tar\.bz2|\.tgz|\.tar\.xz|\.zip|export=download).*\"' ${cmake} | download_links=$(grep -h -E '^[^#]*\"(ftp|http|https)://.*(\.tar\.gz|\.tar\.bz2|\.tgz|\.tar\.xz|\.zip|export=download).*\"' "${cmake}" |
grep -o -E '(ftp|http|https)://[^\"]*' | sort | uniq) grep -o -E '(ftp|http|https)://[^\"]*' | sort | uniq)
for url in ${download_links}; do for url in ${download_links}; do
file_name=$(echo "${url}" | grep -o -E '[^\/]+$') file_name=$(echo "${url}" | grep -o -E '[^\/]+$')
if [ -z "$file_name" ]; then if [ -z "$file_name" ]; then
echo "invalid filename for url=${url}" && exit 1; echo "invalid filename for url=${url}" && exit 1;
fi fi
download_name=$(grep -E -A 3 -B 3 "(ftp|http|https).+$file_name" ${cmake} | grep -E -o 'DOWNLOAD_NAME .+' | cut -d ' ' -f 2-) download_name=$(grep -E -A 3 -B 3 "(ftp|http|https).+$file_name" "${cmake}" | grep -E -o 'DOWNLOAD_NAME .+' | cut -d ' ' -f 2-)
$WGET -N "${url}" $WGET -N "${url}"
ret="$?" ret="$?"
if [ $ret -gt 0 ] && [ $ret -ne 8 ]; then if [ $ret -gt 0 ] && [ $ret -ne 8 ]; then
...@@ -68,7 +68,7 @@ for cmake in ${CMAKE_FILES}; do ...@@ -68,7 +68,7 @@ for cmake in ${CMAKE_FILES}; do
exit 1; exit 1;
fi fi
if [ -n "$download_name" ]; then if [ -n "$download_name" ]; then
mv $file_name $download_name mv "${file_name}" "${download_name}"
file_name=$download_name file_name=$download_name
fi fi
DOWNLOAD_NAMES="${DOWNLOAD_NAMES} ${file_name}" DOWNLOAD_NAMES="${DOWNLOAD_NAMES} ${file_name}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment