diff --git a/.repo/pkgver/firefox-nightly-en-gb.sh b/.repo/pkgver/firefox-nightly-en-gb.sh new file mode 100755 index 0000000..d65a857 --- /dev/null +++ b/.repo/pkgver/firefox-nightly-en-gb.sh @@ -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 diff --git a/.repo/pkgver/html-xml-utils.sh b/.repo/pkgver/html-xml-utils.sh new file mode 100755 index 0000000..323705d --- /dev/null +++ b/.repo/pkgver/html-xml-utils.sh @@ -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 diff --git a/.repo/pkgver/samhain.sh b/.repo/pkgver/samhain.sh new file mode 100755 index 0000000..a74ffd2 --- /dev/null +++ b/.repo/pkgver/samhain.sh @@ -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 diff --git a/.repo/pkgver/sendmail.sh b/.repo/pkgver/sendmail.sh new file mode 100755 index 0000000..9078be8 --- /dev/null +++ b/.repo/pkgver/sendmail.sh @@ -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