nvchecker: add external scripts

Something is wrong with .gitignore, these scripts were not being added
previously.

*shoots .gitignore*
This commit is contained in:
George Rawlinson 2021-07-24 12:58:02 +00:00
parent 8e3d6950c2
commit db2ecb84e0
Signed by: grawlinson
GPG key ID: E0959FEA8B550539
4 changed files with 135 additions and 0 deletions

View file

@ -0,0 +1,45 @@
#!/bin/bash
set -e
# check dependencies
count=0
for dependency in grep cut sort tail 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
# options to pass to cURL, including custom user agent
USER_AGENT="nightly-version-checker/1.0 george@rawlinson.net.nz"
CURL_OPTS=(--silent --user-agent "$USER_AGENT")
# package variables
_name=firefox
_channel=nightly
_lang="en-GB"
CARCH=x86_64
_base_url="https://ftp.mozilla.org/pub/${_name}/${_channel}"
_version=$(curl "${CURL_OPTS[@]}" ${_base_url}/latest-mozilla-central-l10n/ | grep "${_lang}.linux-${CARCH}.checksums" | sort | tail -n 1 | sed "s/^.*>firefox-//; s/\.${_lang}.*//")
_build_id_raw="$(curl "${CURL_OPTS[@]}" "${_base_url}/latest-mozilla-central-l10n/${_name}-${_version}.${_lang}.linux-${CARCH}.checksums" | grep '.partial.mar' | cut -d' ' -f4 | grep -E -o '[[:digit:]]{14}' | sort | tail -n1)"
declare -A _build_id
_build_id=(
[year]="${_build_id_raw:0:4}"
[month]="${_build_id_raw:4:2}"
[day]="${_build_id_raw:6:2}"
[hour]="${_build_id_raw:8:2}"
[min]="${_build_id_raw:10:2}"
[sec]="${_build_id_raw:12:2}"
[date]="${_build_id_raw:0:8}"
[time]="${_build_id_raw:8:6}"
)
echo "${_version}.${_build_id[date]}.${_build_id[time]}"
exit 0

33
.repo/pkgver/html-xml-utils.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
set -e
# check dependencies
count=0
for dependency in hxnormalize hxselect grep sed sort tail; 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.w3.org/Tools/HTML-XML-utils/"
# options to pass to cURL, including custom user agent
USER_AGENT="hxu-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 "html-xml-utils" | \
sed -e "s/html-xml-utils-//g" -e "s/.tar.gz//g" | \
sort -n | \
tail -n 1
exit 0

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

@ -0,0 +1,30 @@
#!/bin/bash
set -e
# check dependencies
count=0
for dependency in hxnormalize hxselect grep sed sort tail; 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.la-samhna.de/samhain/s_download.html"
# options to pass to cURL, including custom user agent
USER_AGENT="samhain-version-checker/1.0 george@rawlinson.net.nz"
CURL_OPTS=(--silent --user-agent "$USER_AGENT")
curl "${CURL_OPTS[@]}" "$UPSTREAM_URL" | \
hxnormalize -x | \
hxselect -c 'div.table-wrapper ' 'td' | \
head -n 1 | \
sed -e "s/Version //" -e "s/<.*//"
exit 0

27
.repo/pkgver/sendmail.sh Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/bash
set -e
# check dependencies
count=0
for dependency in curl tr cut grep sed sort tail; 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="ftp://ftp.sendmail.org/pub/sendmail/"
# options to pass to cURL, including custom user agent
USER_AGENT="sendmail-version-checker/1.0 george@rawlinson.net.nz"
CURL_OPTS=(--ftp-pasv --silent --user-agent "$USER_AGENT")
curl "${CURL_OPTS[@]}" "$UPSTREAM_URL" | tr -s ' ' | cut -d ' ' -f 9 | grep -E "sendmail\..+\.tar\.gz\.sig$" | sed -e 's/^sendmail\.//' -e 's/\.tar\.gz\.sig$//' | sort -n | tail -n 1
exit 0