nvchecker: add enigma

This commit is contained in:
George Rawlinson 2021-12-29 07:48:42 +00:00
parent 5f5f6035ac
commit a9423acacd
Signed by: grawlinson
GPG key ID: E0959FEA8B550539
2 changed files with 34 additions and 0 deletions

View file

@ -1265,6 +1265,10 @@ pypi = "pytest-check"
#source = "cmd"
#cmd = './.repo/pkgver/firefox-nightly-en-gb.sh'
[enigma]
source = "cmd"
cmd = "./.repo/pkgver/enigma.sh"
[samhain]
source = "cmd"
cmd = "./.repo/pkgver/samhain.sh"

30
.repo/pkgver/enigma.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash
set -e
# check dependencies
count=0
for dependency in curl hxnormalize hxselect grep sed; do
if [ ! -x "$(command -v $dependency)" ]; then
echo "$dependency missing"
count=$((count+1))
fi
done
# exit script if any dependencies missing
if [ $count -ne 0 ]; then
exit 1
fi
# upstream URL
UPSTREAM_URL="https://www.chiark.greenend.org.uk/~sgtatham/enigma/"
# options to pass to cURL, including custom user agent
USER_AGENT="enigma-version-checker/1.0 george@rawlinson.net.nz"
CURL_OPTS=(--silent --user-agent "$USER_AGENT")
curl "${CURL_OPTS[@]}" "$UPSTREAM_URL" | \
hxnormalize -x | \
hxselect -c 'a' -s '\n' | \
grep .tar.gz | \
sed -e "s/.*enigma-//" -e "s/\.tar.gz.*//"
exit 0