diff --git a/.repo/nvchecker.toml b/.repo/nvchecker.toml index 661463b..3f1fa72 100644 --- a/.repo/nvchecker.toml +++ b/.repo/nvchecker.toml @@ -1293,6 +1293,10 @@ pypi = "pytest-check" #source = "cmd" #cmd = './.repo/pkgver/firefox-nightly-en-gb.sh' +[oil] +source = "cmd" +cmd = "./.repo/pkgver/oil.sh" + [enigma] source = "cmd" cmd = "./.repo/pkgver/enigma.sh" diff --git a/.repo/pkgver/oil.sh b/.repo/pkgver/oil.sh new file mode 100755 index 0000000..ee8654d --- /dev/null +++ b/.repo/pkgver/oil.sh @@ -0,0 +1,31 @@ +#!/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.oilshell.org/release/latest/" + + +# options to pass to cURL, including custom user agent +USER_AGENT="oil-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/^oil-//" -e "s/\.tar.gz$//" +exit 0