Good call, I can easily parse that and take the latest to say, new release available when I log in.
curl https://download.freebsd.org/releases/amd64/
awk '{print $3}'
/releases/amd64/</title>
/releases/amd64/</h1>
style="width:55%"><a
href="../">Parent
href="13.3-RELEASE/"
href="13.4-BETA1/"
href="13.4-BETA2/"
href="14.0-RELEASE/"
href="14.1-RELEASE/"
href="amd64/"
href="README.TXT"
[…] I can easily parse that and take the latest to say, […]
# As of 2024‑08‑13 this yields an HTTP status code 404 (resource not found).
# `fetch(1)` returns an exit status `1` (`EXIT_FAILURE`) in this case.
if fetch -o - -q 'https://download.freebsd.org/releases/amd64/14.2-RELEASE' 2>&- 1>&-
then
printf 'new release available\n'
fi
15.0
). ??fetch -o - -q 'http://www.wikidata.org/w/api.php?action=wbgetclaims&format=json&entity=Q34236&property=P348'
cd ~
git init test
cd test
git remote add origin https://git.freebsd.org/src.git
git remote show origin
% curl --silent https://pkg.freebsd.org/FreeBSD:14:amd64/ | grep base_release
<tr><td class="link"><a href="base_release_0/" title="base_release_0">base_release_0/</a></td><td class="size">-</td><td class="date">2024-Aug-08 00:06</td></tr>
<tr><td class="link"><a href="base_release_1/" title="base_release_1">base_release_1/</a></td><td class="size">-</td><td class="date">2024-Aug-08 00:06</td></tr>
%
#!/usr/local/bin/bash
platform=$(uname -p)
echo "platform: $platform"
if [ -z "$platform" ]; then
echo "unknown platform"
exit 1
fi
current_version=$(uname -r | grep -E -o '[[:digit:],\.]{4,}')
echo "version: $current_version"
if [ -z "$current_version" ]; then
echo "unknown version"
exit 2
fi
current_integer_version=$(echo "$current_version" | sed s/[.]//)
#echo "current integer version: $current_integer_version"
url="https://download.freebsd.org/releases/$platform/"
echo "url: $url"
lines=$(curl --silent $url)
if [ $? -ne 0 ]; then
echo "error downloading release page"
exit 3
fi
versions=$(echo $lines | grep -o -E '[[:digit:]]{2}\.[[:digit:]]{1}-[[:alpha:]]{4,}' | sort -u)
for version in $(echo "$versions"); do
integer_version=$(echo "$version" | sed s/[[:alpha:],.-]//g)
if [[ "$integer_version" -gt "$current_integer_version" ]]; then
echo "available version: $version"
fi;
done;
bash script
grahamperrin@pkg:/tmp % ./list-upgrades.sh
platform: amd64
version: 13.4
url: https://download.freebsd.org/releases/amd64/
available version: 14.0-RELEASE
available version: 14.1-RELEASE
grahamperrin@pkg:/tmp % uname -aKU
FreeBSD pkg 13.4-BETA2 FreeBSD 13.4-BETA2 releng/13.4-n258214-30b27afe3bc5 GENERIC amd64 1304000 1304000
grahamperrin@pkg:/tmp % su -
Password:
root@pkg:~ # freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 13.4-BETA2 from update1.freebsd.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.
No updates needed to update system to 13.4-BETA2-p0.
root@pkg:~ #
Thanks.
A nit: on 13.4-BETA2, it does not detect availability of 13.4-BETA3.
Code:grahamperrin@pkg:/tmp % ./list-upgrades.sh platform: amd64 version: 13.4 url: https://download.freebsd.org/releases/amd64/ available version: 14.0-RELEASE available version: 14.1-RELEASE grahamperrin@pkg:/tmp % uname -aKU FreeBSD pkg 13.4-BETA2 FreeBSD 13.4-BETA2 releng/13.4-n258214-30b27afe3bc5 GENERIC amd64 1304000 1304000 grahamperrin@pkg:/tmp % su - Password: root@pkg:~ # freebsd-update fetch Looking up update.FreeBSD.org mirrors... 3 mirrors found. Fetching metadata signature for 13.4-BETA2 from update1.freebsd.org... done. Fetching metadata index... done. Inspecting system... done. Preparing to download files... done. No updates needed to update system to 13.4-BETA2-p0. root@pkg:~ #
That is, coincidentally, an example of freebsd-update detecting but not reporting that a system is approaching end of life.