From 6d5c8f24a924f4c90f1266f964b97f65072fe613 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Tue, 13 Feb 2018 13:14:17 -0500 Subject: add fsd search script --- .gitignore | 1 + find_fsd_pages.sh | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 find_fsd_pages.sh diff --git a/.gitignore b/.gitignore index 262a5fb..5b3426b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ !blacklist.txt !check.sh !COPYING +!find_fsd_pages.sh !find-replacements !post_fsd_wiki.phantomjs !README diff --git a/find_fsd_pages.sh b/find_fsd_pages.sh new file mode 100755 index 0000000..31a9641 --- /dev/null +++ b/find_fsd_pages.sh @@ -0,0 +1,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 -- cgit v1.2.2