File indexing completed on 2024-04-21 05:08:04

0001 #!/bin/bash
0002 #
0003 # SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
0004 #
0005 # SPDX-License-Identifier: MIT
0006 
0007 function validate_url()
0008 {
0009     local recipe=$1
0010     local url=$2
0011 
0012     local schema=$(echo $url | cut -c 1-6)
0013     if [ $schema != "https:" ]; then
0014         echo "Warning: $url in $recipe is not using SSL."
0015     fi
0016 
0017     curl --silent --fail $url > /dev/null
0018     if [ $? -ne 0 ]; then
0019         echo "ERROR: $url cannot be received."
0020     fi
0021 }
0022 
0023 for r in $(find -name *.inc -o -name *.bb); do
0024     if ! [ -z "$(egrep '/usr|/etc' $r)" ]; then
0025         echo "ERROR: $r uses hard-coded paths."
0026     fi
0027 
0028     url=$(cat $r | grep HOMEPAGE | sed -e 's,HOMEPAGE\s?\?=\s"\(.*\)",\1,')
0029     if ! [ -z "$url" ]; then
0030         validate_url "$r" "$url"
0031     fi
0032 done