Fix script

This commit is contained in:
Alfred Gedeon 2020-09-16 15:10:14 -07:00
parent d0890be528
commit 7c141b4cb4
2 changed files with 19 additions and 8 deletions

View file

@ -21,5 +21,4 @@ jobs:
path: ./kernel path: ./kernel
- name: URL Checker - name: URL Checker
run: | run: |
pwd sh kernel/.github/workflows/url_verifier.sh kernel
sh kernel/.github/workflows/url_verifier.sh

View file

@ -5,15 +5,15 @@ echo "Verifying url links of: ${PROJECT}"
if [ ! -d "$PROJECT" ] if [ ! -d "$PROJECT" ]
then then
echo "Directory passed does not exist" echo "Directory passed does not exist"
exit exit(1)
fi fi
SCRIPT_RET=0
set -o nounset # Treat unset variables as an error set -o nounset # Treat unset variables as an error
declare -A dict declare -A dict
dict+=(["test-2e"]="/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP-Demo/lwIP_Apps/apps/httpserver_raw_from_lwIP_download/makefsdata/makefsdata.exe")
function test { function test {
while IFS= read -r LINE; do while IFS= read -r LINE; do
FILE=$(echo $LINE | cut -f 1 -d ':') FILE=$(echo $LINE | cut -f 1 -d ':')
@ -30,17 +30,29 @@ function test {
CURL_RES=$(curl -I ${UNIQ_URL} 2>/dev/null| head -n 1 | cut -f 2 -d ' ') CURL_RES=$(curl -I ${UNIQ_URL} 2>/dev/null| head -n 1 | cut -f 2 -d ' ')
RES=$? RES=$?
if [ "${CURL_RES}" == '' -o "${CURL_RES}" != '200' ]; if [ "${CURL_RES}" == '' -o "${CURL_RES}" != '200' ]
then then
echo "URL is: ${UNIQ_URL}" echo "URL is: ${UNIQ_URL}"
echo "File names: ${dict[$UNIQ_URL]}" echo "File names: ${dict[$UNIQ_URL]}"
if [ "${CURL_RES}" == '' ] if [ "${CURL_RES}" == '' ] # curl returned an error
then CURL_RES=$RES then
CURL_RES=$RES
SCRIPT_RET=1
elif [ "${CURL_RES}" == '403' ]
then
fi fi
echo Result is: "${CURL_RES}" echo Result is: "${CURL_RES}"
echo "=================================" echo "================================="
fi fi
done done
if [ ${RES} -ne 0 ]
then
exit(1)
else
exit(0)
fi
} }
test test