Updates - install-compiled.sh never prompts: unknown versions rebuild, a missing version= fails - Detect VARA Terminal by "VARA Terminal.exe" in drive_c/VARA, not by the folder VARA HF also uses - install-windows-apps.sh checks first: nothing is downloaded and winetricks doesn't run unless a product is missing, and installers only run with a desktop session - Flatpaks install system-wide from flathub and honor skip-packages - Rewrite desktop files on every run so icon paths stay right; add the missing QtTermTCP desktop file - Build steps can't read the rest of the conf through stdin Uninstall - update.sh records the packages and Flatpaks HamPack itself installed; hampackremove removes only those that nothing else needs, and lists the rest - Read package lists from packages.conf instead of copies, remove files from install manifests, conf install paths and older builds, and revert the Wine Decorated setting Security - Replace the NOPASSWD sudoers file with a sudo keepalive, and delete a leftover /etc/sudoers.d/hampack - Verify binaries.conf downloads against sha256=; pin dx.py to a commit - Graywolf's web UI listens on 127.0.0.1; update.sh manages its unit - Install direwolf and kiwix through a staging directory with install_staged, so nothing in ~/.local ends up owned by root; hand back any root-owned files left by older builds - Use private temp directories instead of fixed /tmp paths Code quality - Shared lib.sh: conf parser, variable expansion, version records, install tracking, staged installs, sudo keepalive - bats tests covering first install and update paths, Makefile with lint/test/hooks, pre-commit hook - patch-potacat.sh uses jq; drop stale kiwix version entries README: fill in what gets installed, uninstall and graywolf notes, development section, typo and Matrix link fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
129 lines
4.2 KiB
Bash
Executable File
129 lines
4.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Purpose : Install VARA HF, VARA FM, VARA Terminal and Winlink Express from
|
|
# winlink.org under Wine. Products already installed are left alone,
|
|
# so on most updates this downloads nothing and opens no windows.
|
|
|
|
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lib.sh"
|
|
|
|
BASE_URL="https://downloads.winlink.org"
|
|
WINE_C="${WINEPREFIX:-$HOME/.wine}/drive_c"
|
|
|
|
# Each product: name|program that shows it's installed|downloads page|zip name pattern|installer pattern
|
|
PRODUCTS=(
|
|
"VARA HF|$WINE_C/VARA/VARA.exe|VARA%20Products|VARA%20HF|VARA*.exe"
|
|
"VARA FM|$WINE_C/VARA FM/VARAFM.exe|VARA%20Products|VARA%20FM|VARA*.exe"
|
|
"VARA Terminal|$WINE_C/VARA/VARA Terminal.exe|VARA%20Products|VARA%20Terminal|VARA*.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
|
|
download_product() {
|
|
local name="$1" page="$2" pattern="$3" dir="$4"
|
|
local listing href filename
|
|
|
|
listing="$(curl -fsSL "$BASE_URL/$page/")" || { echo "Error: could not fetch $BASE_URL/$page/"; return 1; }
|
|
href="$(grep -oP 'HREF="\K[^"]+' <<< "$listing" | grep -i "$pattern" | grep -i '\.zip$' | head -n1)"
|
|
if [ -z "$href" ]; then
|
|
echo "Error: could not find $name on $BASE_URL/$page/"
|
|
return 1
|
|
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"
|
|
mkdir -p "$dir"
|
|
unzip -q "$HAMPACK_TMP/download.zip" -d "$dir" || { echo "Error: extraction of $filename failed."; return 1; }
|
|
rm -f "$HAMPACK_TMP/download.zip"
|
|
}
|
|
|
|
# Wait for a Wine window to appear and raise it to the front
|
|
raise_wine_window() {
|
|
local _
|
|
for _ in $(seq 1 20); do
|
|
sleep 1
|
|
xdotool search --class Wine windowfocus windowraise 2> /dev/null && return 0
|
|
done
|
|
}
|
|
|
|
# Run a product's installer and wait for the user to finish it
|
|
run_installer() {
|
|
local name="$1" dir="$2" glob="$3" exe
|
|
|
|
exe="$(find "$dir" -maxdepth 1 -iname "$glob" | head -n1)"
|
|
if [ -z "$exe" ]; then
|
|
echo "Error: no $glob found for $name."
|
|
return 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "=== Installing $name ==="
|
|
echo "Please complete the installation in the Wine window."
|
|
echo "This will continue once the installer is closed."
|
|
echo ""
|
|
|
|
wine "$exe" &
|
|
local wine_pid=$!
|
|
raise_wine_window &
|
|
wait "$wine_pid"
|
|
}
|
|
|
|
# Create the Wine prefix and install the runtimes VARA and Winlink need
|
|
prepare_wine() {
|
|
if [ ! -d "${WINEPREFIX:-$HOME/.wine}" ]; then
|
|
echo "Initializing Wine..."
|
|
wineboot --init || return 1
|
|
# hampackremove offers to remove a prefix HamPack made
|
|
touch "$HAMPACK_STATE/wine-prefix-created"
|
|
fi
|
|
|
|
if [ ! -f "$HAMPACK_STATE/wine-deps-installed" ]; then
|
|
echo "Installing Wine dependencies..."
|
|
winetricks -q vb6run pdh_nt4 sound=alsa || { echo "Error: winetricks failed."; return 1; }
|
|
touch "$HAMPACK_STATE/wine-deps-installed"
|
|
fi
|
|
|
|
# No window decorations: VARA and Winlink draw their own
|
|
wine reg add 'HKCU\Software\Wine\X11 Driver' /v Decorated /t REG_SZ /d N /f > /dev/null 2>&1
|
|
}
|
|
|
|
# --- Main ---
|
|
|
|
missing=()
|
|
for product in "${PRODUCTS[@]}"; do
|
|
IFS='|' read -r name check _ <<< "$product"
|
|
if [ -e "$check" ]; then
|
|
echo "$name is already installed."
|
|
else
|
|
missing+=("$product")
|
|
fi
|
|
done
|
|
|
|
[ ${#missing[@]} -eq 0 ] && exit 0
|
|
|
|
# The installers are Windows GUI programs; without a desktop there's nothing to show them on
|
|
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
|
echo "Not installing Windows applications without a desktop session; they'll be installed on a later update."
|
|
exit 0
|
|
fi
|
|
|
|
mkdir -p "$HAMPACK_STATE"
|
|
make_work_dir || exit 1
|
|
prepare_wine || exit 1
|
|
|
|
status=0
|
|
for product in "${missing[@]}"; do
|
|
IFS='|' read -r name check page pattern glob <<< "$product"
|
|
dir="$HAMPACK_TMP/${name// /_}"
|
|
if download_product "$name" "$page" "$pattern" "$dir" && run_installer "$name" "$dir" "$glob" && [ -e "$check" ]; then
|
|
echo "$name installed."
|
|
else
|
|
echo "$name was not installed; it will be tried again on the next update."
|
|
status=1
|
|
fi
|
|
done
|
|
|
|
exit $status
|