mirror of
https://github.com/offa/android-foss.git
synced 2025-11-09 02:32:25 +05:30
Create check_manually.sh
This commit is contained in:
parent
f1a1841391
commit
06b949afe4
1 changed files with 51 additions and 0 deletions
51
check_manually.sh
Normal file
51
check_manually.sh
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
|
||||
SOURCE_FILE=README.md
|
||||
|
||||
LINKS=$(grep "http" "$SOURCE_FILE" \
|
||||
| grep -oP "http.*" \
|
||||
| sed "s|)$||" \
|
||||
| sed "s|) .*||" \
|
||||
| grep -v img.shields.io \
|
||||
| grep -v travis-ci.org)
|
||||
|
||||
mapfile -t LINKS <<< "$LINKS"
|
||||
|
||||
for link in "${LINKS[@]}"
|
||||
do
|
||||
echo "Testing $link"
|
||||
STATUS_CODE="$(curl -LI "$link" -o /dev/null -w '%{http_code}\n' -s)"
|
||||
if [[ "$STATUS_CODE" != "200" ]]
|
||||
then
|
||||
FALSE_LINKS+=("$link")
|
||||
fi
|
||||
done
|
||||
|
||||
FDROID_LINKS=$(grep -oP "https://f-droid.*" "$SOURCE_FILE" \
|
||||
| sed "s|)].*||" \
|
||||
| grep -v "https://f-droid.org/)")
|
||||
|
||||
mapfile -t FDROID_LINKS <<< "$FDROID_LINKS"
|
||||
|
||||
for link in "${FDROID_LINKS[@]}"
|
||||
do
|
||||
echo "Testing $link"
|
||||
STATUS_CODE="$(curl -LI "$link" -o /dev/null -w '%{http_code}\n' -s)"
|
||||
if [[ "$STATUS_CODE" != "200" ]]
|
||||
then
|
||||
FALSE_LINKS+=("$link")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${FALSE_LINKS[*]}" ]
|
||||
then
|
||||
clear
|
||||
echo "Some links weren't reachable."
|
||||
for link in "${FALSE_LINKS[@]}"
|
||||
do
|
||||
echo "$link"
|
||||
done
|
||||
exit 1
|
||||
else
|
||||
echo "No false link was found"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue