Ask for the VARA and Winlink zips when winlink.org won't serve them

downloads.winlink.org now puts a Cloudflare browser check in front of
every page, so the installers' download fails with a 403 and updates
ended with an error (report CD-NTEU79). Look for the zip in the user's
Downloads folder first, and if it isn't there and the site refuses,
list which zips to download and from where instead of failing the
update. A zip that won't extract or an installer that doesn't finish
is still an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Young
2026-11-09 09:06:01 -07:00
co-authored by Claude Opus 5.5
parent 354a4cbe03
commit bb5c7900d5
3 changed files with 104 additions and 17 deletions
+4
View File
@@ -49,6 +49,10 @@ Applications are pinned to tested versions, which we try to keep up with. Pinned
**Others:** not1mm (contest logger, installed with `uv`), and VARA HF, VARA FM, VARA Terminal and Winlink Express under Wine. The Windows installers need you to click through them, so they run only when one of these is missing and you're at the desktop. **Others:** not1mm (contest logger, installed with `uv`), and VARA HF, VARA FM, VARA Terminal and Winlink Express under Wine. The Windows installers need you to click through them, so they run only when one of these is missing and you're at the desktop.
### Downloading the VARA and Winlink installers yourself
winlink.org only lets web browsers download its programs, so HamPack can't fetch VARA HF, VARA FM, VARA Terminal or Winlink Express itself. When one is missing, the update says which zips to get and from where. Download them in your browser, leave them in your Downloads folder, and update again: HamPack installs them from there.
### Graywolf's web UI ### Graywolf's web UI
Graywolf's web UI is at http://localhost:8080 and, by default, can only be reached from the machine it runs on. To reach it from other machines, run `sudo systemctl edit graywolf` and override `ExecStart` with `-http 0.0.0.0:8080`. Changes made that way survive HamPack updates; edits to `/etc/systemd/system/graywolf.service` itself don't. Graywolf's web UI is at http://localhost:8080 and, by default, can only be reached from the machine it runs on. To reach it from other machines, run `sudo systemctl edit graywolf` and override `ExecStart` with `-http 0.0.0.0:8080`. Changes made that way survive HamPack updates; edits to `/etc/systemd/system/graywolf.service` itself don't.
+58 -15
View File
@@ -3,6 +3,7 @@
# Purpose : Install VARA HF, VARA FM, VARA Terminal and Winlink Express from # Purpose : Install VARA HF, VARA FM, VARA Terminal and Winlink Express from
# winlink.org under Wine. Products already installed are left alone, # winlink.org under Wine. Products already installed are left alone,
# so on most updates this downloads nothing and opens no windows. # so on most updates this downloads nothing and opens no windows.
# Zips the user downloaded to their downloads folder are used first.
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lib.sh" source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lib.sh"
@@ -17,26 +18,48 @@ PRODUCTS=(
"Winlink Express|$WINE_C/RMS Express/RMS Express.exe|User%20Programs|Winlink_Express_install|Winlink_Express_install*.exe" "Winlink Express|$WINE_C/RMS Express/RMS Express.exe|User%20Programs|Winlink_Express_install|Winlink_Express_install*.exe"
) )
# Download a product's zip from its winlink.org page and extract it to DIR # Where the user's browser saves downloads. xdg-user-dir answers $HOME when
download_product() { # there's no Downloads folder set
local name="$1" page="$2" pattern="$3" dir="$4" downloads_dir() {
local listing href filename local dir
dir="$(xdg-user-dir DOWNLOAD 2> /dev/null)"
[ -n "$dir" ] && [ "$dir" != "$HOME" ] || dir="$HOME/Downloads"
echo "$dir"
}
listing="$(curl -fsSL "$BASE_URL/$page/")" || { echo "Error: could not fetch $BASE_URL/$page/"; return 1; } # The newest zip in the downloads folder whose name matches PATTERN. Spaces in
# PATTERN are written %20, as on winlink.org; browsers save them as spaces, or
# sometimes as underscores.
find_downloaded_zip() {
local pattern="${1//%20/[ _]}"
find "$(downloads_dir)" -maxdepth 1 -type f -iname "*$pattern*.zip" -printf '%T@ %p\n' 2> /dev/null |
sort -rn | head -n1 | cut -d' ' -f2-
}
# Get a product's zip and extract it to DIR: from the downloads folder if the
# user downloaded it there, otherwise from its winlink.org page. winlink.org puts
# a browser check in front of its downloads, which scripts can't pass, so while
# that's in place the download fails; that returns 2, so the caller can ask the
# user to download the zip themselves.
get_product() {
local page="$1" pattern="$2" dir="$3"
local zip listing href
zip="$(find_downloaded_zip "$pattern")"
if [ -n "$zip" ]; then
echo "Using $zip"
else
listing="$(curl -fsSL "$BASE_URL/$page/" 2> /dev/null)" || return 2
href="$(grep -oP 'HREF="\K[^"]+' <<< "$listing" | grep -i "$pattern" | grep -i '\.zip$' | head -n1)" href="$(grep -oP 'HREF="\K[^"]+' <<< "$listing" | grep -i "$pattern" | grep -i '\.zip$' | head -n1)"
if [ -z "$href" ]; then [ -n "$href" ] || return 2
echo "Error: could not find $name on $BASE_URL/$page/" echo "Downloading $(sed 's|.*/||; s|%20| |g' <<< "$href")..."
return 1 zip="$HAMPACK_TMP/download.zip"
curl -fsSL "$BASE_URL$href" -o "$zip" 2> /dev/null || return 2
fi fi
filename="$(sed 's|.*/||; s|%20| |g' <<< "$href")"
echo "Downloading $filename..."
curl -fsSL "$BASE_URL$href" -o "$HAMPACK_TMP/download.zip" || { echo "Error: download of $filename failed."; return 1; }
rm -rf "$dir" rm -rf "$dir"
mkdir -p "$dir" mkdir -p "$dir"
unzip -q "$HAMPACK_TMP/download.zip" -d "$dir" || { echo "Error: extraction of $filename failed."; return 1; } unzip -q "$zip" -d "$dir" || { echo "Error: could not extract $zip"; return 1; }
rm -f "$HAMPACK_TMP/download.zip"
} }
# Wait for a Wine window to appear and raise it to the front # Wait for a Wine window to appear and raise it to the front
@@ -115,10 +138,17 @@ make_work_dir || exit 1
prepare_wine || exit 1 prepare_wine || exit 1
status=0 status=0
by_hand=()
for product in "${missing[@]}"; do for product in "${missing[@]}"; do
IFS='|' read -r name check page pattern glob <<< "$product" IFS='|' read -r name check page pattern glob <<< "$product"
dir="$HAMPACK_TMP/${name// /_}" dir="$HAMPACK_TMP/${name// /_}"
if download_product "$name" "$page" "$pattern" "$dir" && run_installer "$name" "$dir" "$glob" && [ -e "$check" ]; then get_product "$page" "$pattern" "$dir"
case $? in
0) ;;
2) by_hand+=("$name|$page"); continue ;;
*) echo "$name was not installed; it will be tried again on the next update."; status=1; continue ;;
esac
if run_installer "$name" "$dir" "$glob" && [ -e "$check" ]; then
echo "$name installed." echo "$name installed."
else else
echo "$name was not installed; it will be tried again on the next update." echo "$name was not installed; it will be tried again on the next update."
@@ -126,4 +156,17 @@ for product in "${missing[@]}"; do
fi fi
done done
# Not an error: nothing is wrong on this machine, the user just has to fetch
# these zips themselves
if [ ${#by_hand[@]} -gt 0 ]; then
echo ""
echo "winlink.org only lets web browsers download its programs, so please"
echo "download these zips in your browser:"
for entry in "${by_hand[@]}"; do
IFS='|' read -r name page <<< "$entry"
echo " $name, from $BASE_URL/$page/"
done
echo "Leave them in $(downloads_dir) and update again; HamPack installs them from there."
fi
exit $status exit $status
+41 -1
View File
@@ -8,6 +8,8 @@ setup() {
setup_fake_home setup_fake_home
fake_coredesktop fake_coredesktop
stub curl 'exit 1' stub curl 'exit 1'
# So xdg-user-dir reads the fake home's (absent) settings, not the real ones
export XDG_CONFIG_HOME="$HOME/.config"
} }
install_all_windows_apps() { install_all_windows_apps() {
@@ -30,10 +32,48 @@ install_all_windows_apps() {
export DISPLAY=:0 export DISPLAY=:0
run bash "$REPO/install-windows-apps.sh" run bash "$REPO/install-windows-apps.sh"
[[ "$output" == *"VARA HF is already installed"* ]] [[ "$output" == *"VARA HF is already installed"* ]]
[[ "$output" == *"VARA Terminal was not installed"* ]]
grep -q "^curl .*VARA%20Products" "$STUB_LOG" grep -q "^curl .*VARA%20Products" "$STUB_LOG"
} }
@test "windows apps: when winlink.org refuses the download, the user is asked to download it and the update isn't failed" {
install_all_windows_apps
rm "$HOME/.wine/drive_c/VARA/VARA Terminal.exe"
export DISPLAY=:0
run bash "$REPO/install-windows-apps.sh"
[ "$status" -eq 0 ]
[[ "$output" == *"VARA Terminal, from https://downloads.winlink.org/VARA%20Products/"* ]]
[[ "$output" == *"Leave them in $HOME/Downloads"* ]]
[[ "$output" != *"VARA HF, from"* ]]
! grep -q '^wine .*\.exe' "$STUB_LOG"
}
@test "windows apps: a zip in the downloads folder is installed without downloading" {
install_all_windows_apps
rm "$HOME/.wine/drive_c/VARA/VARA Terminal.exe"
mkdir -p "$HOME/Downloads" "$BATS_TEST_TMPDIR/zip"
touch "$BATS_TEST_TMPDIR/zip/VARA Terminal setup.exe"
(cd "$BATS_TEST_TMPDIR/zip" && zip -q "$HOME/Downloads/VARA Terminal v1.2.3 setup.zip" "VARA Terminal setup.exe")
stub wine 'case "$1" in *.exe) touch "$HOME/.wine/drive_c/VARA/VARA Terminal.exe" ;; esac'
export DISPLAY=:0
run bash "$REPO/install-windows-apps.sh"
[ "$status" -eq 0 ]
[[ "$output" == *"VARA Terminal installed."* ]]
grep -q '^wine .*VARA Terminal setup.exe' "$STUB_LOG"
! grep -q '^curl ' "$STUB_LOG"
}
@test "windows apps: a zip saved with underscores for spaces is found too" {
install_all_windows_apps
rm "$HOME/.wine/drive_c/VARA/VARA Terminal.exe"
mkdir -p "$HOME/Downloads"
echo "not a zip" > "$HOME/Downloads/VARA_Terminal_v1.2.3.zip"
export DISPLAY=:0
run bash "$REPO/install-windows-apps.sh"
[[ "$output" == *"Using $HOME/Downloads/VARA_Terminal_v1.2.3.zip"* ]]
[ "$status" -eq 1 ]
[[ "$output" == *"VARA Terminal was not installed"* ]]
}
@test "windows apps: without a desktop session, nothing is downloaded and the update isn't failed" { @test "windows apps: without a desktop session, nothing is downloaded and the update isn't failed" {
run bash "$REPO/install-windows-apps.sh" run bash "$REPO/install-windows-apps.sh"
[ "$status" -eq 0 ] [ "$status" -eq 0 ]