blob: 31a964198034a846a541ce83a5c3f9028bc94fe6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/bin/bash
readonly WIKI_BASE_URL=https://directory.fsf.org/wiki
readonly BLACKLIST_URL=https://git.parabola.nu/blacklist.git/plain
readonly BLACKLIST_FILE=blacklist.txt
wget $BLACKLIST_URL/$BLACKLIST_FILE
[ ! -f ./$BLACKLIST_FILE ] && echo "download failed" && exit 1
readonly PACKAGES=$(grep '^\s*[^:#]*:.*' ./$BLACKLIST_FILE | \
sed 's/^\s*\([^:#]*\):.*/\1/ ; s/^./\U&/g ; s/-./\U&/g ; s/-/_/g')
for package in $PACKAGES
do status=$(curl -s -o /dev/null -w "%{http_code}" $WIKI_BASE_URL/$package)
if [ "$status" == '200' ]
then echo "$package entry exists"
elif [ "$status" == '404' -o "$status" == '301' ]
then echo "$package entry not found"
else echo "$package unknown response"
fi
done
|