From 7c141b4cb461ec676788fd9a912a7c6c0d2e5ca8 Mon Sep 17 00:00:00 2001 From: Alfred Gedeon Date: Wed, 16 Sep 2020 15:10:14 -0700 Subject: [PATCH] Fix script --- .github/workflows/ci.yml | 3 +-- .github/workflows/url_verifier.sh | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a52062847..de79da251 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/url_verifier.sh b/.github/workflows/url_verifier.sh index 45788eb6d..864e6a1ae 100755 --- a/.github/workflows/url_verifier.sh +++ b/.github/workflows/url_verifier.sh @@ -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