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
- name: URL Checker
run: |
pwd
sh kernel/.github/workflows/url_verifier.sh
sh kernel/.github/workflows/url_verifier.sh kernel

View file

@ -5,15 +5,15 @@ echo "Verifying url links of: ${PROJECT}"
if [ ! -d "$PROJECT" ]
then
echo "Directory passed does not exist"
exit
exit(1)
fi
SCRIPT_RET=0
set -o nounset # Treat unset variables as an error
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 {
while IFS= read -r LINE; do
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 ' ')
RES=$?
if [ "${CURL_RES}" == '' -o "${CURL_RES}" != '200' ];
if [ "${CURL_RES}" == '' -o "${CURL_RES}" != '200' ]
then
echo "URL is: ${UNIQ_URL}"
echo "File names: ${dict[$UNIQ_URL]}"
if [ "${CURL_RES}" == '' ]
then CURL_RES=$RES
if [ "${CURL_RES}" == '' ] # curl returned an error
then
CURL_RES=$RES
SCRIPT_RET=1
elif [ "${CURL_RES}" == '403' ]
then
fi
echo Result is: "${CURL_RES}"
echo "================================="
fi
done
if [ ${RES} -ne 0 ]
then
exit(1)
else
exit(0)
fi
}
test